Make player recoil when hit?

Get help using Construct 2

Post » Mon Feb 03, 2014 5:58 pm

I want the player to recoil when they're damaged by the enemy. The best way I can see to do this is on collision with the enemy, set vector x to whichever direction. The problem is I want the player to recoil faster than that. If I change the player's max speed and then set vector x, this seems to work, but then the player is able to move very quickly during that time. What is the best way to go about bouncing the player back?
B
5
S
1
Posts: 15
Reputation: 341

Post » Mon Feb 03, 2014 6:03 pm

Disabling controls during recoil would take care of any further movement, wouldn't it?

start ignoring user input it was called I thought..LittleStain2014-02-03 18:04:30
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 » Mon Feb 03, 2014 6:24 pm

For reference, how would I handle this if I want the player to retain their control without allowing them to move so quickly during the recoil?
B
5
S
1
Posts: 15
Reputation: 341

Post » Mon Feb 03, 2014 6:33 pm

With a lot of conditions.

Every exception to the rule has to be described in detail as not to interfere with the rule in general.

What would probably be best is to have a completely new set of rules during recoil.
So create a group for movement during recoil and one for normal movement and setting the normal movement deactivated during recoil and the recoil movement deactivated during normal movement.

But Then again, I'm not sure what kind of control you'd like the player to have and what is happening now and why that isn't good, so maybe you could avoid it with a very simple event..
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 » Mon Feb 03, 2014 7:36 pm

Thank you for sharing your work and impressions. I love your choices.
B
2
Posts: 1
Reputation: 152

Post » Tue Feb 04, 2014 6:43 pm

give your player bullet behavior.set it disabled on start
when enemy on collision with player
player x<enemy x               then
                             set player platform behavior disabled
                             set player bullet enabled
                             set bullet angle of motion 180
                             wait x seconds (you decide)
                               set player platform behavior enabled
                             set player bullet disabled
when enemy on collision with player
player x>enemy x               then
                             set player platform behavior disabled
                             set player bullet enabled
                             set bullet angle of motion 0
                             wait x seconds (you decide)
                               set player platform behavior enabled
                             set player bullet disabled
                            
this way you can set any speed for the bullet until you are happy with the result
tip if you want arched hitback then set gravity for bullet to on and go for bullet angle of motion to 240 and 320 !Roccinio2014-02-04 18:53:37
B
15
S
6
G
4
Posts: 277
Reputation: 3,948


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests