Pushback when hit

Get help using Construct 2

Post » Sun Mar 03, 2013 1:04 pm

Is it possible to make my enemy to get pushed back smoothly like 7 pixels when hit by a bullet?
Is there even a plugin for this??
I want the enemy to get pushed back 180 degrees from the angle it was shot.
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sun Mar 03, 2013 7:15 pm

B
79
S
24
G
55
Posts: 4,755
Reputation: 41,273

Post » Sun Mar 03, 2013 8:33 pm

I did that but it pushes towards me instead of away from me :/ What did I do wrong?
I use bullet behaviour for it to move towards me regularly. And I tried to disable that so they won't follow me anymore and then it works. Can I fix this somehow without using Custommovement?
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Sun Mar 03, 2013 9:54 pm

@condolent You need to look at the direction the bullet is traveling and base the amount of pixels you are moved off of that. Maybe on collision you check to see if the players X or Y coordinate (depending on which direction your game goes) and if it is greater than or less than the X or Y coordinate of the player, move them + or - 7 pixels as needed....
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Mon Mar 04, 2013 5:32 pm

That only works if it's a platform game, doesn't it?
Because I'm not making a platform game. More like a top-down shooter
Website Twitter Indie Developer
B
20
S
5
G
4
Posts: 201
Reputation: 2,884

Post » Mon Mar 04, 2013 11:15 pm

Nope that Method should work exactly the same for the Top down shooter except of course that it wont appear the same....because of the viewpoint..the mechanic is the same the visuals arent but if it was me i would combine the bullet effect with an animation that is called just prior to the Knockback mechanic...this will increase the illusion of knockback if you make your animation believable as well...
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
30
S
11
G
8
Posts: 313
Reputation: 7,360

Post » Tue Mar 05, 2013 8:13 am

Here is one approach that I actually did as an example for few other questions:

Bang bang example
B
24
S
8
G
7
Posts: 756
Reputation: 7,202


Return to How do I....?

Who is online

Users browsing this forum: blackhornet, selaus and 0 guests