-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBadEnd.java
More file actions
34 lines (31 loc) · 1.35 KB
/
BadEnd.java
File metadata and controls
34 lines (31 loc) · 1.35 KB
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
32
33
34
import greenfoot.*;
/**
* Bad end world
*
* @author Xuanxi Jiang
* @version 1.0
*/
public class BadEnd extends World{
private final String text[] = {"The black light orb defeated you after destroying all of your shields which was also generated by the forces of the orb. The Pokemon world have lost all of its hope against the orb. However, the flame of determination persisted, and will be passed to the next world… \n\nThe End. \n ▽ Press [Enter] to END..."};
//private final GreenfootSound BadEnd_BGM = new GreenfootSound("N's_Castle.wav");
private final GreenfootImage BadEnd_Background = new GreenfootImage("Background_BadEnd.png");
public BadEnd(){
super(Engine.worldWidth, Engine.worldHeight, 1);
//STGStage_1.STG_StageOne_BGM.stop();
//BadEnd_BGM.playLoop();
this.setBackground(draw());
}
public void act(){
if (Greenfoot.isKeyDown("enter")){//When the user pressed enter, end the game.
//BadEnd_BGM.stop();
Greenfoot.stop();
}
}
private GreenfootImage draw(){//draw the ending text
GreenfootImage tmp = new GreenfootImage(BadEnd_Background);
tmp.setFont(new Font("Helvetica", 24));
String out = Engine.wordWrap(text[0], new Font("Helvetica", 24), 630);
tmp.drawString(out, 488, 240);
return tmp;
}
}