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

2013/8/15

Adding actors

mattjames mattjames

2013/8/15

#
Can someone please put up the code that I would need to add and actor to a world fro within another actor (so when my car passes moves a person is added to the screen).
Gevater_Tod4711 Gevater_Tod4711

2013/8/15

#
To add an actor to the world you have to use the method addObject(Actor, int, int); Using this method you add an actor to the world at the coordinates you give the method (the int's). When you want to add an actor from another actor class you need to use getWorld().addObject(Actor, int, int); You can also look this up in the Greenfoot API. All mehtods are listed and described there.
You need to login to post a reply.