Prevent Enemies from Moving off of Ledge [SOLVED}

For questions about using Classic.

Post » Fri Sep 07, 2012 5:48 am

https://dl.dropbox.com/u/29072735/labgame.cap

In this small example I'm working on, the player character is chased by robots.

To achieve this, I have the robots move like so:

RoboX >= PlayerX
>Set Speed to 0 - Speed.Value

RoboX <= PlayerX
>Set Speed to Speed.Value

I want to keep them on specific platforms. So I place little boxes called Borders on the edges.

RoboX >= Border.Left
>Set RoboX to Border.Left - 4

RoboX <= Border.Right
>Set RoboX to Border.Right + 4

But that does not work.

Now, I gave the Robos platform behavior for walking around - I've tried Custom Movement but it seems to run in to the same problem.

I suspect that the issue might lie in what the Robos detect is Border.Left and Border.Right, because it seems that toggling one or the other yields the same results as having both conditions on. Perhaps something with the set Horizontal Speed to Speed.Value? The possibilities are endless :p


There is the possibility that even in the space of 4 events, I've complicated this more than necessary. Basically, I just want the game's enemies to stay on their own platforms, hanging out on the edge until the player moves past them, changing their direction. They're always following the player.EmperorIng3602012-09-10 06:02:48
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Fri Sep 07, 2012 5:21 pm

I made a fix for you: https://dl.dropbox.com/u/52670878/robotfix.cap
Using the abs() built in function I cut the number of events in half.
B
6
S
1
G
1
Posts: 69
Reputation: 1,019

Post » Fri Sep 07, 2012 8:42 pm

As usual, I would not have thought to use the abs() system expression - really the Achilles heel of my Construct knowledge.

Thanks for the help! I didn't think you could shrink down 4 events any further, but I guess that shows what I know! : p

B
19
S
3
G
2
Posts: 148
Reputation: 1,945


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests