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

2021/12/15

cutscene

Dlantz Dlantz

2021/12/15

#
how would i make a cutscene at the end of my game that would, once done, would stop the game
danpost danpost

2021/12/15

#
Dlantz wrote...
how would i make a cutscene at the end of my game that would, once done, would stop the game
You can make a new world subclass for that.
Dlantz Dlantz

2021/12/16

#
so i would make it the background with a timer. so once the timer went off it'll be timed with the end of the gif
danpost danpost

2021/12/16

#
Dlantz wrote...
so i would make it the background with a timer. so once the timer went off it'll be timed with the end of the gif
You can use a boolean field to track whether on or off the initial image:
private boolean notImage0 = false;
private GifImage gif = new GifImage("cutscene.mp3");

public CutScene extends World
{
    super(600, 400, 1);
    setImage(gif.getCurrentImage());
}

public void act()
{
    GreenfootImage img = gif.getCurrentImage();
    if (img == gif.getImages().get(0)) == notImage0) // a change in image involving the first image has occurred
    {
        notImage0 = ! notImage0;
        if ( ! notImage0)
        {
            Greenfoot.stop();
            return;
        }
    }
    setImage(img);
}
I am not sure if I got all the method names right (I did not check) and I am quite sure the class and gif names are probably wrong;; but, the gist of it is expressed here.
Dlantz Dlantz

2021/12/16

#
1 thank you, also a joke a yes my favorite gif an mp3
You need to login to post a reply.