Added Speed Arrows And Midair Effect


So today I added back particle systems and added the arrow GFX fully aka fixed the little bits of bugs that were leftover from Tuesday.

For the arrows, the final setup is quite simple. I basically just say that there's N sets of arrows all of which are S count. For each N set, you draw S arrows in other words. So set 0 will draw 6, set 1 will draw 6, etc.
The tricky part that took me a little bit of thinking was about how I wanted to get the final arrows in the desired transform while also making sure they go in a radial pattern around the boat.
The math ended up being a simple center the arrow about the origin before doing any transforms so i'm basically talking about "model space".
Then, apply the rotation that will ensure the arrow points in the direction that the player is moving only about the XZ plane and translate the arrow by some offset that'll move it positively to the left such that it's at 0 radians if you were to refer to the unit circle.
After that, I just apply a rotation to the vector that's a simple Z axis rotation R degrees where R is found by dividing 2PI (360 degrees) by the total number of arrows to draw (S) and adding that value to R each iteration of the loop up to arrow count (S).
And that's it. I also made it so that each N set of arrows has a higher divide about your current speed which is found by getting the squared magnitude of how much you traveled this frame compared to last frame. So new position - old position and do the dot product on only the XZ plane so it's a 2 component dot product instead of the 3 as i'm omitting Y from this. Final alpha channel color for each set of arrows = squared magnitude of XZ plane from last frame to this frame pos / current arrow set divide value. This does mean that if I change movement speed values later, you could get arrows appear in patterns that don't make much sense but that's just where i'm at atm and will deal with it once it bites me in the ass later as I don't know of a better way to do this atm :)

For the particle system, I just followed a really good example from Handmade Hero which shows you a very simple way to do particle systems or so I think.
Basically, my system is currently nearly one to one. Basically I have some code that checks if you should spawn aka set some data into a particle (so if above water), and I have the following code that will always try to draw the particle that might be spawned. I forgot to mention that the code that draws the particle also does the math portion of the simulation so it'll get the new position for next frame and it'll also get the new velocity based on its acceleration (which i've locked to a constant of gravity * some "meatiness" factor which is basically just weight).

I also eariler made a cool trail effect by not having the position of the spawned particle move at all / very little which could be cool long term but i'm unsure what that really does in terms of gameplay. Then again, the current particle system that i'm using is just for looks and doesn't probably do anything for gameplay (uncertain as I haven't played around with it long enough to really know if it's good / bad or really effects gameplay in some significant way).

That's all I got for today so please let me know your thoughts on the current build! Thank you for reading and have an awesome day :]

Files

Funmi_Zip.7z 2 MB
Oct 28, 2021

Get Funmi

Download NowName your own price

Leave a comment

Log in with itch.io to leave a comment.