- Home /
Adding knockback to a 2D game (in C#)
Ok so I'm currently working on a 2D game (Platformer kinda) in my freetime, i dont know a lot about coding or stuff like that but until now I've created a player which can move around, using animations, that also has health. I've also added some "spikes" that deal damage to the player.
What I'm having trouble with is adding "knockback" to the player when it hits the spikes. I don't really know how to do it and the ways i have tried don't seem to work.
I would really like it if anyone could help me create/add this to the game, and preferably as soon as possible.
Thanks in advance!
Btw please use @username to notify me about your answer!
Answer by PersianKiller · Dec 23, 2017 at 04:08 PM
https://www.youtube.com/watch?v=sdGeGQPPW7E
watch this it helps.
Answer by Kaymanga_ · Dec 27, 2017 at 12:48 AM
if your using rigidbodies just you
rigidbody.Addforce(new Vector2("x axis", "y axis" ))
what if im not using rigidbodies? @$$anonymous$$aymanga_
why not using rigidbodies!!! it's very simple and nice !