Getting a sprite to prioritize it's destination

For questions about using Classic.

Post » Sat Aug 01, 2009 12:22 pm

I'm been stroking my chin for a couple of hours now trying to figure out how to achieve this:

I have a sprite that I want to identify the closest object to itself with the private variable 'Flagged' showing a value of 0, walk over to (the sprite is using the RTS movement behavior) that object and set the Flagged variable to 1, and then find the next closet object with 'Flagged' set to 0, and so on.

...Any ideas of how to accomplish this?
B
1
G
3
Posts: 5
Reputation: 835

Post » Sat Aug 01, 2009 4:35 pm

Does this work?

If sprite is not moving
if object value "flagged" = 0
pick closest object to sprite.x, sprite.y
- sprite: move to object

sprite arrives at target
sprite is overlapping object
- set value 'flagged' to 1
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests