Easiest knock-back effect?

Get help using Construct 2

Post » Sat Jan 18, 2014 9:19 pm

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:

Image
B
20
S
4
Posts: 382
Reputation: 3,004

Post » Thu Jan 23, 2014 2:50 pm

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...
Image
B
20
S
4
Posts: 382
Reputation: 3,004

Post » Thu Jan 23, 2014 3:53 pm

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.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jan 23, 2014 6:04 pm

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.

@thebogueratTheBogueRat2014-01-23 18:06:53
B
17
S
4
Posts: 31
Reputation: 1,600

Post » Thu Jan 23, 2014 6:22 pm

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 exampleTheBogueRat2014-01-23 18:27:59
B
17
S
4
Posts: 31
Reputation: 1,600


Return to How do I....?

Who is online

Users browsing this forum: kurtbal and 9 guests