-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGoodEnd.java
More file actions
34 lines (31 loc) · 1.4 KB
/
GoodEnd.java
File metadata and controls
34 lines (31 loc) · 1.4 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.*;
/**
* Good end world
*
* @author Xuanxi Jiang
* @version 1.0
*/
public class GoodEnd extends World{
private final String text[] = {"You have defeated the black light orb through an epic battle. Thus, the Pokemon world returned to peace. \n\"Where did that light orb came from?\" A vulpix asked. \nYou thought of the sense of bersek and destruction which the orb radiated. \n\"The orb… was generated by the evil side of our hearts.\" \n \nThe End. \n ▽ Press [Enter] to END..."};
//private final GreenfootSound GoodEnd_BGM = new GreenfootSound("Don't_Ever_Forget.wav");
private final GreenfootImage GoodEnd_Background = new GreenfootImage("Background_GoodEnd.png");
public GoodEnd(){
super(Engine.worldWidth, Engine.worldHeight, 1);
//STGStage_1.STG_StageOne_BGM.stop();
//GoodEnd_BGM.playLoop();
this.setBackground(draw());
}
public void act(){
if (Greenfoot.isKeyDown("enter")){//When the user pressed enter, end the game.
//GoodEnd_BGM.stop();
Greenfoot.stop();
}
}
private GreenfootImage draw(){//draw the ending text
GreenfootImage tmp = new GreenfootImage(GoodEnd_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;
}
}