Easiest knock-back effect?

0 favourites
  • 5 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • I'm creating my game, Psi, with a beat-em-up style layout. What would be the easiest way to make a knock back effect to drive the zombies backwards from the player when they're hit, whichever way the player is facing? Here's a picture to give an idea of the layout:

    <img src="https://dl.dropboxusercontent.com/u/60595907/Screenshot%202014-01-18%2016.05.53.png" border="0" />

  • Would using bullet behavior be best? I saw this idea suggested:

    "You could use the bullet behavior:

    +PlayerSword collides with Enemy:

    ---Enemy:Bullet:Set speed: 400

    ---Enemy:Bullet:Set angle of motion: angle(player.X,player.Y,self.X,self.Y)

    ---wait 1/4 seconds

    ---Enemy:Bullet:Set speed: 0"

    But I wonder if this would conflict with the bullet behavior the walkers already have...

  • It wouldn't conflict if you gave your enemies a boolean and switched it when the effect is needed and switch it back after effect has played.

    Then make the "normal" behaviour play when boolean is false and the "knockback" when boolean is true.

  • Assuming the enemy has platform behavior and are reacting to a collision, Couldn't you set animation to "blownback" and set Vector X to 600 (or appropriate amount): positive vector if player.x < enemy.x or negative vector if player.x > enemy.x?

    A capx example would help a lot in finding an answer for your circumstance.

    TheBogueRat

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Looks like you said you are using the bullet behavior, haven't tried that for an enemy myself.

    Have you tried.

    if enemy bullet speed is already 100, when hit by sword set bullet speed to enemy.bullet.speed * -2 (opposite direction, double speed) Then you don't have to worry about direction since I assume the sword will always be in front of the player. Then set a high deceleration so you don't even have to set the speed to 0. Unless you want him to get back up, then you'd just set speed to 0 after a wait, animate geting up, then set speed normal.

    Hope this wasn't too confusing. Here's a quick example

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)