Events for New Targeting System
I wanted to post again showing some of the events for my fellow Construct developers. I apologize as this post may be a bit unorganized, images won't cover all the events pertaining to this topic, and a lot of basic boring events in the images. But I decided to post anyway to throw some stuff out there to anyone interested and feel free to ask me questions if you want to learn more about it. Also, I hope to clean up and organize all of this once it is more finalized, so sometimes explaining it to others can really help clarify it for myself.
So lets get to it:
I'll start with how the pointer moves back and forth across the bar as this is probably the most interesting part to other developers, even though it is really a simple lerp(). I'll start with the screenshot of the events:
- So first off it is contained in a deactivated group so it will only run when desired.
- Arrow has two instance variables: Speed and Position
- Every tick Arrow's position is set to lerp() where 0 is left border box of the bar and 1 is the right border box.
- The Instance Variable 'Speed' is added to Instance Variable 'Progress' every tick (with the dt to make framerate independent)
- Everytime arrow reaches either end (0 or 1) the speed slows down, this is to give the bonus of making it easier the longer you 'aim', and the direction is reversed. Could have just multiplied by -1 but didn't want to risk it running twice and cancelling out so used absolute value. To make positive take the absolute value, to make negative take the absolute value and times by -1 Example: abs(-10)*-1 is still -10
The other events below I won't really speak about as most are straightforward, setting position and visibility, etc. I use a lot of functions so it may be impossible to follow everything.
I will highlight one thing: setting the width of bar1, bar2, and bar 3. These respectively are for head shot, body shot, limb shot/grazing shot. The size they are based on depend on the distance of the enemy which is passed as a parameter to the function. I plan on tweaking the formula later when balancing testing but is basically subtracting the distance and dividing by numbers to found when testing.
Feel free to ask any questions as I know I didn't cover everything. Hope a few enjoy and find it useful