how to make a knockback behavior?

how to make a knockback behavior?

example: my Enemy actor is moving to the direction of my Player-actor using (move to)
then when i shoot the enemy i want it to be knockback a liitle, or push him a little at the back..
then continue to move forward to my Player-actor.
btw im constraining the x and y position of my player-actor

the question is when the bullet collide on my enemy actor, it stop from (moving to) my player-actor and move into different direction.

Comments

  • RabidParrotRabidParrot Formally RabidParrot. Member Posts: 956

    @rainhasntstop

    You would be better off using the,

    change attribute self.motion.linear.velocity.x

    First change the self.motion.linear.velocity.x to (the speed you want). A negative number will move left and a positive number will move right

    Then tell the actor that when it collides with bullet.

    For 1 second change attribute self.motion.linear.velocity.x to

    -1 *(self.motion.linear.velocity.x)

    After 1 second change attribute self.motion.linear.velocity.x to your original velocity.

    See if this works.

  • rainhasntstoprainhasntstop Member Posts: 43
    edited April 2015

    doesn't work sir @RabidParrot

    i need to know the position for y also..
    i want to make game like this
    but i want the tank to be knockback when it got hit by a bullet
    need to trace where the tank is facing.

    im gonna put hp on enemy tank so it wont be hit once, and has effect for pushing back for a little when it got hit by a bullet

Sign In or Register to comment.