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

2019/7/14

im trying to make a actor fade out the world but cant figure it out

Coltz Coltz

2019/7/14

#
import greenfoot.*;

/**
 * Write a description of class WaveOne here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class WaveOne extends Waves
{
    /**
     * Act - do whatever the WaveOne wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        Fade();
    }    
    public double fade = 255;
    public void Fade() 
    {
        {
            while(fade != 0)
            {
                getImage().setTransparency(0);
                fade = fade - 0.5;
            }
        }
    }    
}
this is what i got so far if any one can help that would be great, thank you
danpost danpost

2019/7/15

#
If you want other things to happen while the fading is taking place (not specified), you cannot use a while loop. To fade, you must repeatedly change the transparency value (you consistently set a zero value).
You need to login to post a reply.