This site requires JavaScript, please enable it in your browser!
Greenfoot back
JasonIsMobile
JasonIsMobile wrote ...

2014/11/2

Movement like doorkickers

JasonIsMobile JasonIsMobile

2014/11/2

#
I've been totally stumped on how to do this. I want a modular movement by drawing paths with my mouse for my actors to follow. Modular as in the units in my squad wont ever follow each other's paths as they cross over them. video for reference to what i mean: https://www.youtube.com/watch?v=TR6hb5WQVQg
jimboweb jimboweb

2014/11/10

#
Just to be clear, you want to be able to drag a different path for each actor? How would they know which path is for which actor? Would you start by dragging from the actor you want to move? This is an interesting problem! I'm going to think about it.
danpost danpost

2014/11/10

#
Each path actor can have instance fields to (1) hold a reference to the Actor (unit) that it is directing (or an id code for the unit that the unit has a reference to); and (2) the next location to move to (where the next path actor is located, if not the end of the path). Then program the unit actors to first determine if the path belongs to it, then if so, save the location to move to next and proceed there. If none of the paths at any target location belong to that unit, then the end of the path has been reached. For an example (at least something that is similar), check out my Object Trail Following Demo scenario. It uses colored lines. Each actor follows a different color.
You need to login to post a reply.