-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevel0.java
executable file
·48 lines (42 loc) · 1.13 KB
/
Level0.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import greenfoot.GreenfootImage;
/**
* World for Level0 of the game
*
* @author Adrian
* @version June 13 2024
*/
public class Level0 extends Level {
private final Player player;
/**
* Constructor for objects of class Level0.
*/
public Level0() {
super();
String background = "2dPixelForestBackground.png";
int[] worldSize = {7680, 720};
scroll = new ImgScroll(this, new GreenfootImage(background), worldSize[0], worldSize[1]);
spawnFloor(scroll);
addObject(player = new Player(), 100, 622);
addObject(coinLabel, 1100, 10);
addObject(saveButton, getWidth() - 100, 40);
updateCoin();
resetCoin();
setHP(5);
setLevel(0);
int[][] blockGeneration = loadLevel(0);
spawnTerrain(blockGeneration);
}
public void act() {
followPlayer(player);
updateCoin();
saveButton.setLocation(getWidth() - 100, 40);
checkSaveButton();
checkNext();
}
public void stopped() {
TitleScreen.stopBGM();
}
public void started() {
TitleScreen.playBGM();
}
}