/
Inferno1.java
executable file
·243 lines (216 loc) · 7.83 KB
/
Inferno1.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
import greenfoot.*;
import java.util.*;
//Sean
/**
* Sean's Level
*/
public class Inferno1 extends Trap
{
Counter shurikenCounter = new ShurikenCounter(getThisWorld(),"Shurikens: ");
Counter powerCounter = new PowerCounter("Power: ");
Counter levelCounter = new Counter("Stage: ");
Counter healthCounter = new HealthCounter(getThisWorld(), "Health: ");
private List <MeleeMinion> meleeMinions;
private List <RangedMinion> rangedMinions;
Ninja ninja;
// Inferno Themesong https://www.youtube.com/watch?v=kGYRIf6RdS4
GreenfootSound burningSteppes = new GreenfootSound("Music of Cataclysm - Burning Steppes.mp3");
private int delay = 11;
private int fireballDelay = 11;
private int counterDelay = 0;
static boolean played = false;
public Inferno1(Ninja ninja)//sean
{
super();
burningSteppes.setVolume(40);
this.ninja = ninja;
ninja.addPowerUp(4);
prepare();
}
private void prepare()//sean
{
InfernoDoor door = new InfernoDoor();
addObject(door, 663-50+35+5, 651-50);
for(int i = 0; i<14; i++)
for(int j = 0; j<2; j++)
{
InfernoFence infernoFence = new InfernoFence();
addObject(infernoFence, 25+j*700, 50*i+25);
}
for(int i = 1;i<14; i++)
for(int j = 0; j<2; j++)
{
InfernoFence infernoFence = new InfernoFence();
addObject(infernoFence, 50*i+25, 25+j*(700-50));
}
for(int i = 0; i<9; i++)
{
InfernoFence infernoFence = new InfernoFence();
addObject(infernoFence, 50*i+25, 125);
}
for(int i = 0; i<9; i++)
{
InfernoFence infernoFence = new InfernoFence();
addObject(infernoFence, 50*i+175+100, 225);
}
Firebat firebat2 = new Firebat(8, 3);
addObject(firebat2, 511, 625);
Firebat firebat3 = new Firebat(8, 3);
addObject(firebat3, 588, 534);
Firebat firebat4 = new Firebat(8, 3);
addObject(firebat4, 629, 489);
Firebat firebat5 = new Firebat(8, 3);
addObject(firebat5, 203, 608);
Firebat firebat6 = new Firebat(8, 3);
addObject(firebat6, 484, 388);
Firebat firebat7 = new Firebat(8, 3);
addObject(firebat7, 320, 350);
InfernoFence infernoFence = new InfernoFence();
addObject(infernoFence, 133, 417);
InfernoFence infernoFence3 = new InfernoFence();
addObject(infernoFence3, 164, 571);
InfernoFence infernoFence5 = new InfernoFence();
addObject(infernoFence5, 429, 360);
InfernoFence infernoFence6 = new InfernoFence();
addObject(infernoFence6, 325, 669);
InfernoFence infernoFence7 = new InfernoFence();
addObject(infernoFence7, 452, 571);
InfernoFence infernoFence8 = new InfernoFence();
addObject(healthCounter, 866, 120);
healthCounter.setValue(ninja.getNINJAHP());
addObject(shurikenCounter, 866, 201);
shurikenCounter.setValue(ninja.getSHURIKENNUMBER());
addObject(powerCounter, 866, 161);
powerCounter.setValue(ninja.getPOWERBAR());
addObject(levelCounter, 950, 15);
levelCounter.setValue(31);
addObject(ninja, 75, 75);
ninja.setLocation(100, 75);
HealthGlobe healthglobe = new HealthGlobe();
addObject(healthglobe, 668, 57);
healthglobe.setLocation(674, 54);
HealthGlobe healthglobe2 = new HealthGlobe();
addObject(healthglobe2, 638, 138);
healthglobe2.setLocation(672, 110);
instaPower instapower = new instaPower();
addObject(instapower, 87, 624);
instapower.setLocation(76, 623);
addShuriken addshuriken = new addShuriken();
addObject(addshuriken, 76, 181);
addShuriken addshuriken2 = new addShuriken();
addObject(addshuriken2, 466, 123);
addshuriken2.setLocation(675, 277);
instaPower instapower2 = new instaPower();
addObject(instapower2, 429, 627);
instapower2.setLocation(431, 625);
makeAllIcons();
meleeMinions = getObjects(MeleeMinion.class);
for(int i = 0; i<meleeMinions.size(); i++)
{
TempText8 text = new TempText8(meleeMinions.get(i));
addObject(text, meleeMinions.get(i).getX(), meleeMinions.get(i).getY()-20);
}
}
public void act()//sean
{
if(!played)
{
burningSteppes.playLoop();
played = !played;
}
//makeSmokeFireball();
counterDelay++;
if (Greenfoot.isKeyDown("h")&&delay>10)
{
clickSound.play();
Menu menu = new Menu(getThisWorld());
Greenfoot.setWorld(menu);
delay = 0;
}
if(getObjects(Ninja.class).size() != 0 && counterDelay >= 10)
{
healthCounter.setValue(ninja.getNINJAHP());
shurikenCounter.setValue(ninja.getSHURIKENNUMBER());
powerCounter.setValue(ninja.getPOWERBAR());
checkDoor();
counterDelay-= 10;
/**/ // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/
/**/ // TEMPORAY FUNCTIONS FOR HAYDEN TO CHANGE LEVELS TO MAKE THEM /**/
}
delay++;
fireballDelay++;
}
public void makeAllIcons()//sean
{
SwordIcon swordicon = new SwordIcon();
addObject(swordicon, 889, 360);
ShurikenIcon shurikenicon = new ShurikenIcon();
addObject(shurikenicon, 838, 360);
StealthIcon stealthicon = new StealthIcon();
addObject(stealthicon, 871, 308);
DashIcon dashicon = new DashIcon();
addObject(dashicon, 819, 308);
//DoubleDamageIcon doubledamageicon = new DoubleDamageIcon();
//addObject(doubledamageicon, 871, 308);
}
/*
public void makeSmokeFireball()
{
if (delay > 100)
{
int randomNumber = Greenfoot.getRandomNumber(1000);
if (randomNumber < 50)
{
SmokeFireball smokeFireball = new SmokeFireball();
addObject(smokeFireball, 500, 475);
delay = 0;
}
if (randomNumber >= 50 && randomNumber < 100)
{
SmokeFireball smokeFireball = new SmokeFireball();
addObject(smokeFireball, 95, 661);
delay = 0;
}
if (randomNumber >= 100 && randomNumber < 150)
{
SmokeFireball smokeFireball = new SmokeFireball();
addObject(smokeFireball, 160, 493);
delay = 0;
}
if (randomNumber >= 150 && randomNumber < 200)
{
SmokeFireball smokeFireball = new SmokeFireball();
addObject(smokeFireball, 637, 423);
delay = 0;
}
if (randomNumber >= 200 && randomNumber < 250)
{
SmokeFireball smokeFireball = new SmokeFireball();
addObject(smokeFireball, 422, 285);
delay = 0;
}
}
}
*/
public void checkDoor()//sean
{
if(ninja.checkInfernoDoor()==true)
{
burningSteppes.stop();
Greenfoot.setWorld(new Inferno2(ninja));
}
}
public Ninja getNinja()//sean
{
return ninja;
}
public Trap getThisWorld()//sean
{
return this;
}
public void gameover(){//Hayden
ninja.setHP(ninja.getArmor());
burningSteppes.stop();
Greenfoot.setWorld(new Inferno1(ninja));
}
}