Another movement question

Get help using Construct 2

Post » Fri Feb 05, 2016 5:18 am

I have asked a similiar question before but now i ask it whit more clearity. I want an enemy to move to the left when it is a certain distance from the rigth side of the player. Then it is going to pass the player, keep moving left. When it is a certain distance away from the left side of the player it is going to switch to moving rigth. Then it is going to pass the player and repeat the process so it basically follows the player. I tried making this work by doing this.
Enemy-Event-Is whitin angle
Whitin: 180
Angle: 0
Enemy-Sub event-Compare X
Player.X-1500
Enemy-Action-Set value
Action
"left"
Enemy-Event-Compare instance variable
Action
Equals to
"left"
Enemy-Action
Simulate control pressing left
Enemy-Event-Is whitin angle
Whitin: 180
Angle: 180
Enemy-Sub event-Compare X
Player.X--1500
Enemy-Action
Set value
Action
"rigth"
Enemy-Event-Compare instance variable
Action
Equals to
"rigth"
Enemy-Action
Simulate control pressing rigth

Whit this it should work. But it doesn't. So what do i need to change to make it work?
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Fri Feb 05, 2016 1:42 pm

If this question can be answered i would like an answer.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Fri Feb 05, 2016 4:47 pm

I am going to keep replying until i get an answer.
B
11
S
2
Posts: 262
Reputation: 1,309

Post » Fri Feb 05, 2016 6:19 pm

Calfuso wrote:I am going to keep replying until i get an answer.


... and if you keep bumping your own thread after only a few hours then you will get a temporary ban.

Please be patient. It is generally accepted that you can bump your own thread after 24 hours if no response is forthcoming.

Many of the users who are able to offer help come from many different time zones.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,194
Reputation: 54,293

Post » Fri Feb 05, 2016 8:49 pm

add a variable to the enemy and call it direction and set it to 1.

Enemy: x < player.x-100
--- enemy: set dir to 1

Enemy: x > player.x+100
--- enemy: set dir to -1

enemy: dir = 1
--- simulate right pressed
else
--- simulate left pressed
B
89
S
30
G
95
Posts: 5,157
Reputation: 63,450

Post » Sat Feb 06, 2016 3:00 pm

@Calfuso
Please don't create multipe threads and continue to use this thread.

Don't worry, I had no intention of banning you - I just wanted you to stop bumping so much :)

Does R0J0hound's response help?
If your vision so exceeds your ability, then look to something closer.
Moderator
B
129
S
29
G
77
Posts: 5,194
Reputation: 54,293


Return to How do I....?

Who is online

Users browsing this forum: Ajbael, ismael123, lennaert, Yahoo [Bot] and 6 guests