Two enemies close in when in center

For questions about using Classic.

Post » Sat Apr 26, 2008 12:20 am

Hello everyone, I'm not sure how to word this subject wise :P

Here's a little pic of the game to illustrate the scenario



What I'm trying to do is have the two ball guys (chompets) stay stationary when you are not between them, but as soon as you are in the middle of the two, they move forward in center to bite you. Once you are out of the middle of them, they retreat back to their normal positions.

Argh I'm so out of shape in coding... :oops:
B
13
S
3
G
5
Posts: 286
Reputation: 3,193

Post » Sat Apr 26, 2008 12:26 am

Dog X greater then Ball1 X
*Dog X lower then Ball2 X
-Move together
Else
-Move back again.

Or is that how the else event works?
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Sat Apr 26, 2008 7:25 am

You could also just use a simple detector which is the same size as the space between the chompets...

>Player is colliding with detector
-Chompets movement start

>Player is NOT colliding with detector
-Chompets do nothing

Apart from making a bit of code that returns them to normal position, that would probably be one way of doing it, though with math it wouldn't matter how far apart they were and it would still work without having to make various detector objects.
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
45
S
17
G
37
Posts: 2,853
Reputation: 25,966

Post » Sat Apr 26, 2008 9:08 pm

Thanks guys I'll try it out. I was having brain poos yesterday :wink:
B
13
S
3
G
5
Posts: 286
Reputation: 3,193


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests