-
Notifications
You must be signed in to change notification settings - Fork 0
/
Door.java
31 lines (27 loc) · 941 Bytes
/
Door.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Door here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Door extends Actor
{
/**
* Act - do whatever the Door wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
GifImage door = new GifImage("door.gif");
public void act()
{
setImage(door.getCurrentImage());
//when it is clicked, it will stop end.wav playLoop, change current world into World_Gender.
//and start to playLoop the selector.wav
if(Greenfoot.mouseClicked(this)){
World_End.end.stop();
Greenfoot.setWorld(new World_Gender());
World_Gender.selector.playLoop();
}
getWorld().showText("retry", getX(), getY()+30);
}
}