I'm working on a platform game and I want to create an explosion on the game. When the bomb explodes, it should affect the player [impact].
I know it's pretty easy to do with physics but I don't want to add it to the platform game.
Develop games in your browser. Powerful, performant & highly capable.
Here's an example. Click to make an explosions. The strength of the effect on the player is proportional to the distance from the explosion.
It's very close based on what I need. The only issue is that the player stop moving left or right after a few seconds even thought it's moving up or down.
That's a side effect of the deceleration/max speed of the platform behavior. You could add an instance variable, 'exploded', or something, which adjusts these values, and returns them to normal when the player is onground.
In the game if the player steps on the mine and explodes, it dies.
I don't think it will be a problem when the player hits the ground again.
Tthanks for the sample, it helps a lot!
OK, sounds good! In that case, you won't even need the instance variables. Just adjust the values on explosion.
Let's suppose there is a mine on the ground instead of the click of the mouse. Which coordinates should I change to the make it work?