How do I Send a Enemy away from player when hit!

Get help using Construct 2

Post » Wed Aug 13, 2014 1:12 am

Pretty simple, I have searched the forums but can't seem to find the answer, I know this will be simple as but I just cannot get it correct.

When player A shoots @ enemy, enemy goes backward away from player A no matter which way the enemy is facing or the player's mirrored or not mirrored.

Thanks.

I can get the enemy to go backward if player A is facing right, but as soon as the enemy starts to walk away from player A, I get nothing.

P.S This is for a Platform game style. :D
B
6
S
1
Posts: 23
Reputation: 646

Post » Wed Aug 13, 2014 1:58 am

Hi, we can't see what you're doing wrong without a capx or screenshot :)
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Aug 13, 2014 2:35 am

That's because I don't know where to start.

If "Bullet" is on collision with "enemy" set enemy Platform vector x -4000" or if "bullet is mirrored send enemy in other direction. ( but this doesnt work if the "enemy" is mirrored )
I know there is a way to set it so the enemy always goes backward from the players position. So when "bullet" hits "enemy" get the players current x,y,z and send backwards from the player so wherever and which ever direction the player is facing the bullet will always send the enemy backwards in the opposite direction from the player.
B
6
S
1
Posts: 23
Reputation: 646

Post » Wed Aug 13, 2014 5:43 am

Bump! If anyone could help me out here would be much appreciated.
B
6
S
1
Posts: 23
Reputation: 646

Post » Wed Aug 13, 2014 6:20 am

Compare the x-position of the bullet with the x-position of the enemy on collision..
Should work..
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 » Wed Aug 13, 2014 6:54 am

How would I do that exactly, sorry very novice.
B
6
S
1
Posts: 23
Reputation: 646

Post » Wed Aug 13, 2014 7:01 am

bullet on collision with enemy
system compare: bullet.x>enemy.x
- enemy move left
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 Aug 14, 2014 2:51 am

This wont work, if the enemy is mirrored and is shot in the back it moves towards the player not away!
B
6
S
1
Posts: 23
Reputation: 646

Post » Thu Aug 14, 2014 3:00 am

All I want to do is When bullet hits enemy no matter what way Im facing or the enemy is facing to send the enemy 4000 pixels away from the players current x.
B
6
S
1
Posts: 23
Reputation: 646

Post » Tue Jan 20, 2015 8:36 pm

You would use the action "Move at Angle".


Bullet ---> On collision with Enemy / Enemy ---> Move 4000 pixels at angle angle(player.X, player.Y, enemy.X, enemy.Y)
B
22
S
9
G
3
Posts: 203
Reputation: 3,653


Return to How do I....?

Who is online

Users browsing this forum: AnD4D and 21 guests