How do I check position of sprite on screen (layer position)

Get help using Construct 2

Post » Thu Jun 11, 2015 9:04 am

hello to all

how to do this:
when ennemy player is on the left edge of the screen he need to change his direction to the right, and when he is on the right side of the screen he change the direction to the left.

thanks
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963

Post » Thu Jun 11, 2015 12:21 pm

There are two ways I can think of.

You can compare the X of the enemy every time the enemy leaves the layout, and then depending where it is you change it's direction.

Or, I don't know if this is the best way to do it, but this is how I do it, you can create invisible sprites that doesn't interfere with the game, and then you set the enemy to change directions every time it collides with the invisible object.
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Fri Jun 12, 2015 11:06 am

yeah thanks i was thinking of that, adding 2 objects for reversing direction, who finally solved that problem.
thanks :D
B
41
S
16
G
7
Posts: 1,750
Reputation: 9,963


Return to How do I....?

Who is online

Users browsing this forum: jojomickymack and 26 guests