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

2012/6/6

Get Location from an other Actor

1
2
rosh11 rosh11

2016/5/1

#
how can I pass the locations of an actor by another actor and pass that location to another actor?
danpost danpost

2016/5/1

#
rosh11 wrote...
how can I pass the locations of an actor by another actor and pass that location to another actor?
Please explain the situation in detail and when, why and what you wish to do as far as the locations.
rosh11 rosh11

2016/5/1

#
when one actor reached to the object then another actor must come to that location. like mine detection task.
danpost danpost

2016/5/1

#
"mine detection task" is not familiar to me. However, you will probably need to have the third actor store the location of or a reference to the actor it needs to go to. Which depends on where you want the actor to go -- to the location of the actor is at when the first one reached it or to wherever that actor may be by the time the third actor gets to it. A method to set the field or fields would help. The first actor will need to get or retain a reference to the third one, so the coordinates or actor can be passed to the third one. It may be possible to avert using these fields if only one of each type of actor is in the world. Then you would just get those types of actors from the world using:
1
Actor actor = (Actor) getWorld().getObjects(Whatever.class).get(0);
You need to login to post a reply.
1
2