[Solved] Enemy Facing/Image Direction Issue

Get help using Construct 2

Post » Wed Mar 12, 2014 11:04 pm

So I have an enemy that I want to face the player.
It's a 2D platformer.
The player can jump over the enemy and I want the enemy to face the player from both sides.
I use the program code below to do this.

player | X < enemy.X | enemy | Set Mirrored
player | X > enemy.X | enemy | Set Not Mirrored

Now this works perfectly for ONE of the enemies, but not duplicates of the same type of enemy.

How do I make all the enemies of the same type face the player?
Last edited by hypergalaxy on Wed Apr 02, 2014 3:39 pm, edited 1 time in total.
B
8
S
3
Posts: 21
Reputation: 751

Post » Wed Mar 12, 2014 11:16 pm

what event triggers this code?

you most likely need to go through all the enemies on the screen. Use a For Each loop (which will run completely in 1 tick). You should put all your enemies in a Family as well.
B
88
S
29
G
14
Posts: 1,154
Reputation: 15,003

Post » Wed Mar 12, 2014 11:24 pm

That's because with the order you used you're picking the player, and not the enemies.

Instead of

player | X < enemy.X | enemy | Set Mirrored
player | X > enemy.X | enemy | Set Not Mirrored

You use

enemy | X < player.X | enemy | Set Mirrored
enemy | X > player.X | enemy | Set Not Mirrored
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219

Post » Wed Mar 12, 2014 11:48 pm

7Soul

Thank you!
What an easy fix!
Thank you!
B
8
S
3
Posts: 21
Reputation: 751


Return to How do I....?

Who is online

Users browsing this forum: Syazanie Amirin, Yahoo [Bot] and 8 guests