Answer the question
In order to leave comments, you need to log in
How to implement the dependence of the shot speed on the speed of the character?
2D topdown. Let's say the player runs up and shoots to the right, then the shot will fly to the right, but with a slight Y-shift upwards. Or, for example, the player runs to the right and shoots to the right, then the speed of the shot to the right will be more than normal. This is well implemented in The Binding of Isaac, you need something similar, how can this be implemented?
Answer the question
In order to leave comments, you need to log in
Before the projectile spawns, you can take the last change in the player's position (e.g. went from 0.0 to 0.1) and add to the direction of the projectile, for example 10% of that change. (add 0.0.1 to projectile vector)
Add to the projectile's motion vector a fraction of the unit's motion vector.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question