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

2012/5/3

Transparency

andrewsadik andrewsadik

2012/5/3

#
Hey every body. Does anyone know how to make an actor disappear wiothout removing it using "setTransparency" method. Thanks
chiefnoah chiefnoah

2012/5/3

#
It's an image method so you have to create a GreenfootImage object (ex. GreenfootImage image = new GreenfootImage(100, 100); image.setTransparency(x);) Where x is a number between 0 and 255 (0 being completely transparent and 255 being solid)
Duta Duta

2012/5/3

#
I assume you're asking how to remove an actor? If so:
/*In the Actor's class*/ getWorld().removeObject(this);
/*or in the world class*/ removeObject(anActor);
Or if you're asking how to make it invisible using setTransparency(...):
/*In the Actor's class*/ getImage().setTransparency(0);
/*or in the world class*/ anActor.getImage().setTransparency(0);
You need to login to post a reply.