OK it’s a general question, just how the system of my game should work.
So there are lots of enemies and a player. When a enemy touch a player, the player gets a hit and a “push” from the monster, and then blinks to 1.5 seconds. Wile the “push” (really really fast), the player can’t do nothing.
Also, all the monsters will always move the same. The move of the monsters will never be affected by the player. I can’t do it kinematic because they DO affect from the gravity. So how can I do that? All that thing, include the “push”, what should I do?
There’s also a good example for what I mean in this YT video from 0:27 : http://www.youtube.com/watch?v=tVr8S6WXdog
Thanks.
With your example I’m presuming that you don’t plan on actually having the monster and humans reacting to one another.
Either way, add a custom contact listener to the world and within the contact listener check if a player and a enemy shape create a contact point. If so applylinearimpulse() to the playerbody to the effect that you would like and disable all key input from the user to prevent any change in motion. Then just have a property on player preventing it from applying the impulse if its just been hit by the monster.
Also when you create the bodies you’ll need to set the player and enemy instance as the body.UserData()
}
}
Then you can just edit values as necessary. Hope this helps and good luck!