How to make an enemy get pushed back when it gets hit?

Hey need your help with something…
I’m kinda confused what to use in forces (instant or permanent) … I’m a bit confused in this…
.
If someone can make an example of an object (for example an enemy) getting pushed back when another object touch it (for example a bullet) … that would be very helpful…

Thanks as always :))

It depends on how you move the enemy and the bullet.
Probably, you can apply an instant force to the enemy with an angle of bullet.Angle()… or bullet.ForceAngle().

1 Like

@Gruk hmm… can you make a small example for that? because I’ve been trying a lot and it just won’t work with me…

Using the platformer example:

1 Like

@CorianderGames
Here I switched to permanent force and added a timer to make it more realistic.

1 Like

@Gruk Now that’s what I’m talking about, thank you so much for the help :slight_smile:
Now I’ll implement that into my game and if something comes up I’ll let you know, thanks again!

2 Likes