1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using Jypeli; |
---|
4 | using Jypeli.Assets; |
---|
5 | using Jypeli.Controls; |
---|
6 | using Jypeli.Effects; |
---|
7 | using Jypeli.Widgets; |
---|
8 | |
---|
9 | public class OK : PhysicsGame |
---|
10 | { |
---|
11 | GameObject command; //UI-ruutu, jossa pelikomennot |
---|
12 | GameObject feed; //UI-ruutu, johon tulee combat log |
---|
13 | GameObject tappio; //ruutu, joka ilmaantuu pelaajan hävitessä |
---|
14 | |
---|
15 | GameObject portrait; //ruutu, jossa pelihahmon HP ja kauniit kasvot |
---|
16 | GameObject portrait2; //ruutu, jossa pelihahmon HP ja kärsineet kasvot |
---|
17 | GameObject portrait3; //ruutu, jossa pelihahmon vähäinen HP ja erittäin kärsineet kasvot |
---|
18 | |
---|
19 | GameObject foe1; //ruutu, jossa pahis 1 |
---|
20 | GameObject foe2; //ruutu, jossa pahis 2 |
---|
21 | GameObject foe3; //ruutu, jossa pahis 3 |
---|
22 | |
---|
23 | double textheight = -220; |
---|
24 | double textwidth = -750; |
---|
25 | |
---|
26 | GameObject inventory; //ruutu, jossa kamasi näkyvät |
---|
27 | |
---|
28 | bool potionmeni = false; |
---|
29 | bool pommimeni = false; |
---|
30 | |
---|
31 | GameObject transition; //ruutu, jolla peli menee eteenpäin |
---|
32 | GameObject voitto; //ruutu, joka tulee kun voitat pelin |
---|
33 | |
---|
34 | int vihollisNro = 1; |
---|
35 | |
---|
36 | PhysicsObject Pointer; //jolla valitaan schaibaa |
---|
37 | Timer ajastin; |
---|
38 | |
---|
39 | bool pelaajatoiminut = false; //tarkistaa, että onko pelaaja käyttänyt vuoronsa, että hän ei pääse rikkomaan peliä |
---|
40 | |
---|
41 | IntMeter goopHP; //ekan vihollisen hp |
---|
42 | IntMeter skeleHP; //tokan vihollisen hp |
---|
43 | IntMeter snekHP; //kolmannen vihollisen HP |
---|
44 | IntMeter HP; //pelaajan hp |
---|
45 | |
---|
46 | int playerdamage = 10; //pelaajan tehot |
---|
47 | int enemy1damage = 5; //ekan vihollisen tehot |
---|
48 | int enemy2damage = 20; //tokan vihollisen tehot |
---|
49 | int enemy3damage = 24; //kolmannen vihollisen tehot |
---|
50 | |
---|
51 | Label foeHP; // eka vihu |
---|
52 | Label foe2HP; //toka vihu |
---|
53 | Label playerHP; |
---|
54 | Label feedtext; |
---|
55 | |
---|
56 | Vector nopeusYlos = new Vector(0, 100); |
---|
57 | Vector nopeusAlas = new Vector(0, -100); |
---|
58 | Vector nopeusVasen = new Vector(-200, 0); |
---|
59 | Vector nopeusOikea = new Vector(200, 0); |
---|
60 | |
---|
61 | public override void Begin() |
---|
62 | { |
---|
63 | LuoAlue(); |
---|
64 | luopelaaja(); |
---|
65 | LuoHP(); |
---|
66 | Kontrollit(); |
---|
67 | |
---|
68 | |
---|
69 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
70 | } |
---|
71 | |
---|
72 | void LuoAlue() |
---|
73 | { |
---|
74 | Level.Background.Color = Color.White; |
---|
75 | |
---|
76 | command = new GameObject(450.0, 300.0); |
---|
77 | command.Shape = Shape.Rectangle; |
---|
78 | command.Color = Color.Black; |
---|
79 | command.X = 370.00; |
---|
80 | command.Y = -330.00; |
---|
81 | command.Image = LoadImage("Kökkö"); |
---|
82 | Add(command, 1); |
---|
83 | |
---|
84 | feed = new GameObject(1000.00, 300.00); |
---|
85 | feed.Shape = Shape.Rectangle; |
---|
86 | feed.Color = Color.Black; |
---|
87 | feed.X = -400.00; |
---|
88 | feed.Y = -330.00; |
---|
89 | Add(feed); |
---|
90 | |
---|
91 | feedtext = new Label(); |
---|
92 | feedtext.X = textwidth; |
---|
93 | feedtext.Y = textheight; |
---|
94 | feedtext.TextColor = Color.White; |
---|
95 | feedtext.Color = Color.Transparent; |
---|
96 | Add(feedtext, 2); |
---|
97 | |
---|
98 | |
---|
99 | portrait = new GameObject(250.00, 300.00); |
---|
100 | portrait.Shape = Shape.Rectangle; |
---|
101 | portrait.Color = Color.Black; |
---|
102 | portrait.X = 750.00; |
---|
103 | portrait.Y = -330.00; |
---|
104 | portrait.Image = LoadImage("Portretti"); |
---|
105 | Add(portrait); |
---|
106 | |
---|
107 | portrait2 = new GameObject(250.00, 300.00); |
---|
108 | portrait2.Shape = Shape.Rectangle; |
---|
109 | portrait2.Color = Color.Black; |
---|
110 | portrait2.X = 750.00; |
---|
111 | portrait2.Y = -330.00; |
---|
112 | portrait2.Image = LoadImage("Portrettisaiturpiin"); |
---|
113 | |
---|
114 | portrait3 = new GameObject(250.00, 300.00); |
---|
115 | portrait3.Shape = Shape.Rectangle; |
---|
116 | portrait3.Color = Color.Black; |
---|
117 | portrait3.X = 750.00; |
---|
118 | portrait3.Y = -330.00; |
---|
119 | portrait3.Image = LoadImage("Portrettisaipahastiturpiin"); |
---|
120 | |
---|
121 | foe1 = new GameObject(1800.00, 700.00); |
---|
122 | foe1.Shape = Shape.Rectangle; |
---|
123 | foe1.Color = Color.Aqua; |
---|
124 | foe1.X = -10.00; |
---|
125 | foe1.Y = 200.00; |
---|
126 | foe1.Image = LoadImage("köntsä"); |
---|
127 | Add(foe1); |
---|
128 | } |
---|
129 | |
---|
130 | PhysicsObject luopelaaja() |
---|
131 | { |
---|
132 | |
---|
133 | Pointer = new PhysicsObject(5.0, 5.0); |
---|
134 | Pointer.Color = Color.White; |
---|
135 | Pointer.X = 190.00; |
---|
136 | Pointer.Y = -220.00; |
---|
137 | Add(Pointer, 2); |
---|
138 | Pointer.IgnoresExplosions = true; |
---|
139 | return Pointer; |
---|
140 | |
---|
141 | } |
---|
142 | |
---|
143 | void LuoHP() |
---|
144 | { |
---|
145 | goopHP = new IntMeter(20); |
---|
146 | |
---|
147 | foeHP = new Label(); |
---|
148 | |
---|
149 | foeHP.X = 150.00; |
---|
150 | foeHP.Y = Screen.Top - 40.00; |
---|
151 | foeHP.TextColor = Color.Red; |
---|
152 | foeHP.Color = Color.Transparent; |
---|
153 | |
---|
154 | foeHP.BindTo(goopHP); |
---|
155 | Add(foeHP, 2); |
---|
156 | |
---|
157 | HP = new IntMeter(65); |
---|
158 | HP.MaxValue = 65; |
---|
159 | |
---|
160 | Label playerHP = new Label(); |
---|
161 | |
---|
162 | playerHP.X = 660.00; |
---|
163 | playerHP.Y = -200.00; |
---|
164 | playerHP.TextColor = Color.LightGreen; |
---|
165 | playerHP.Color = Color.Transparent; |
---|
166 | |
---|
167 | playerHP.BindTo(HP); |
---|
168 | Add(playerHP, 2); |
---|
169 | |
---|
170 | skeleHP = new IntMeter(40); |
---|
171 | |
---|
172 | if (HP.Value < 35) Add(portrait2, 1); |
---|
173 | if (HP.Value < 11) Add(portrait3, 2); |
---|
174 | |
---|
175 | |
---|
176 | } |
---|
177 | void AsetaNopeus(PhysicsObject Pointer, Vector nopeus) |
---|
178 | { |
---|
179 | PlaySound("blip"); |
---|
180 | |
---|
181 | if (Pointer.Velocity.Magnitude > 0) return; |
---|
182 | |
---|
183 | Vector sijainti = Pointer.Position + nopeus; |
---|
184 | if (sijainti.Y > command.Top) return; |
---|
185 | else if (sijainti.Y < command.Bottom) return; |
---|
186 | |
---|
187 | Pointer.MoveTo(Pointer.Position + nopeus, 1000.00); |
---|
188 | |
---|
189 | } |
---|
190 | void Kontrollit() |
---|
191 | { |
---|
192 | Keyboard.Clear(); |
---|
193 | Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); |
---|
194 | //Keyboard.Listen(Key.Down, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); |
---|
195 | |
---|
196 | Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); |
---|
197 | //Keyboard.Listen(Key.Up, ButtonState.Released, AsetaNopeus, null, Pointer, Vector.Zero); |
---|
198 | |
---|
199 | |
---|
200 | Keyboard.Listen(Key.Z, ButtonState.Pressed, Valitse, null); |
---|
201 | |
---|
202 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
203 | |
---|
204 | } |
---|
205 | |
---|
206 | void Valitse() |
---|
207 | |
---|
208 | { |
---|
209 | |
---|
210 | if (pelaajatoiminut) return; |
---|
211 | pelaajatoiminut = true; |
---|
212 | if (Pointer.Y > command.Top - command.Height / 3) Attack(); |
---|
213 | else if (Pointer.Y < command.Bottom + command.Height / 3) Exit(); |
---|
214 | else Items(); |
---|
215 | } |
---|
216 | |
---|
217 | void Items() |
---|
218 | { |
---|
219 | |
---|
220 | pelaajatoiminut = false; |
---|
221 | inventory = new GameObject(450.0, 300.0); |
---|
222 | command.Shape = Shape.Rectangle; |
---|
223 | inventory.Color = Color.Black; |
---|
224 | inventory.X = 370.00; |
---|
225 | inventory.Y = -330.00; |
---|
226 | inventory.Image = LoadImage("Items"); |
---|
227 | Add(inventory, 1); |
---|
228 | |
---|
229 | Keyboard.Clear(); |
---|
230 | Keyboard.Listen(Key.Down, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusAlas); |
---|
231 | Keyboard.Listen(Key.Up, ButtonState.Pressed, AsetaNopeus, "liikkuu", Pointer, nopeusYlos); |
---|
232 | Keyboard.Listen(Key.Z, ButtonState.Pressed, Itemvalitse, null); |
---|
233 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
234 | } |
---|
235 | |
---|
236 | void Itemvalitse() |
---|
237 | { |
---|
238 | if (Pointer.Y > command.Top - command.Height / 3) Potion(); |
---|
239 | else if (Pointer.Y < command.Bottom + command.Height / 3) poistainventory(); |
---|
240 | else Bomb(); |
---|
241 | } |
---|
242 | |
---|
243 | void poistainventory() |
---|
244 | |
---|
245 | { |
---|
246 | Kontrollit(); |
---|
247 | inventory.Destroy(); |
---|
248 | } |
---|
249 | |
---|
250 | |
---|
251 | void Potion() |
---|
252 | { |
---|
253 | if (potionmeni) |
---|
254 | { |
---|
255 | PlaySound("eipysty"); |
---|
256 | return; |
---|
257 | } |
---|
258 | potionmeni = true; |
---|
259 | |
---|
260 | pelaajatoiminut = true; |
---|
261 | |
---|
262 | HP.Value = HP.MaxValue; |
---|
263 | |
---|
264 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
265 | feedtext.Text = "Potion recovers your HP. \n" + feedtext.Text; |
---|
266 | PlaySound("potion"); |
---|
267 | Kontrollit(); |
---|
268 | |
---|
269 | switch (vihollisNro) |
---|
270 | { |
---|
271 | case 1: |
---|
272 | if (goopHP > 0) Timer.SingleShot(1.0, Enemy1attack); |
---|
273 | else Transition(); |
---|
274 | break; |
---|
275 | |
---|
276 | case 2: |
---|
277 | if (skeleHP > 0) Timer.SingleShot(1.0, Enemy2attack); |
---|
278 | else Transition2(); |
---|
279 | break; |
---|
280 | |
---|
281 | case 3: |
---|
282 | if (snekHP > 0) Timer.SingleShot(1.0, Enemy3attack); |
---|
283 | else Voitit(); |
---|
284 | break; |
---|
285 | |
---|
286 | } |
---|
287 | |
---|
288 | poistainventory(); |
---|
289 | } |
---|
290 | |
---|
291 | void Bomb() |
---|
292 | { |
---|
293 | if (pommimeni) |
---|
294 | { |
---|
295 | PlaySound("eipysty"); |
---|
296 | return; |
---|
297 | } |
---|
298 | pommimeni = true; |
---|
299 | |
---|
300 | pelaajatoiminut = true; |
---|
301 | |
---|
302 | poistainventory(); |
---|
303 | pelaajatoiminut = true; |
---|
304 | |
---|
305 | Explosion rajahdys = new Explosion(500); |
---|
306 | rajahdys.Position = (foe1.Position); |
---|
307 | Add(rajahdys, 3); |
---|
308 | |
---|
309 | feedtext.Text = "The bomb explodes! \n" + feedtext.Text; |
---|
310 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
311 | |
---|
312 | Timer.SingleShot (3.0, Bomb2); |
---|
313 | |
---|
314 | } |
---|
315 | |
---|
316 | void Bomb2() |
---|
317 | { |
---|
318 | switch (vihollisNro) |
---|
319 | { |
---|
320 | case 1: |
---|
321 | goopHP.Value -= 20; |
---|
322 | Transition(); |
---|
323 | |
---|
324 | break; |
---|
325 | |
---|
326 | case 2: |
---|
327 | skeleHP.Value -= 40; |
---|
328 | Transition2(); |
---|
329 | |
---|
330 | break; |
---|
331 | |
---|
332 | case 3: |
---|
333 | snekHP.Value -= 100; |
---|
334 | Voitit(); |
---|
335 | |
---|
336 | break; |
---|
337 | }; |
---|
338 | |
---|
339 | } |
---|
340 | void Attack() //mitä tapahtuu jos painaa attackkia |
---|
341 | { |
---|
342 | if (goopHP.Value > 0) attackenemy1(); |
---|
343 | else if (skeleHP.Value > 0) attackenemy2(); |
---|
344 | else if (snekHP.Value > 0) attackenemy3(); |
---|
345 | } |
---|
346 | |
---|
347 | void attackenemy1() |
---|
348 | { |
---|
349 | goopHP.Value -= playerdamage; |
---|
350 | |
---|
351 | GameObject hit = new GameObject(100.00, 100.00); |
---|
352 | hit.Shape = Shape.Star; |
---|
353 | hit.Color = Color.OrangeRed; |
---|
354 | hit.X = 0.00; |
---|
355 | hit.Y = Screen.Top - 60.00; |
---|
356 | Add(hit, 3); |
---|
357 | hit.Image = LoadImage("hitanim2"); |
---|
358 | hit.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 50); |
---|
359 | |
---|
360 | PlaySound("hit"); |
---|
361 | |
---|
362 | GameObject hit2 = new GameObject(100.00, 100.00); |
---|
363 | hit2.Shape = Shape.Star; |
---|
364 | hit2.Color = Color.OrangeRed; |
---|
365 | hit2.X = 0.00; |
---|
366 | hit2.Y = Screen.Top - 60.00; |
---|
367 | hit2.Image = LoadImage("hitanim"); |
---|
368 | hit2.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 100); |
---|
369 | Add(hit2, 3); |
---|
370 | |
---|
371 | Attackfeed(playerdamage); |
---|
372 | } |
---|
373 | |
---|
374 | void attackenemy2() |
---|
375 | { |
---|
376 | skeleHP.Value -= playerdamage; |
---|
377 | |
---|
378 | GameObject hit = new GameObject(100.00, 100.00); |
---|
379 | hit.Shape = Shape.Star; |
---|
380 | hit.Color = Color.OrangeRed; |
---|
381 | hit.X = 0.00; |
---|
382 | hit.Y = Screen.Top - 60.00; |
---|
383 | Add(hit, 3); |
---|
384 | hit.Image = LoadImage("hitanim2"); |
---|
385 | hit.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 50); |
---|
386 | |
---|
387 | PlaySound("hit"); |
---|
388 | |
---|
389 | GameObject hit2 = new GameObject(100.00, 100.00); |
---|
390 | hit2.Shape = Shape.Star; |
---|
391 | hit2.Color = Color.OrangeRed; |
---|
392 | hit2.X = 0.00; |
---|
393 | hit2.Y = Screen.Top - 60.00; |
---|
394 | hit2.Image = LoadImage("hitanim"); |
---|
395 | hit2.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 100); |
---|
396 | Add(hit2, 3); |
---|
397 | |
---|
398 | Attackfeed(playerdamage); |
---|
399 | } |
---|
400 | |
---|
401 | void attackenemy3() |
---|
402 | { |
---|
403 | snekHP.Value -= playerdamage; |
---|
404 | |
---|
405 | GameObject hit = new GameObject(100.00, 100.00); |
---|
406 | hit.Shape = Shape.Star; |
---|
407 | hit.Color = Color.OrangeRed; |
---|
408 | hit.X = 0.00; |
---|
409 | hit.Y = Screen.Top - 60.00; |
---|
410 | Add(hit, 3); |
---|
411 | hit.Image = LoadImage("hitanim2"); |
---|
412 | hit.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 50); |
---|
413 | |
---|
414 | PlaySound("hit"); |
---|
415 | |
---|
416 | GameObject hit2 = new GameObject(100.00, 100.00); |
---|
417 | hit2.Shape = Shape.Star; |
---|
418 | hit2.Color = Color.OrangeRed; |
---|
419 | hit2.X = 0.00; |
---|
420 | hit2.Y = Screen.Top - 60.00; |
---|
421 | hit2.Image = LoadImage("hitanim"); |
---|
422 | hit2.MaximumLifetime = new TimeSpan(0, 0, 0, 0, 100); |
---|
423 | Add(hit2, 3); |
---|
424 | |
---|
425 | Attackfeed(playerdamage); |
---|
426 | } |
---|
427 | |
---|
428 | void Attackfeed(double damage) //combat login tiedot päivittyy |
---|
429 | { |
---|
430 | double y = feedtext.Y; |
---|
431 | |
---|
432 | feedtext.Text = "Delivered " + damage + " damage.\n" + feedtext.Text; |
---|
433 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
434 | |
---|
435 | switch (vihollisNro) |
---|
436 | { |
---|
437 | case 1: |
---|
438 | if (goopHP > 0) Timer.SingleShot(1.0, Enemy1attack); |
---|
439 | else Transition(); |
---|
440 | break; |
---|
441 | |
---|
442 | case 2: |
---|
443 | if (skeleHP > 0) Timer.SingleShot(1.0, Enemy2attack); |
---|
444 | else Transition2(); |
---|
445 | break; |
---|
446 | |
---|
447 | case 3: |
---|
448 | if (snekHP > 0) Timer.SingleShot(1.0, Enemy3attack); |
---|
449 | else Voitit(); |
---|
450 | break; |
---|
451 | } |
---|
452 | |
---|
453 | |
---|
454 | |
---|
455 | |
---|
456 | |
---|
457 | |
---|
458 | } |
---|
459 | |
---|
460 | void Enemy1attack() //ekan vihollisen AI |
---|
461 | |
---|
462 | { |
---|
463 | PlaySound("playertakesdamage"); |
---|
464 | HP.Value -= enemy1damage; |
---|
465 | |
---|
466 | double y = feedtext.Y; |
---|
467 | double x = feedtext.X; |
---|
468 | |
---|
469 | feedtext.Text = "Received " + enemy1damage + " damage.\n" + feedtext.Text; |
---|
470 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
471 | feedtext.X = textwidth;; |
---|
472 | |
---|
473 | pelaajatoiminut = false; |
---|
474 | |
---|
475 | if (HP == 0) Lose(); |
---|
476 | } |
---|
477 | |
---|
478 | void Enemy2attack() //tokan vihollisen AI |
---|
479 | { |
---|
480 | PlaySound("playertakesdamage"); |
---|
481 | HP.Value -= enemy2damage; |
---|
482 | |
---|
483 | double y = feedtext.Y; |
---|
484 | double x = feedtext.X; |
---|
485 | |
---|
486 | feedtext.Text = "Received " + enemy2damage + " damage.\n" + feedtext.Text; |
---|
487 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
488 | feedtext.X = textwidth; ; |
---|
489 | |
---|
490 | pelaajatoiminut = false; |
---|
491 | |
---|
492 | if (HP == 0) Lose(); |
---|
493 | } |
---|
494 | |
---|
495 | void Enemy3attack() //kolmannen vihollisen ai |
---|
496 | { |
---|
497 | PlaySound("playertakesdamage"); |
---|
498 | HP.Value -= enemy3damage; |
---|
499 | |
---|
500 | double y = feedtext.Y; |
---|
501 | double x = feedtext.X; |
---|
502 | |
---|
503 | feedtext.Text = "Received " + enemy3damage + " damage.\n" + feedtext.Text; |
---|
504 | feedtext.Y = textheight - feedtext.Height / 2; |
---|
505 | feedtext.X = textwidth; ; |
---|
506 | |
---|
507 | pelaajatoiminut = false; |
---|
508 | |
---|
509 | if (HP == 0) Lose(); |
---|
510 | } |
---|
511 | void Transition() //pelin siirtyminen eteenpäin, kun pahis voitettu |
---|
512 | { |
---|
513 | foeHP.Destroy(); |
---|
514 | vihollisNro++; |
---|
515 | transition = new GameObject(1800.00, 700.00); |
---|
516 | transition.Shape = Shape.Rectangle; |
---|
517 | transition.Color = Color.Aqua; |
---|
518 | transition.X = -10.00; |
---|
519 | transition.Y = 200.00; |
---|
520 | transition.Image = LoadImage("transiitio"); |
---|
521 | Add(transition); |
---|
522 | |
---|
523 | Timer.SingleShot(1.5, Lisaapahis2); |
---|
524 | } |
---|
525 | |
---|
526 | void Transition2() //pelin siirtyminen eteenpäin, kun toinen pahis on voitettu |
---|
527 | { |
---|
528 | foeHP.Destroy(); |
---|
529 | vihollisNro++; |
---|
530 | transition = new GameObject(1800.00, 700.00); |
---|
531 | transition.Shape = Shape.Rectangle; |
---|
532 | transition.Color = Color.Aqua; |
---|
533 | transition.X = -10.00; |
---|
534 | transition.Y = 200.00; |
---|
535 | transition.Image = LoadImage("transiitio"); |
---|
536 | Add(transition, 1); |
---|
537 | |
---|
538 | Timer.SingleShot(1.5, Lisaapahis3); |
---|
539 | } |
---|
540 | |
---|
541 | void Lisaapahis2() |
---|
542 | { |
---|
543 | foe2 = new GameObject(1800.00, 700.00); |
---|
544 | foe2.Shape = Shape.Rectangle; |
---|
545 | foe2.Color = Color.Aqua; |
---|
546 | foe2.X = -10.00; |
---|
547 | foe2.Y = 200.00; |
---|
548 | foe2.Image = LoadImage("luumies"); |
---|
549 | Add(foe2); |
---|
550 | |
---|
551 | pelaajatoiminut = false; |
---|
552 | |
---|
553 | skeleHP = new IntMeter(40); |
---|
554 | |
---|
555 | foeHP = new Label(); |
---|
556 | |
---|
557 | foeHP.X = 150.00; |
---|
558 | foeHP.Y = Screen.Top - 40.00; |
---|
559 | foeHP.TextColor = Color.Red; |
---|
560 | foeHP.Color = Color.Transparent; |
---|
561 | Add(foeHP); |
---|
562 | |
---|
563 | foeHP.BindTo(skeleHP); |
---|
564 | Add(foeHP, 3); |
---|
565 | |
---|
566 | } |
---|
567 | |
---|
568 | void Lisaapahis3() |
---|
569 | |
---|
570 | { |
---|
571 | foe3 = new GameObject(1800.00, 700.00); |
---|
572 | foe3.Shape = Shape.Rectangle; |
---|
573 | foe3.Color = Color.Aqua; |
---|
574 | foe3.X = -10.00; |
---|
575 | foe3.Y = 200.00; |
---|
576 | foe3.Image = LoadImage("snek"); |
---|
577 | Add(foe3, 2); |
---|
578 | |
---|
579 | pelaajatoiminut = false; |
---|
580 | |
---|
581 | snekHP = new IntMeter(100); |
---|
582 | |
---|
583 | foeHP = new Label(); |
---|
584 | |
---|
585 | foeHP.X = 150.00; |
---|
586 | foeHP.Y = Screen.Top - 40.00; |
---|
587 | foeHP.TextColor = Color.Blue; |
---|
588 | foeHP.Color = Color.Transparent; |
---|
589 | Add(foeHP); |
---|
590 | |
---|
591 | foeHP.BindTo(snekHP); |
---|
592 | Add(foeHP, 2); |
---|
593 | } |
---|
594 | |
---|
595 | void Voitit() //kun pelaaja voittaa kaikki pahikset |
---|
596 | { |
---|
597 | pelaajatoiminut = true; |
---|
598 | foeHP.Destroy(); |
---|
599 | voitto = new GameObject(1800.00, 700.00); |
---|
600 | voitto.Shape = Shape.Rectangle; |
---|
601 | voitto.Color = Color.Aqua; |
---|
602 | voitto.X = -10.00; |
---|
603 | voitto.Y = 200.00; |
---|
604 | voitto.Image = LoadImage("voitto"); |
---|
605 | Add(voitto, 3); |
---|
606 | |
---|
607 | Timer.SingleShot(10, Exit); |
---|
608 | } |
---|
609 | |
---|
610 | void Lose() //pelaajan häviö |
---|
611 | { |
---|
612 | pelaajatoiminut = true; |
---|
613 | foeHP.Destroy(); |
---|
614 | |
---|
615 | tappio = new GameObject(Screen.Width, Screen.Height); |
---|
616 | tappio.Shape = Shape.Rectangle; |
---|
617 | tappio.Color = Color.Black; |
---|
618 | tappio.Image = LoadImage("häviö"); |
---|
619 | Add(tappio, 3); |
---|
620 | |
---|
621 | } |
---|
622 | } |
---|
623 | |
---|