Projectile Range and lifespan
I am attempting to make a weapon for a game where the ammunition will fly a fixed distance before despawning. So far, I've been tweaking velocity and a timer to destroy, but i am unsatisfied with this, as it leaves a lot to be desired for precision and requires a lot of trial and error.
I thought of having a condition in which the projectile tracks its X position compared to the player's position, (an game attribute constrained for multiple purposes) but that means the player could theoretically run after the shot and keep it traveling further than desired. If I can make this work, I can use it to adjust more than one weapon for this game. I want the shot to only travel a specific length from its own point of origin, but I cant just check position against itself. Should i, say, create an attribute that grabs its spawn X position, or would that not work due to it moving from the start? I definitely think I'm close with this, just missing something specific....
Comments
I would record the projectiles starting X position and use that to measure the lifespan from, not the players X position.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
So that will grab it when it first spawns with a basic Change Attribute command? It wont be affected by the projectile being spawned in motion?
that'll work..
yep, like @StormyStudio says, should work fine.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Cool, thanks.