-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelThree.java
78 lines (52 loc) · 1.79 KB
/
LevelThree.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import mayflower.*;
/**
* @author suhas, tarun, alex
* this is the 3rd level of our game, it is the minecraft end
*/
public class LevelThree extends World {
private String[][] tiles;
private Cat c;
private EnderDragon ed;
private boolean alreadyAdded = false;
private TextRenderer t;
public LevelThree(int score, int health) {
t = new TextRenderer(this);
Mayflower.showBounds(true);
setBackground("assets/BG/end.jpeg");
Mayflower.showBounds(true);
t.showText("this is the FINAL WORLD", 350, 450);
ed = new EnderDragon(100, 0);
addObject(ed, 100, 0);
tiles = new String[6][8];
for (int i = 0; i < tiles[0].length; i++) {
for (int j = 0; j < tiles.length; j++) {
if (j == 5) {
addObject(new Block(), i * 45, j * 100);
addObject(new Lava(), i * 50 + 515, j * 100);
}
if (j == 1 && (i % 2 == 1 || i == 0)) {
addObject(new Block(), i * 100, j * 100 + 50);
}
}
}
addObject(new Ladder(), 400, 200);
addObject(new Emerald(100, 400), 100, 400);
c = new Cat(score, health);
addObject(c, 0, 300);
addObject(new Sword(), 500, 50);
}
public void act() {
t.removeText(10, 30);
t.showText("score: " + c.getScore() + " health: " + c.getHealth() + " DRAGON HEALTH: " + ed.getHealth() , 10, 30);
if (ed.getHealth() <= 0) {
removeObject(ed);
if (!alreadyAdded) {
addObject(new EndFountain(), 200, 400);
alreadyAdded = true;
}
}
}
public TextRenderer getTextRenderer() {
return t;
}
}