How do I have my enemy turn to face me? <solved>

Just started using Construct 2? Post your questions here

Post » Thu Mar 31, 2016 5:39 am

I got him to follow me, but when I get around him he chases me like he's walking backwards. How do i "mirror" him when I get behind him?

This is an "arena" type game, so I want all characters running around the arena.
Last edited by jfonz001 on Thu Mar 31, 2016 6:34 pm, edited 1 time in total.
B
7
S
2
G
1
Posts: 10
Reputation: 997

Post » Thu Mar 31, 2016 3:50 pm

You can use the behavior Turret on the enemy (don't forget to add him the target (your player) at the start of the layout)
You can compare the height between the player and the enemy and change the enemy angle.
You can do every tick enemy set angle toward (player.X,player.Y) (player is the player sprite name)

Here's a post about a question like yours : here
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Thu Mar 31, 2016 4:37 pm

Right, but then when he rotates to face the player he is upside down.
B
7
S
2
G
1
Posts: 10
Reputation: 997

Post » Thu Mar 31, 2016 4:49 pm

Can you upload a capx ?
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Thu Mar 31, 2016 5:28 pm

Sure!....I'm not sure how though. I've managed to get it somewhat working by playing around with the angles, flipping/mirroring and events, but now my death sprite is flipped when my baddie dies facing the other direction.

But yeah I'll upload if you could show me how...sorry I'm a serious newb to this stuff, having fun though
B
7
S
2
G
1
Posts: 10
Reputation: 997

Post » Thu Mar 31, 2016 5:34 pm

Try DropBox, Google Drive or OneDrive (formerly SkyDrive).

Or you can take screenshots of your events if it's not too complicated and post the pic.
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Thu Mar 31, 2016 5:43 pm

http://www.megafileupload.com/j089/wizardsarena.capx

How's that?

Or this?

https://drive.google.com/file/d/0B3UaHQ ... sp=sharing

Note: Sprites are not my own, got them from a "free art" website. Please have mercy if I violate any rules, not making any money off of this!!!
B
7
S
2
G
1
Posts: 10
Reputation: 997

Post » Thu Mar 31, 2016 6:05 pm

Okay, under the every tick event remove everything the every tick included.


add an event
-if sprite10 X > Sprite6.X (Compare X position sprite10)
add the action
- Sprite10 set not mirrored

then after this event add another event

Else
add the action
- Sprite10 set mirrored



If the Sprite6 X is lower than the Sprite10 X, Sprite10 keeps the initial angle but if the Sprite6 has a higher X than Sprite10 the Sprite10 is mirrored.

Hope it works for you.
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Post » Thu Mar 31, 2016 6:32 pm

Gahh! That's it think you! This looks so much better now!
B
7
S
2
G
1
Posts: 10
Reputation: 997

Post » Thu Mar 31, 2016 6:38 pm

I edited my post with some changes, there were mistakes.
B
12
S
7
G
4
Posts: 114
Reputation: 3,067

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest