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

2012/5/13

Arranging Actors

Matt Matt

2012/5/13

#
I have approximately 10 actors. I want some actors to be able to be able to act over the top of another actor. I have a car (actor) that needs to drive into a parking space (actor), but at the moment the car drives underneath the parking space
danpost danpost

2012/5/13

#
Use the setPaintOrder method. Check it out in the Greenfoot API, in the World class. That will at least help straighten out the different classes; however, will not help with actors of the same class. To make them show over others of the same class, save its location, remove it, and add it back into the world.
int x = getX();
int y = getY();
getWorld().removeObject(this);
getWorld().addObject(this, x, y);
You need to login to post a reply.