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 | |
---|
10 | enum GoblinAttackDirection |
---|
11 | { |
---|
12 | aUP, |
---|
13 | aDown, |
---|
14 | aRight, |
---|
15 | aLeft, |
---|
16 | nOne |
---|
17 | |
---|
18 | |
---|
19 | } |
---|
20 | enum WraithDirection |
---|
21 | { |
---|
22 | Up, |
---|
23 | Down, |
---|
24 | Right, |
---|
25 | Left, |
---|
26 | None |
---|
27 | } |
---|
28 | enum WraithAttackDirection |
---|
29 | { |
---|
30 | Up, |
---|
31 | Down, |
---|
32 | Right, |
---|
33 | Left, |
---|
34 | None |
---|
35 | } |
---|
36 | enum GoblinDirection |
---|
37 | { |
---|
38 | Up, |
---|
39 | Down, |
---|
40 | Right, |
---|
41 | Left, |
---|
42 | None |
---|
43 | } |
---|
44 | |
---|
45 | class Skeletor : PhysicsObject |
---|
46 | { |
---|
47 | |
---|
48 | private IntMeter HelttiLaskuri = new IntMeter(20, 0, 20); |
---|
49 | public IntMeter helttiLaskuri { get { return HelttiLaskuri; } } |
---|
50 | Windcaller peli; |
---|
51 | public Skeletor(Windcaller peli, double leveys, double korkeus) |
---|
52 | : base(leveys, korkeus) |
---|
53 | { |
---|
54 | this.peli = peli; |
---|
55 | } |
---|
56 | |
---|
57 | } |
---|
58 | class Goblin : PhysicsObject |
---|
59 | { |
---|
60 | |
---|
61 | |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | //public int nopeus { get; set; } |
---|
66 | //public GameObject kuva { get; set; } |
---|
67 | public GameObject varjo { get; set; } |
---|
68 | public FollowerBrain goboaivot; |
---|
69 | // public RandomMoverBrain autismi; |
---|
70 | //public Vector TargetAutismi; |
---|
71 | private Vector movementDirection = Vector.Zero; |
---|
72 | private Vector AttackSuunta; |
---|
73 | private Vector koko; |
---|
74 | |
---|
75 | private IntMeter HelttiLaskuri = new IntMeter(2, 0, 2); |
---|
76 | public IntMeter helttiLaskuri { get { return HelttiLaskuri; } } |
---|
77 | Windcaller peli; |
---|
78 | |
---|
79 | public Goblin(Windcaller peli, double leveys, double korkeus, int elamia) |
---|
80 | : base(leveys, korkeus) |
---|
81 | { |
---|
82 | this.peli = peli; |
---|
83 | // HelttiLaskuri.LowerLimit += delegate { this.Destroy(); }; |
---|
84 | |
---|
85 | goboaivot = new FollowerBrain(Windcaller.player1); |
---|
86 | |
---|
87 | LinearDamping = 0.7; |
---|
88 | movementDirection = RandomGen.NextDirection().GetVector(); |
---|
89 | |
---|
90 | Jypeli.Timer ajastin = new Jypeli.Timer(); |
---|
91 | ajastin.Interval = 3; |
---|
92 | ajastin.Timeout += () => |
---|
93 | { |
---|
94 | movementDirection = RandomGen.NextDirection().GetVector(); |
---|
95 | }; |
---|
96 | |
---|
97 | ajastin.Start(); |
---|
98 | } |
---|
99 | |
---|
100 | private double Abs(double d) |
---|
101 | { |
---|
102 | return (d < 0 ? -d : d); |
---|
103 | } |
---|
104 | private GoblinDirection PreviousDirection = GoblinDirection.None; |
---|
105 | |
---|
106 | private GoblinAttackDirection AikaisempiSuunta = GoblinAttackDirection.nOne; |
---|
107 | private bool IsAttacking = false; |
---|
108 | |
---|
109 | public override void Update(Time time) |
---|
110 | { |
---|
111 | base.Update(time); |
---|
112 | |
---|
113 | if (IsAttacking) |
---|
114 | return; |
---|
115 | double Dx = Windcaller.player1.Position.X - X; |
---|
116 | double Dy = Windcaller.player1.Position.Y - Y; |
---|
117 | |
---|
118 | double distance = Windcaller.GetDistance(Windcaller.player1.Position, Position); |
---|
119 | |
---|
120 | if (distance > 450) |
---|
121 | { |
---|
122 | Push(movementDirection * 2500); |
---|
123 | Brain = null; |
---|
124 | } |
---|
125 | else if (distance > 70) |
---|
126 | { |
---|
127 | |
---|
128 | Brain = goboaivot; |
---|
129 | |
---|
130 | } |
---|
131 | else |
---|
132 | { |
---|
133 | Brain = null; |
---|
134 | GoblinAttackDirection suunta = GoblinAttackDirection.nOne; |
---|
135 | IsAttacking = true; |
---|
136 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
137 | { |
---|
138 | |
---|
139 | |
---|
140 | |
---|
141 | }); |
---|
142 | if (Abs(Dx) > Abs(Dy)) |
---|
143 | { |
---|
144 | |
---|
145 | if (Dx < 0) |
---|
146 | { |
---|
147 | //Attack Vasemmalle |
---|
148 | suunta = GoblinAttackDirection.aLeft; |
---|
149 | Animation = Windcaller.GoblinAttack_L; |
---|
150 | koko = new Vector(50, 20); |
---|
151 | AttackSuunta = new Vector(-40, -20); |
---|
152 | |
---|
153 | } |
---|
154 | else |
---|
155 | { |
---|
156 | //Attack Oikealle |
---|
157 | suunta = GoblinAttackDirection.aRight; |
---|
158 | Animation = Windcaller.GoblinAttack_R; |
---|
159 | koko = new Vector(50, 20); |
---|
160 | AttackSuunta = new Vector(30, -20); |
---|
161 | |
---|
162 | } |
---|
163 | } |
---|
164 | else |
---|
165 | { |
---|
166 | if (Dy < 0) |
---|
167 | { |
---|
168 | //Attack Alaspäin |
---|
169 | suunta = GoblinAttackDirection.aDown; |
---|
170 | Animation = Windcaller.GoblinAttack_D; |
---|
171 | koko = new Vector(20, 50); |
---|
172 | AttackSuunta = new Vector(-20, -30); |
---|
173 | } |
---|
174 | else |
---|
175 | { |
---|
176 | //Attack ylöspäin |
---|
177 | suunta = GoblinAttackDirection.aUP; |
---|
178 | Animation = Windcaller.GoblinAttack_U; |
---|
179 | koko = new Vector(20, 50); |
---|
180 | AttackSuunta = new Vector(30, 20); |
---|
181 | } |
---|
182 | |
---|
183 | |
---|
184 | } |
---|
185 | |
---|
186 | if (suunta != AikaisempiSuunta) |
---|
187 | Animation.Start(); |
---|
188 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
189 | { |
---|
190 | |
---|
191 | |
---|
192 | PhysicsObject HitBox = new PhysicsObject(koko.X, koko.Y); |
---|
193 | HitBox.Position = Position + AttackSuunta; |
---|
194 | peli.Add(HitBox); |
---|
195 | HitBox.LifetimeLeft = TimeSpan.FromSeconds(0.1); |
---|
196 | HitBox.IgnoresCollisionResponse = true; |
---|
197 | //HitBox.Color = Color.Red; |
---|
198 | HitBox.Tag = "GoblinAttack"; |
---|
199 | HitBox.IsVisible = false; |
---|
200 | }); |
---|
201 | AikaisempiSuunta = suunta; |
---|
202 | |
---|
203 | Animation.Played += () => |
---|
204 | { |
---|
205 | IsAttacking = false; |
---|
206 | }; |
---|
207 | |
---|
208 | return; |
---|
209 | } |
---|
210 | |
---|
211 | GoblinDirection direction; |
---|
212 | |
---|
213 | if (Abs(Dx) > Abs(Dy)) |
---|
214 | { |
---|
215 | if (Dx < 0) |
---|
216 | { |
---|
217 | //Vasemmalle |
---|
218 | Animation = Windcaller.GLeft_anim; |
---|
219 | direction = GoblinDirection.Left; |
---|
220 | } |
---|
221 | else |
---|
222 | { |
---|
223 | //Oikealle |
---|
224 | Animation = Windcaller.GRight_anim; |
---|
225 | direction = GoblinDirection.Right; |
---|
226 | } |
---|
227 | } |
---|
228 | else |
---|
229 | { |
---|
230 | if (Dy < 0) |
---|
231 | { |
---|
232 | //Alaspäin |
---|
233 | Animation = Windcaller.GDown_anim; |
---|
234 | direction = GoblinDirection.Down; |
---|
235 | } |
---|
236 | else |
---|
237 | { |
---|
238 | //Ylöspäin |
---|
239 | Animation = Windcaller.GUp_anim; |
---|
240 | direction = GoblinDirection.Up; |
---|
241 | } |
---|
242 | } |
---|
243 | |
---|
244 | if (direction != PreviousDirection) |
---|
245 | Animation.Start(); |
---|
246 | |
---|
247 | PreviousDirection = direction; |
---|
248 | |
---|
249 | |
---|
250 | |
---|
251 | |
---|
252 | |
---|
253 | } |
---|
254 | |
---|
255 | } |
---|
256 | class Wraith : PhysicsObject |
---|
257 | { |
---|
258 | |
---|
259 | |
---|
260 | |
---|
261 | |
---|
262 | |
---|
263 | //public int nopeus { get; set; } |
---|
264 | //public GameObject kuva { get; set; } |
---|
265 | public GameObject varjo { get; set; } |
---|
266 | public FollowerBrain wraithaivot; |
---|
267 | //public Vector TargetAutismi; |
---|
268 | private Vector movementDirection = Vector.Zero; |
---|
269 | private Vector AttackSuunta; |
---|
270 | private Vector koko; |
---|
271 | |
---|
272 | private IntMeter HelttiLaskuri = new IntMeter(3, 0, 3); |
---|
273 | public IntMeter helttiWraithLaskuri { get { return HelttiLaskuri; } } |
---|
274 | Windcaller peli; |
---|
275 | |
---|
276 | double wanderDistance; |
---|
277 | |
---|
278 | public Wraith(Windcaller peli, double leveys, double korkeus, int elamia, double wanderDistance = 500) |
---|
279 | : base(leveys, korkeus) |
---|
280 | { |
---|
281 | this.peli = peli; |
---|
282 | this.wanderDistance = wanderDistance; |
---|
283 | // HelttiLaskuri.LowerLimit += delegate { this.Destroy(); }; |
---|
284 | |
---|
285 | wraithaivot = new FollowerBrain(Windcaller.player1); |
---|
286 | |
---|
287 | LinearDamping = 0.7; |
---|
288 | movementDirection = RandomGen.NextDirection().GetVector(); |
---|
289 | |
---|
290 | Jypeli.Timer ajastin = new Jypeli.Timer(); |
---|
291 | ajastin.Interval = 3; |
---|
292 | ajastin.Timeout += () => |
---|
293 | { |
---|
294 | movementDirection = RandomGen.NextDirection().GetVector(); |
---|
295 | }; |
---|
296 | |
---|
297 | ajastin.Start(); |
---|
298 | } |
---|
299 | |
---|
300 | private double Abs(double d) |
---|
301 | { |
---|
302 | return (d < 0 ? -d : d); |
---|
303 | } |
---|
304 | private WraithDirection PreviousDirection = WraithDirection.None; |
---|
305 | |
---|
306 | private WraithAttackDirection AikaisempiSuunta = WraithAttackDirection.None; |
---|
307 | private bool IsAttacking = false; |
---|
308 | |
---|
309 | public override void Update(Time time) |
---|
310 | { |
---|
311 | base.Update(time); |
---|
312 | |
---|
313 | if (IsAttacking) |
---|
314 | return; |
---|
315 | double Dx = Windcaller.player1.Position.X - X; |
---|
316 | double Dy = Windcaller.player1.Position.Y - Y; |
---|
317 | |
---|
318 | double distance = Windcaller.GetDistance(Windcaller.player1.Position, Position); |
---|
319 | |
---|
320 | if (distance > wanderDistance) |
---|
321 | { |
---|
322 | Push(movementDirection * 2500); |
---|
323 | Brain = null; |
---|
324 | } |
---|
325 | else if (distance > 90) |
---|
326 | { |
---|
327 | |
---|
328 | Brain = wraithaivot; |
---|
329 | |
---|
330 | } |
---|
331 | else |
---|
332 | { |
---|
333 | Brain = null; |
---|
334 | WraithAttackDirection suunta = WraithAttackDirection.None; |
---|
335 | IsAttacking = true; |
---|
336 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
337 | { |
---|
338 | |
---|
339 | |
---|
340 | |
---|
341 | }); |
---|
342 | if (Abs(Dx) > Abs(Dy)) |
---|
343 | { |
---|
344 | |
---|
345 | if (Dx < 0) |
---|
346 | { |
---|
347 | //Attack Vasemmalle |
---|
348 | suunta = WraithAttackDirection.Left; |
---|
349 | Animation = Windcaller.Wraith_Attack_Left; |
---|
350 | koko = new Vector(40, 100); |
---|
351 | AttackSuunta = new Vector(-60, 0); |
---|
352 | |
---|
353 | } |
---|
354 | else |
---|
355 | { |
---|
356 | //Attack Oikealle |
---|
357 | suunta = WraithAttackDirection.Right; |
---|
358 | Animation = Windcaller.Wraith_Attack_Right; |
---|
359 | koko = new Vector(40, 100); |
---|
360 | AttackSuunta = new Vector(60, 0); |
---|
361 | |
---|
362 | } |
---|
363 | } |
---|
364 | else |
---|
365 | { |
---|
366 | if (Dy < 0) |
---|
367 | { |
---|
368 | //Attack Alaspäin |
---|
369 | suunta = WraithAttackDirection.Down; |
---|
370 | Animation = Windcaller.Wraith_Attack_Down; |
---|
371 | koko = new Vector(100, 40); |
---|
372 | AttackSuunta = new Vector(0, -60); |
---|
373 | } |
---|
374 | else |
---|
375 | { |
---|
376 | //Attack ylöspäin |
---|
377 | suunta = WraithAttackDirection.Up; |
---|
378 | Animation = Windcaller.Wraith_Attack_Up; |
---|
379 | koko = new Vector(100, 40); |
---|
380 | AttackSuunta = new Vector(0, 60); |
---|
381 | } |
---|
382 | |
---|
383 | |
---|
384 | } |
---|
385 | |
---|
386 | if (suunta != AikaisempiSuunta) |
---|
387 | Animation.Start(); |
---|
388 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
389 | { |
---|
390 | |
---|
391 | |
---|
392 | PhysicsObject HitBox = new PhysicsObject(koko.X, koko.Y); |
---|
393 | HitBox.Position = Position + AttackSuunta; |
---|
394 | peli.Add(HitBox); |
---|
395 | HitBox.LifetimeLeft = TimeSpan.FromSeconds(0.1); |
---|
396 | HitBox.IgnoresCollisionResponse = true; |
---|
397 | // HitBox.Color = Color.Red; |
---|
398 | HitBox.Tag = "GoblinAttack"; |
---|
399 | HitBox.IsVisible = false; |
---|
400 | }); |
---|
401 | AikaisempiSuunta = suunta; |
---|
402 | |
---|
403 | Animation.Played += () => |
---|
404 | { |
---|
405 | IsAttacking = false; |
---|
406 | }; |
---|
407 | |
---|
408 | return; |
---|
409 | } |
---|
410 | |
---|
411 | WraithDirection direction; |
---|
412 | |
---|
413 | if (Abs(Dx) > Abs(Dy)) |
---|
414 | { |
---|
415 | if (Dx < 0) |
---|
416 | { |
---|
417 | //Vasemmalle |
---|
418 | Animation = Windcaller.Wraith_Right; |
---|
419 | direction = WraithDirection.Left; |
---|
420 | } |
---|
421 | else |
---|
422 | { |
---|
423 | //Oikealle |
---|
424 | Animation = Windcaller.Wraith_Left; |
---|
425 | direction = WraithDirection.Right; |
---|
426 | } |
---|
427 | } |
---|
428 | else |
---|
429 | { |
---|
430 | if (Dy < 0) |
---|
431 | { |
---|
432 | //Alaspäin |
---|
433 | Animation = Windcaller.Wraith_Down; |
---|
434 | direction = WraithDirection.Down; |
---|
435 | } |
---|
436 | else |
---|
437 | { |
---|
438 | //Ylöspäin |
---|
439 | Animation = Windcaller.Wraith_Up; |
---|
440 | direction = WraithDirection.Up; |
---|
441 | } |
---|
442 | } |
---|
443 | |
---|
444 | if (direction != PreviousDirection) |
---|
445 | Animation.Start(); |
---|
446 | |
---|
447 | PreviousDirection = direction; |
---|
448 | |
---|
449 | |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | } |
---|
454 | |
---|
455 | } |
---|
456 | public class Pelaaja1 : PhysicsObject |
---|
457 | { |
---|
458 | |
---|
459 | |
---|
460 | |
---|
461 | Windcaller peli; |
---|
462 | public int nopeus { get; set; } |
---|
463 | public GameObject kuva { get; set; } |
---|
464 | public GameObject varjo { get; set; } |
---|
465 | private IntMeter HelttiLaskuri = new IntMeter(10, 0, 5); |
---|
466 | public IntMeter PlayerHealth { get { return HelttiLaskuri; } } |
---|
467 | public Pelaaja1(double leveys, double korkeus, int elamia) |
---|
468 | : base(leveys, korkeus) |
---|
469 | { |
---|
470 | |
---|
471 | |
---|
472 | //this.peli = peli; |
---|
473 | |
---|
474 | } |
---|
475 | } |
---|
476 | public class Windcaller : PhysicsGame |
---|
477 | { |
---|
478 | public static Pelaaja1 player1; |
---|
479 | //List<Talot> mediumtalot; |
---|
480 | Vector PlayrStartPoint = new Vector(-350, -400); |
---|
481 | |
---|
482 | |
---|
483 | Image IdleDown = LoadImage("Player/Standing and one shadow/image_stand down_0"); |
---|
484 | Image IdleUp = LoadImage("Player/Standing and one shadow/image_stand up_0"); |
---|
485 | Image IdleRight = LoadImage("Player/Standing and one shadow/image_stand right_0"); |
---|
486 | Image IdleLeft = LoadImage("Player/Standing and one shadow/image_stand left_0"); |
---|
487 | Image Reuna1 = LoadImage("World/Map 1/restricted area 1"); |
---|
488 | Image MediumTalo = LoadImage("Houses/Small House/Small house"); |
---|
489 | Image MediumTaloShadow = LoadImage("Houses/Small House/Small house shadow"); |
---|
490 | Image PLayerShadow = LoadImage("Player/Standing and one shadow/shadow_stand down_0"); |
---|
491 | |
---|
492 | //Goblin |
---|
493 | Image Fence = LoadImage("Stuff/Fences/fence"); |
---|
494 | Image GDown = LoadImage("Enemies/Goblin/Stand/Down/image_stand down_0"); |
---|
495 | Image GUp = LoadImage("Enemies/Goblin/stand/Up/image_stand up_0"); |
---|
496 | Image GRight = LoadImage("Enemies/Goblin/stand/Right/image_stand right_0"); |
---|
497 | Image GLeft = LoadImage("Enemies/Goblin/stand/Left/image_stand left_0"); |
---|
498 | // RandomMoverBrain autisti; |
---|
499 | |
---|
500 | Image Map = LoadImage("Effects/map"); |
---|
501 | Image LoadingScreen = LoadImage("Effects/LOADING SCREEN"); |
---|
502 | |
---|
503 | public static Animation Wraith_Up; |
---|
504 | public static Animation Wraith_Down; |
---|
505 | public static Animation Wraith_Right; |
---|
506 | public static Animation Wraith_Left; |
---|
507 | |
---|
508 | public static Animation Wraith_Attack_Up; |
---|
509 | public static Animation Wraith_Attack_Down; |
---|
510 | public static Animation Wraith_Attack_Right; |
---|
511 | public static Animation Wraith_Attack_Left; |
---|
512 | |
---|
513 | |
---|
514 | public static Animation GUp_anim; |
---|
515 | public static Animation GDown_anim; |
---|
516 | public static Animation GRight_anim; |
---|
517 | public static Animation GLeft_anim; |
---|
518 | |
---|
519 | public static Animation GoblinAttack_U; |
---|
520 | public static Animation GoblinAttack_D; |
---|
521 | public static Animation GoblinAttack_L; |
---|
522 | public static Animation GoblinAttack_R; |
---|
523 | |
---|
524 | public static int WraithCount = 0; |
---|
525 | |
---|
526 | Image MainMenuBackground = LoadImage("MainMenu/MAIN MENU BACKGROUND"); |
---|
527 | |
---|
528 | PhysicsObject Kamera; |
---|
529 | Image BaseLayer = LoadImage("World/Map 1/base"); |
---|
530 | Animation Up; |
---|
531 | Animation Down; |
---|
532 | Animation Right; |
---|
533 | Animation Left; |
---|
534 | Color Playershadow = new Color(Color.Black, 100); |
---|
535 | Image FullHealth = LoadImage("Effects/Healthy free space"); |
---|
536 | Image NoHealth = LoadImage("Effects/Unhealthy free space"); |
---|
537 | |
---|
538 | Animation SkullAttack; |
---|
539 | |
---|
540 | //WorldImages |
---|
541 | //Image VesiMaaBackgroundImage = LoadImage("World//Water Map/base"); |
---|
542 | Image startkuva = LoadImage("MainMenu/start up"); |
---|
543 | Image startkuva2 = LoadImage("MainMenu/start down"); |
---|
544 | |
---|
545 | |
---|
546 | Image SkeltorBackground = LoadImage("Bosses/Skeletor/cave_Boss room_0"); |
---|
547 | Image SkeletorRestricted = LoadImage("Bosses/Skeletor/skull män room boundaries"); |
---|
548 | Image SkeletorImage = LoadImage("Bosses/Skeletor/skull män head2"); |
---|
549 | Image SkeletorDmg = LoadImage("Bosses/Skeletor/skull män head dmg"); |
---|
550 | |
---|
551 | Image SmallHouseInside = LoadImage("Houses/Small House/base"); |
---|
552 | |
---|
553 | Vector Ruins = new Vector(1500, 1500); |
---|
554 | Vector Ruins2 = new Vector(1400, 1400); |
---|
555 | Vector RandomPosition2 = RandomGen.NextVector(1000, 1000, 1500, 1800); |
---|
556 | Image RestrictedArea2 = LoadImage("World/Map 1/restricted area 2 black"); |
---|
557 | Image RestrictedArea1 = LoadImage("World/Map 1/restricted_area_1"); |
---|
558 | |
---|
559 | Image PlayerFullHealth = LoadImage("Player/big helth_Animation 1_0"); |
---|
560 | Image PlayerEmptyHealth = LoadImage("Player/big helth_Animation 1_1"); |
---|
561 | |
---|
562 | Animation Logo; |
---|
563 | Animation KanaPoks; |
---|
564 | Animation GoblinDeath; |
---|
565 | Animation SpectreSpawn; |
---|
566 | Animation AUp; |
---|
567 | Animation ADown; |
---|
568 | Animation ARight; |
---|
569 | Animation ALeft; |
---|
570 | Vector TaloSpawnPoint = new Vector(200, 50); |
---|
571 | FollowerBrain seuraajanAivot; |
---|
572 | // FollowerBrain goboaivot; |
---|
573 | bool CanRun = true; |
---|
574 | |
---|
575 | string NykyineneMaa; |
---|
576 | |
---|
577 | |
---|
578 | |
---|
579 | public static double GetDistance(Vector A, Vector B) |
---|
580 | { |
---|
581 | return Math.Sqrt(Math.Pow(A.X - B.X, 2) + Math.Pow(A.Y - B.Y, 2)); |
---|
582 | } |
---|
583 | |
---|
584 | public override void Begin() |
---|
585 | { |
---|
586 | //Movement animations |
---|
587 | Left = LoadAnimation("Player/Anim/left"); |
---|
588 | Right = LoadAnimation("Player/Anim/right"); |
---|
589 | Up = LoadAnimation("Player/Anim/up"); |
---|
590 | Down = LoadAnimation("Player/Anim/down"); |
---|
591 | |
---|
592 | GoblinAttack_D = LoadAnimation("Enemies/Goblin/Attack/Down"); |
---|
593 | GoblinAttack_U = LoadAnimation("Enemies/Goblin/Attack/Up"); |
---|
594 | GoblinAttack_L = LoadAnimation("Enemies/Goblin/Attack/Left"); |
---|
595 | GoblinAttack_R = LoadAnimation("Enemies/Goblin/Attack/Right"); |
---|
596 | |
---|
597 | GoblinDeath = LoadAnimation("Enemies/Goblin/Death"); |
---|
598 | |
---|
599 | SpectreSpawn = LoadAnimation("Enemies/Wraith/SpawnAnimation"); |
---|
600 | Logo = LoadAnimation("MainMenu/Logo"); |
---|
601 | |
---|
602 | Wraith_Up = LoadAnimation("Enemies/Wraith/walk and stand/up"); |
---|
603 | Wraith_Down = LoadAnimation("Enemies/Wraith/walk and stand/down"); |
---|
604 | Wraith_Right = LoadAnimation("Enemies/Wraith/walk and stand/left"); |
---|
605 | Wraith_Left = LoadAnimation("Enemies/Wraith/walk and stand/right"); |
---|
606 | Wraith_Attack_Up = LoadAnimation("Enemies/Wraith/attack/up"); |
---|
607 | Wraith_Attack_Down = LoadAnimation("Enemies/Wraith/attack/down"); |
---|
608 | Wraith_Attack_Right = LoadAnimation("Enemies/Wraith/attack/right"); |
---|
609 | Wraith_Attack_Left = LoadAnimation("Enemies/Wraith/attack/left"); |
---|
610 | |
---|
611 | KanaPoks = LoadAnimation("Enemies/Kana/Boom"); |
---|
612 | |
---|
613 | SkullAttack = LoadAnimation("Bosses/Skeletor/Attack"); |
---|
614 | |
---|
615 | |
---|
616 | GDown_anim = LoadAnimation("Enemies/Goblin/Walk/Down"); |
---|
617 | GUp_anim = LoadAnimation("Enemies/Goblin/Walk/Up"); |
---|
618 | GLeft_anim = LoadAnimation("Enemies/Goblin/Walk/Left"); |
---|
619 | GRight_anim = LoadAnimation("Enemies/Goblin/Walk/Right"); |
---|
620 | //Attack Animations |
---|
621 | AUp = LoadAnimation("Player/Anim/attack_up"); |
---|
622 | ADown = LoadAnimation("Player/Anim/attack_down"); |
---|
623 | ARight = LoadAnimation("Player/Anim/attack_right"); |
---|
624 | ALeft = LoadAnimation("Player/Anim/attack_left"); |
---|
625 | |
---|
626 | SetWindowSize(1200, 900); |
---|
627 | SmoothTextures = false; |
---|
628 | // TODO: Kirjoita ohjelmakoodisi tähän |
---|
629 | |
---|
630 | |
---|
631 | LataaMaa("AlkuValikko"); |
---|
632 | |
---|
633 | } |
---|
634 | |
---|
635 | //Load Rooms |
---|
636 | void LataaMaa(string nimi) |
---|
637 | { |
---|
638 | NykyineneMaa = nimi; |
---|
639 | Layers[3].RelativeTransition = new Vector(0, 0); |
---|
640 | Label loadingscreen = new Label(1200, 900); |
---|
641 | loadingscreen.Image = LoadingScreen; |
---|
642 | |
---|
643 | // |
---|
644 | |
---|
645 | Add(loadingscreen, 3); |
---|
646 | |
---|
647 | Timer.SingleShot(0.1, delegate |
---|
648 | { |
---|
649 | ClearAll(); |
---|
650 | |
---|
651 | if (nimi == "Starting") AloitusMaa(); |
---|
652 | if (nimi == "Skeletor") SkeletorBossRoom(); |
---|
653 | if(nimi == "AlkuValikko") AlkuValikko(); |
---|
654 | if (nimi == "42") Maa42(); |
---|
655 | if (nimi == "39") Maa39(); |
---|
656 | if (nimi == "35") Maa35(); |
---|
657 | if (nimi == "34") Maa34(); |
---|
658 | if (nimi == "38") Maa38(); |
---|
659 | if (nimi == "31") VesiMaa(); |
---|
660 | if (nimi == "30") Maa30(); |
---|
661 | if (nimi == "29") Maa29(); |
---|
662 | if (nimi == "28") Maa28(); |
---|
663 | if (nimi == "27") Maa27(); |
---|
664 | if (nimi == "26") Maa26(); |
---|
665 | if (nimi == "25") Maa25(); |
---|
666 | if (nimi == "23") Maa23(); |
---|
667 | if (nimi == "22") Maa22(); |
---|
668 | if (nimi == "21") Maa21(); |
---|
669 | if (nimi == "20") Maa20(); |
---|
670 | if (nimi == "19") Maa19(); |
---|
671 | if (nimi == "18") Maa18(); |
---|
672 | if (nimi == "17") Maa17(); |
---|
673 | if (nimi == "14") Maa14(); |
---|
674 | if (nimi == "13") Maa13(); |
---|
675 | if (nimi == "12") Maa12(); |
---|
676 | if (nimi == "11") Maa11(); |
---|
677 | if (nimi == "10") Maa10(); |
---|
678 | if (nimi == "09") Maa9(); |
---|
679 | if (nimi == "08") Maa8(); |
---|
680 | if (nimi == "06") Maa6(); |
---|
681 | if (nimi == "05") Maa5(); |
---|
682 | if (nimi == "04") Maa4(); |
---|
683 | if (nimi == "03") Maa3(); |
---|
684 | if (nimi == "02") Maa2(); |
---|
685 | if (nimi == "01") Maa1(); |
---|
686 | if (nimi == "House") House(); |
---|
687 | |
---|
688 | |
---|
689 | }); |
---|
690 | |
---|
691 | |
---|
692 | |
---|
693 | |
---|
694 | } |
---|
695 | |
---|
696 | //Rooms |
---|
697 | |
---|
698 | void LuoMaa(int numero, String tautakuva, String ground, String RestrictedArea, String Trees) |
---|
699 | { |
---|
700 | Level.Width = 2400; |
---|
701 | Level.Height = 2400; |
---|
702 | Level.Background.Image = LoadImage(tautakuva); |
---|
703 | Level.Background.Width = 2400; |
---|
704 | Level.Background.Height = 2400; |
---|
705 | |
---|
706 | if (RestrictedArea != "") |
---|
707 | { |
---|
708 | ColorTileMap ruudutt = ColorTileMap.FromLevelAsset(ground); |
---|
709 | ruudutt.SetTileMethod(Color.Black, LuoTaso); |
---|
710 | ruudutt.Optimize(Color.Black); |
---|
711 | ruudutt.Execute(); |
---|
712 | |
---|
713 | } |
---|
714 | if (RestrictedArea != "") |
---|
715 | { |
---|
716 | GameObject Restricted = new GameObject(2400, 2400); |
---|
717 | Restricted.Image = LoadImage(RestrictedArea); |
---|
718 | Add(Restricted, 1); |
---|
719 | } |
---|
720 | |
---|
721 | if (Trees != "") |
---|
722 | { |
---|
723 | GameObject Treees = new GameObject(2400, 2400); |
---|
724 | Treees.Image = LoadImage(Trees); |
---|
725 | Add(Treees, 2); |
---|
726 | } |
---|
727 | |
---|
728 | AddPlayer(PlayrStartPoint, 60, 60); |
---|
729 | Camero(); |
---|
730 | Camera.Follow(Kamera); |
---|
731 | Camera.StayInLevel = true; |
---|
732 | LisaaKartta(); |
---|
733 | Level.CreateBorders(); |
---|
734 | |
---|
735 | |
---|
736 | |
---|
737 | LevelTeleport(new Vector(0, Level.Top), Level.Width, 40, string.Format("{0:00}", numero - 8), () => new Vector(player1.X, Level.Bottom + 100)); |
---|
738 | LevelTeleport(new Vector(0, Level.Bottom), Level.Width, 40, string.Format("{0:00}", numero + 8), () => new Vector(player1.X, Level.Top - 100)); |
---|
739 | LevelTeleport(new Vector(Level.Left, 0), 40, Level.Height, string.Format("{0:00}", numero - 1), () => new Vector(Level.Right-100, player1.Y)); |
---|
740 | LevelTeleport(new Vector(Level.Right, 0), 40, Level.Height, string.Format("{0:00}", numero + 1), () => new Vector(Level.Left + 100, player1.Y)); |
---|
741 | |
---|
742 | |
---|
743 | } |
---|
744 | void AlkuValikko() |
---|
745 | { |
---|
746 | Level.Background.Image = MainMenuBackground; |
---|
747 | Level.Background.Width = 1200; |
---|
748 | Level.Background.Height = 900; |
---|
749 | GameObject logos = new GameObject(1000, 300); |
---|
750 | logos.Animation = Logo; |
---|
751 | |
---|
752 | logos.Position = new Vector(0, 250); |
---|
753 | Timer.SingleShot(1, delegate |
---|
754 | { |
---|
755 | |
---|
756 | |
---|
757 | |
---|
758 | // logos.Animation.StopOnLastFrame = true; |
---|
759 | logos.Animation.Start(); |
---|
760 | Add(logos); |
---|
761 | |
---|
762 | }); |
---|
763 | |
---|
764 | |
---|
765 | logos.Animation.Played += delegate |
---|
766 | { |
---|
767 | Image logostill = LoadImage("MainMenu/Windcaller logo_100"); |
---|
768 | logos.Animation = logostill; |
---|
769 | |
---|
770 | }; |
---|
771 | |
---|
772 | // logos.Size *= 10; |
---|
773 | |
---|
774 | |
---|
775 | |
---|
776 | |
---|
777 | PushButton aloitus = new PushButton(startkuva); |
---|
778 | |
---|
779 | aloitus.Size *= 10; |
---|
780 | IsMouseVisible = true; |
---|
781 | Add(aloitus); |
---|
782 | aloitus.Clicked += delegate |
---|
783 | { |
---|
784 | aloitus.Image = startkuva2; |
---|
785 | Timer.SingleShot(0.5, delegate |
---|
786 | { |
---|
787 | ClearAll(); |
---|
788 | LataaMaa("31"); |
---|
789 | IsMouseVisible = false; |
---|
790 | }); |
---|
791 | |
---|
792 | |
---|
793 | }; |
---|
794 | |
---|
795 | |
---|
796 | |
---|
797 | } |
---|
798 | void Maa42() |
---|
799 | { |
---|
800 | int numero = 42; |
---|
801 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
802 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
803 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
804 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
805 | LuoMaa(numero, a, b, c, ""); |
---|
806 | |
---|
807 | |
---|
808 | |
---|
809 | } |
---|
810 | void Maa39() |
---|
811 | |
---|
812 | { |
---|
813 | int numero = 39; |
---|
814 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
815 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
816 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
817 | LuoMaa(numero, a, b, c, ""); |
---|
818 | |
---|
819 | |
---|
820 | |
---|
821 | } |
---|
822 | void Maa38() |
---|
823 | { |
---|
824 | |
---|
825 | int numero = 38; |
---|
826 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
827 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
828 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
829 | LuoMaa(numero, a, b,c, ""); |
---|
830 | |
---|
831 | |
---|
832 | } |
---|
833 | void Maa35() |
---|
834 | { |
---|
835 | int numero = 35; |
---|
836 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
837 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
838 | //string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
839 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
840 | LuoMaa(numero, a, b, "", ""); |
---|
841 | |
---|
842 | |
---|
843 | |
---|
844 | } |
---|
845 | void Maa34() |
---|
846 | { |
---|
847 | int numero = 34; |
---|
848 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
849 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
850 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
851 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
852 | LuoMaa(numero, a, b, c, ""); |
---|
853 | |
---|
854 | |
---|
855 | |
---|
856 | } |
---|
857 | void VesiMaa() |
---|
858 | { |
---|
859 | |
---|
860 | |
---|
861 | |
---|
862 | int numero = 31; |
---|
863 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
864 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
865 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
866 | LuoMaa(numero, a, b ,c, ""); |
---|
867 | |
---|
868 | LisaaKivi(new Vector(-200, 1000), 170, 100); |
---|
869 | LisaaPieniKivi(new Vector(300, 700), 100, 50); |
---|
870 | LisaaIsoPylvas(new Vector(54, 950), 310, 280); |
---|
871 | LisaaPieniPylvas(new Vector(-100, 900), 250, 200); |
---|
872 | LisaaPieniPylvas(new Vector(-500, 600), 250, 200); |
---|
873 | LisaaIsoPylvas(new Vector(430, 370), 310, 280); |
---|
874 | LisaaKivi(new Vector(600, 500), 170, 100); |
---|
875 | LisaaTeltta1(new Vector(-500, -300)); |
---|
876 | LisaaTeltta2(new Vector(-170, -290)); |
---|
877 | AddPuu(new Vector(200,-300)); |
---|
878 | AddPuu(new Vector(300, -540)); |
---|
879 | AddPuu(new Vector(400, -300)); |
---|
880 | AddPuu(new Vector(500, -300)); |
---|
881 | AddPuuTrunk(new Vector(00, -400)); |
---|
882 | AddPuuTrunk(new Vector(100, -700)); |
---|
883 | Boat1(new Vector(-700, -100)); |
---|
884 | AddHenri(new Vector(100, -300)); |
---|
885 | WrathSpawner(); |
---|
886 | |
---|
887 | |
---|
888 | } |
---|
889 | void Maa30() |
---|
890 | { |
---|
891 | int numero = 30; |
---|
892 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
893 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
894 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
895 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
896 | LuoMaa(numero, a, b,c, d); |
---|
897 | |
---|
898 | Houset(new Vector(-500, 200), 370, 390); |
---|
899 | SignPost(new Vector(-100, 200)); |
---|
900 | LevelTeleport(new Vector(-500, 190), 370, 390, "House", () => new Vector(0, 0)); |
---|
901 | AddHenri(new Vector(700, -800)); |
---|
902 | AddPuu(new Vector(800, -700)); |
---|
903 | |
---|
904 | } |
---|
905 | void Maa29() |
---|
906 | { |
---|
907 | int numero = 29; |
---|
908 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
909 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
910 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
911 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
912 | LuoMaa(numero, a, b, c, d); |
---|
913 | |
---|
914 | |
---|
915 | |
---|
916 | } |
---|
917 | void Maa28() |
---|
918 | { |
---|
919 | int numero = 28; |
---|
920 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
921 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
922 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
923 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
924 | LuoMaa(numero, a, b, c, ""); |
---|
925 | |
---|
926 | |
---|
927 | |
---|
928 | } |
---|
929 | void Maa27() |
---|
930 | { |
---|
931 | int numero = 27; |
---|
932 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
933 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
934 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
935 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
936 | LuoMaa(numero, a, b, c, d); |
---|
937 | |
---|
938 | |
---|
939 | |
---|
940 | } |
---|
941 | void Maa26() |
---|
942 | { |
---|
943 | int numero = 26; |
---|
944 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
945 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
946 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
947 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
948 | LuoMaa(numero, a, b, c, d); |
---|
949 | |
---|
950 | |
---|
951 | |
---|
952 | } |
---|
953 | void Maa25() |
---|
954 | { |
---|
955 | int numero = 25; |
---|
956 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
957 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
958 | //string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
959 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
960 | LuoMaa(numero, a, b, "", ""); |
---|
961 | |
---|
962 | |
---|
963 | |
---|
964 | } |
---|
965 | void Maa23() |
---|
966 | { |
---|
967 | int numero = 23; |
---|
968 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
969 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
970 | // string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
971 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
972 | LuoMaa(numero, a, b, "", ""); |
---|
973 | |
---|
974 | |
---|
975 | |
---|
976 | } |
---|
977 | void Maa22() |
---|
978 | { |
---|
979 | int numero = 22; |
---|
980 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
981 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
982 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
983 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
984 | LuoMaa(numero, a, b, c, d); |
---|
985 | gobliin(new Vector(-900, -300)); |
---|
986 | |
---|
987 | |
---|
988 | |
---|
989 | } |
---|
990 | void Maa21() |
---|
991 | { |
---|
992 | int numero = 21; |
---|
993 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
994 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
995 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
996 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
997 | LuoMaa(numero, a, b, c, d); |
---|
998 | |
---|
999 | |
---|
1000 | |
---|
1001 | } |
---|
1002 | void Maa20() |
---|
1003 | { |
---|
1004 | int numero = 20; |
---|
1005 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1006 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1007 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1008 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1009 | LuoMaa(numero, a, b, c, ""); |
---|
1010 | |
---|
1011 | |
---|
1012 | |
---|
1013 | } |
---|
1014 | void Maa19() |
---|
1015 | { |
---|
1016 | int numero = 19; |
---|
1017 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1018 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1019 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1020 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1021 | LuoMaa(numero, a, b, c, d); |
---|
1022 | |
---|
1023 | |
---|
1024 | |
---|
1025 | } |
---|
1026 | void Maa18() |
---|
1027 | { |
---|
1028 | int numero = 18; |
---|
1029 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1030 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1031 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1032 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1033 | LuoMaa(numero, a, b, c, d); |
---|
1034 | |
---|
1035 | |
---|
1036 | |
---|
1037 | } |
---|
1038 | void Maa17() |
---|
1039 | { |
---|
1040 | int numero = 17; |
---|
1041 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1042 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1043 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1044 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1045 | LuoMaa(numero, a, b, c, d); |
---|
1046 | |
---|
1047 | |
---|
1048 | |
---|
1049 | } |
---|
1050 | void Maa14() |
---|
1051 | { |
---|
1052 | int numero = 14; |
---|
1053 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1054 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1055 | //string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1056 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1057 | LuoMaa(numero, a, b, "", ""); |
---|
1058 | |
---|
1059 | |
---|
1060 | |
---|
1061 | } |
---|
1062 | void Maa13() |
---|
1063 | { |
---|
1064 | int numero = 13; |
---|
1065 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1066 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1067 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1068 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1069 | LuoMaa(numero, a, b, c, ""); |
---|
1070 | |
---|
1071 | LevelTeleport(new Vector(-900, 260), 500, 100, "Skeletor", () => new Vector(0, -300)); |
---|
1072 | |
---|
1073 | |
---|
1074 | } |
---|
1075 | void Maa12() |
---|
1076 | { |
---|
1077 | int numero = 12; |
---|
1078 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1079 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1080 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1081 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1082 | LuoMaa(numero, a, b, c, ""); |
---|
1083 | |
---|
1084 | |
---|
1085 | |
---|
1086 | } |
---|
1087 | void Maa11() |
---|
1088 | { |
---|
1089 | int numero = 11; |
---|
1090 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1091 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1092 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1093 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1094 | LuoMaa(numero, a, b, c, d); |
---|
1095 | |
---|
1096 | |
---|
1097 | |
---|
1098 | } |
---|
1099 | void Maa10() |
---|
1100 | { |
---|
1101 | int numero = 10; |
---|
1102 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1103 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1104 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1105 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1106 | LuoMaa(numero, a, b, c, d); |
---|
1107 | |
---|
1108 | |
---|
1109 | |
---|
1110 | } |
---|
1111 | void Maa9() |
---|
1112 | { |
---|
1113 | int numero = 09; |
---|
1114 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1115 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1116 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1117 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1118 | LuoMaa(numero, a, b, c, d); |
---|
1119 | |
---|
1120 | |
---|
1121 | |
---|
1122 | } |
---|
1123 | void Maa8() |
---|
1124 | { |
---|
1125 | int numero = 08; |
---|
1126 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1127 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1128 | //string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1129 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1130 | LuoMaa(numero, a, b, "", ""); |
---|
1131 | |
---|
1132 | |
---|
1133 | |
---|
1134 | } |
---|
1135 | void Maa6() |
---|
1136 | { |
---|
1137 | int numero = 06; |
---|
1138 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1139 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1140 | // string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1141 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1142 | LuoMaa(numero, a, b, "", ""); |
---|
1143 | |
---|
1144 | |
---|
1145 | |
---|
1146 | } |
---|
1147 | void Maa5() |
---|
1148 | { |
---|
1149 | int numero = 05; |
---|
1150 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1151 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1152 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1153 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1154 | LuoMaa(numero, a, b, c, ""); |
---|
1155 | |
---|
1156 | |
---|
1157 | |
---|
1158 | } |
---|
1159 | void Maa4() |
---|
1160 | { |
---|
1161 | int numero = 04; |
---|
1162 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1163 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1164 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1165 | // string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1166 | LuoMaa(numero, a, b, c, ""); |
---|
1167 | |
---|
1168 | |
---|
1169 | |
---|
1170 | } |
---|
1171 | void Maa3() |
---|
1172 | { |
---|
1173 | int numero = 03; |
---|
1174 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1175 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1176 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1177 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1178 | LuoMaa(numero, a, b, c, d); |
---|
1179 | |
---|
1180 | |
---|
1181 | |
---|
1182 | } |
---|
1183 | void Maa2() |
---|
1184 | { |
---|
1185 | int numero = 02; |
---|
1186 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1187 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1188 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1189 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1190 | LuoMaa(numero, a, b, c, d); |
---|
1191 | |
---|
1192 | Boat1(new Vector (-1000,400)); |
---|
1193 | |
---|
1194 | } |
---|
1195 | void Maa1() |
---|
1196 | { |
---|
1197 | int numero = 1; |
---|
1198 | string a = string.Format("World/{0:00}/base_Animation 1_{0:00}", numero); |
---|
1199 | string b = string.Format("World/{0:00}/black_Animation 1_{0:00}", numero); |
---|
1200 | string c = string.Format("World/{0:00}/Restricted area_Animation 1_{0:00}", numero); |
---|
1201 | string d = string.Format("World/{0:00}/Trees_Animation 1_{0:00}", numero); |
---|
1202 | LuoMaa(numero, a, b, c, d); |
---|
1203 | |
---|
1204 | |
---|
1205 | |
---|
1206 | } |
---|
1207 | |
---|
1208 | void House() |
---|
1209 | { |
---|
1210 | Level.Width = 2400; |
---|
1211 | Level.Height = 2400; |
---|
1212 | Level.Background.Image = SmallHouseInside; |
---|
1213 | Level.Background.Width = 2400; |
---|
1214 | Level.Background.Height = 2400; |
---|
1215 | AddPlayer(PlayrStartPoint, 60, 60); |
---|
1216 | ColorTileMap ruudutt = ColorTileMap.FromLevelAsset("Houses/Small House/house hitbox"); |
---|
1217 | ruudutt.SetTileMethod(Color.Black, LuoTaso); |
---|
1218 | ruudutt.Optimize(Color.Black); |
---|
1219 | ruudutt.Execute(); |
---|
1220 | LevelTeleport(new Vector(0, -200), 50, 10, "30", () => new Vector(-460, -100)); |
---|
1221 | Camero(); |
---|
1222 | //LisaaKartta(); |
---|
1223 | Camera.Follow(Kamera); |
---|
1224 | Camera.StayInLevel = true; |
---|
1225 | //CameraShake(100, 0.02); |
---|
1226 | Level.CreateBorders(); |
---|
1227 | } |
---|
1228 | void AloitusMaa() |
---|
1229 | { |
---|
1230 | |
---|
1231 | |
---|
1232 | |
---|
1233 | Level.Width = 4800; |
---|
1234 | Level.Height = 4800; |
---|
1235 | Level.Background.Image = BaseLayer; |
---|
1236 | Level.Background.Width = 4800; |
---|
1237 | Level.Background.Height = 4800; |
---|
1238 | AddTaso1Seina1(); |
---|
1239 | |
---|
1240 | ColorTileMap ruudut2 = ColorTileMap.FromLevelAsset("World/Map 1/restricted area 2"); |
---|
1241 | ruudut2.SetTileMethod(Color.Black, LuoTaso); |
---|
1242 | ruudut2.Optimize(Color.Black); |
---|
1243 | ruudut2.Execute(); |
---|
1244 | |
---|
1245 | |
---|
1246 | ColorTileMap ruudut = ColorTileMap.FromLevelAsset("World/Map 1/restricted area 1"); |
---|
1247 | |
---|
1248 | ruudut.SetTileMethod(Color.Black, LuoTaso); |
---|
1249 | ruudut.Optimize(Color.Black); |
---|
1250 | ruudut.Execute(); |
---|
1251 | |
---|
1252 | |
---|
1253 | |
---|
1254 | //Talot |
---|
1255 | Houset(new Vector(-500, -1000), 370, 390); |
---|
1256 | Houset(TaloSpawnPoint, 570, 350); |
---|
1257 | Houset(new Vector(-500, -400), 570, 350); |
---|
1258 | SignPost(new Vector(-600, -650)); |
---|
1259 | |
---|
1260 | //Player |
---|
1261 | AddPlayer(PlayrStartPoint, 60, 60); |
---|
1262 | |
---|
1263 | Fense(new Vector(-650, -450)); |
---|
1264 | Fense(new Vector(-150, -850)); |
---|
1265 | //Enemies |
---|
1266 | gobliin(new Vector(500, -1000)); |
---|
1267 | gobliin(new Vector(400, -1000)); |
---|
1268 | gobliin(new Vector(300, -1000)); |
---|
1269 | LisaaWraith(new Vector(1000, 1000), 24, 24); |
---|
1270 | |
---|
1271 | //Ruins |
---|
1272 | LisaaKivi(new Vector(1000, 300), 170, 100); |
---|
1273 | LisaaIsoPylvas(Ruins, 310, 280); |
---|
1274 | LisaaKivi(new Vector(2000, 1000), 170, 100); |
---|
1275 | LisaaIsoPylvas(Ruins2, 310, 280); |
---|
1276 | LisaaPieniPylvas(new Vector(1900, 1500), 250, 200); |
---|
1277 | LisaaPieniKivi(new Vector(1000, 500), 100, 50); |
---|
1278 | LisaaPieniKivi(new Vector(1400, 660), 100, 50); |
---|
1279 | |
---|
1280 | //Teleport |
---|
1281 | LevelTeleport(new Vector(-2000, 2570), 1000, 400, "VesiMaa", () => new Vector(-600, -1000)); |
---|
1282 | LevelTeleport(new Vector(2500, -2000), 400, 4000, "Skeletor", () => new Vector(0, -500)); |
---|
1283 | |
---|
1284 | |
---|
1285 | Camero(); |
---|
1286 | |
---|
1287 | PhoneBackButton.Listen(ConfirmExit, "Lopeta peli"); |
---|
1288 | Keyboard.Listen(Key.Escape, ButtonState.Pressed, ConfirmExit, "Lopeta peli"); |
---|
1289 | Camera.Follow(Kamera); |
---|
1290 | Camera.StayInLevel = true; |
---|
1291 | LisaaKartta(); |
---|
1292 | |
---|
1293 | Level.CreateBorders(); |
---|
1294 | |
---|
1295 | } |
---|
1296 | void SkeletorBossRoom() |
---|
1297 | { |
---|
1298 | Level.Width = 2400; |
---|
1299 | Level.Height = 2400; |
---|
1300 | Level.Background.Image = SkeltorBackground; |
---|
1301 | Level.Background.Width = 2400; |
---|
1302 | Level.Background.Height = 2400; |
---|
1303 | AddPlayer(PlayrStartPoint, 60, 60); |
---|
1304 | ColorTileMap ruudutt = ColorTileMap.FromLevelAsset("Bosses/Skeletor/restricted_Boss room_0"); |
---|
1305 | ruudutt.SetTileMethod(Color.Black, LuoTaso); |
---|
1306 | ruudutt.Optimize(Color.Black); |
---|
1307 | ruudutt.Execute(); |
---|
1308 | |
---|
1309 | |
---|
1310 | CameraShake(60, 0.02); |
---|
1311 | |
---|
1312 | Timer.SingleShot(5, delegate |
---|
1313 | { |
---|
1314 | Skeletor(new Vector(0, 1000), 2400, 2400); |
---|
1315 | |
---|
1316 | }); |
---|
1317 | |
---|
1318 | |
---|
1319 | Camero(); |
---|
1320 | LisaaKartta(); |
---|
1321 | Camera.Follow(Kamera); |
---|
1322 | Camera.StayInLevel = true; |
---|
1323 | //CameraShake(100, 0.02); |
---|
1324 | Level.CreateBorders(); |
---|
1325 | } |
---|
1326 | |
---|
1327 | //Walls and the creator |
---|
1328 | void LuoTaso(Vector paikka, double leveys, double korkeus) |
---|
1329 | { |
---|
1330 | |
---|
1331 | PhysicsObject taso = PhysicsObject.CreateStaticObject(leveys, korkeus); |
---|
1332 | taso.Position = paikka; |
---|
1333 | //taso.Color = RandomGen.NextColor(); |
---|
1334 | taso.Color = Color.Transparent; |
---|
1335 | Add(taso); |
---|
1336 | |
---|
1337 | } |
---|
1338 | void AddTaso1Seina1() |
---|
1339 | { |
---|
1340 | GameObject Seinat = new GameObject(4800, 4800); |
---|
1341 | Seinat.Image = RestrictedArea1; |
---|
1342 | |
---|
1343 | Seinat.Position = new Vector(0, 0); |
---|
1344 | Add(Seinat); |
---|
1345 | |
---|
1346 | GameObject Seinat2 = new GameObject(4800, 4800); |
---|
1347 | Seinat2.Image = RestrictedArea2; |
---|
1348 | |
---|
1349 | Seinat2.Position = new Vector(0, 0); |
---|
1350 | Add(Seinat2); |
---|
1351 | |
---|
1352 | } |
---|
1353 | //Player |
---|
1354 | void AddPlayer(Vector paikka, double leveys, double korkeus) |
---|
1355 | |
---|
1356 | { |
---|
1357 | |
---|
1358 | player1 = new Pelaaja1(40, 60, 5); |
---|
1359 | |
---|
1360 | player1.kuva = new GameObject(160, 140); |
---|
1361 | player1.kuva.Y = 10; |
---|
1362 | player1.Add(player1.kuva); |
---|
1363 | player1.Color = Color.Transparent; |
---|
1364 | player1.kuva.Image = IdleDown; |
---|
1365 | |
---|
1366 | player1.CollisionIgnoreGroup = 1; |
---|
1367 | player1.varjo = new GameObject(160, 140); |
---|
1368 | player1.varjo.Y = 10; |
---|
1369 | // player1.Shape = Shape.FromImage(IdleDown); |
---|
1370 | |
---|
1371 | player1.Add(player1.varjo); |
---|
1372 | player1.varjo.Image = PLayerShadow; |
---|
1373 | //player1.varjo.Image = Image.Color(PLayerShadow,100); |
---|
1374 | player1.Position = paikka; |
---|
1375 | player1.nopeus = 20000; |
---|
1376 | player1.LinearDamping = 0.1; |
---|
1377 | player1.CanRotate = false; |
---|
1378 | player1.MaxAngularVelocity = 0; |
---|
1379 | //player1.Shape = Shape.FromImage(IdleDown); |
---|
1380 | player1.AngularDamping = 0.1; |
---|
1381 | player1.AbsoluteAngle = Angle.FromDegrees(0); |
---|
1382 | PlayerControlls(); |
---|
1383 | |
---|
1384 | AddCollisionHandler(player1, "GoblinAttack", PlayerhurtState); |
---|
1385 | |
---|
1386 | AddCollisionHandler(player1, "SkullAttack", PlayerSkullhurtState); |
---|
1387 | |
---|
1388 | ProgressBar elamaPalkki = new ProgressBar(300, 50); |
---|
1389 | elamaPalkki.X = Screen.Left + 150; |
---|
1390 | elamaPalkki.Y = Screen.Top - 80; |
---|
1391 | elamaPalkki.BarImage = PlayerFullHealth; |
---|
1392 | elamaPalkki.Image = PlayerEmptyHealth; |
---|
1393 | elamaPalkki.BindTo(player1.PlayerHealth); |
---|
1394 | elamaPalkki.TextureWrapSize = new Vector(5, 1); |
---|
1395 | Add(elamaPalkki); |
---|
1396 | //player1.Add(elamaPalkki); |
---|
1397 | |
---|
1398 | player1.Destroyed += delegate |
---|
1399 | { |
---|
1400 | LataaMaa(NykyineneMaa); |
---|
1401 | |
---|
1402 | |
---|
1403 | }; |
---|
1404 | |
---|
1405 | |
---|
1406 | Add(player1); |
---|
1407 | |
---|
1408 | |
---|
1409 | |
---|
1410 | |
---|
1411 | |
---|
1412 | } |
---|
1413 | void PlayerSkullhurtState(PhysicsObject pel, PhysicsObject HitBox) |
---|
1414 | { |
---|
1415 | Vector suunta = player1.Position - HitBox.Position; |
---|
1416 | suunta.Y = 0; |
---|
1417 | suunta.Normalize(); |
---|
1418 | CameraShake(60.0, 0.3); |
---|
1419 | player1.PlayerHealth.Value--; |
---|
1420 | player1.Hit(suunta * 50); |
---|
1421 | Jypeli.Timer.SingleShot(0.3, delegate |
---|
1422 | { |
---|
1423 | |
---|
1424 | if (player1.PlayerHealth.Value < 1) |
---|
1425 | { |
---|
1426 | player1.Destroy(); |
---|
1427 | |
---|
1428 | Camera.StopFollowing(); |
---|
1429 | } |
---|
1430 | |
---|
1431 | player1.LinearDamping = 0.1; |
---|
1432 | CanRun = true; |
---|
1433 | }); |
---|
1434 | player1.LinearDamping = 0.8; |
---|
1435 | CanRun = false; |
---|
1436 | HitBox.Destroy(); |
---|
1437 | |
---|
1438 | // player1.Destroy(); |
---|
1439 | |
---|
1440 | |
---|
1441 | } |
---|
1442 | void PlayerhurtState(PhysicsObject pel, PhysicsObject HitBox) |
---|
1443 | { |
---|
1444 | Vector suunta = player1.Position - HitBox.Position; |
---|
1445 | suunta.Normalize(); |
---|
1446 | CameraShake(60.0, 0.3); |
---|
1447 | player1.PlayerHealth.Value--; |
---|
1448 | player1.Hit(suunta * 80); |
---|
1449 | Jypeli.Timer.SingleShot(0.3, delegate |
---|
1450 | { |
---|
1451 | |
---|
1452 | if (player1.PlayerHealth.Value < 1) |
---|
1453 | { |
---|
1454 | player1.Destroy(); |
---|
1455 | |
---|
1456 | Camera.StopFollowing(); |
---|
1457 | } |
---|
1458 | |
---|
1459 | player1.LinearDamping = 0.1; |
---|
1460 | CanRun = true; |
---|
1461 | }); |
---|
1462 | player1.LinearDamping = 0.8; |
---|
1463 | CanRun = false; |
---|
1464 | HitBox.Destroy(); |
---|
1465 | |
---|
1466 | // player1.Destroy(); |
---|
1467 | |
---|
1468 | |
---|
1469 | } |
---|
1470 | void PlayerControlls() |
---|
1471 | { |
---|
1472 | |
---|
1473 | Keyboard.Listen(Key.Up, ButtonState.Down, MovePlayer, null, new Vector(0, player1.nopeus), Up); |
---|
1474 | Keyboard.Listen(Key.Down, ButtonState.Down, MovePlayer, null, new Vector(0, -player1.nopeus), Down); |
---|
1475 | Keyboard.Listen(Key.Left, ButtonState.Down, MovePlayer, null, new Vector(-player1.nopeus, 0), Left); |
---|
1476 | Keyboard.Listen(Key.Right, ButtonState.Down, MovePlayer, null, new Vector(player1.nopeus, 0), Right); |
---|
1477 | Keyboard.Listen(Key.N, ButtonState.Pressed, () => |
---|
1478 | { |
---|
1479 | player1.IgnoresCollisionResponse = true; |
---|
1480 | |
---|
1481 | }, null); |
---|
1482 | Keyboard.Listen(Key.N, ButtonState.Released, () => |
---|
1483 | { |
---|
1484 | player1.IgnoresCollisionResponse = false; |
---|
1485 | |
---|
1486 | }, null); |
---|
1487 | |
---|
1488 | //Keyboard.Listen(Key.Space, ButtonState.Pressed, CameraShake, null,20.0, 0.3); |
---|
1489 | |
---|
1490 | Keyboard.Listen(Key.D, ButtonState.Down, Attack, null, ARight, IdleRight, new Vector(50, 0), new Vector(10.0, 50.0)); |
---|
1491 | Keyboard.Listen(Key.A, ButtonState.Down, Attack, null, ALeft, IdleLeft, new Vector(-50, 0), new Vector(10.0, 50.0)); |
---|
1492 | Keyboard.Listen(Key.W, ButtonState.Down, Attack, null, AUp, IdleUp, new Vector(0, 50), new Vector(50.0, 10.0)); |
---|
1493 | Keyboard.Listen(Key.S, ButtonState.Down, Attack, null, ADown, IdleDown, new Vector(0, -50), new Vector(50.0, 10.0)); |
---|
1494 | |
---|
1495 | |
---|
1496 | |
---|
1497 | Keyboard.Listen(Key.Up, ButtonState.Released, () => |
---|
1498 | { |
---|
1499 | if (CanRun) |
---|
1500 | player1.kuva.Animation = IdleUp; |
---|
1501 | |
---|
1502 | }, null); |
---|
1503 | |
---|
1504 | |
---|
1505 | Keyboard.Listen(Key.Down, ButtonState.Released, () => |
---|
1506 | { |
---|
1507 | if (CanRun) |
---|
1508 | player1.kuva.Animation = IdleDown; |
---|
1509 | }, null); |
---|
1510 | |
---|
1511 | |
---|
1512 | Keyboard.Listen(Key.Right, ButtonState.Released, () => |
---|
1513 | { |
---|
1514 | if (CanRun) |
---|
1515 | player1.kuva.Animation = IdleRight; |
---|
1516 | }, null); |
---|
1517 | |
---|
1518 | |
---|
1519 | Keyboard.Listen(Key.Left, ButtonState.Released, () => |
---|
1520 | { |
---|
1521 | if (CanRun) |
---|
1522 | player1.kuva.Animation = IdleLeft; |
---|
1523 | }, null); |
---|
1524 | |
---|
1525 | |
---|
1526 | |
---|
1527 | |
---|
1528 | } |
---|
1529 | void MovePlayer(Vector vektori, Animation suunta) |
---|
1530 | { |
---|
1531 | if (CanRun == true) |
---|
1532 | { |
---|
1533 | player1.kuva.Animation = suunta; |
---|
1534 | player1.kuva.Animation.FPS = 7; |
---|
1535 | if (player1.kuva.Animation.IsPlaying == false) |
---|
1536 | { |
---|
1537 | player1.kuva.Animation.Start(); |
---|
1538 | |
---|
1539 | |
---|
1540 | } |
---|
1541 | |
---|
1542 | player1.Push(vektori); |
---|
1543 | |
---|
1544 | |
---|
1545 | } |
---|
1546 | |
---|
1547 | } |
---|
1548 | void Attack(Animation attack, Image Idle, Vector suunta, Vector koko) |
---|
1549 | { |
---|
1550 | CanRun = false; |
---|
1551 | player1.kuva.Animation = attack; |
---|
1552 | player1.kuva.Animation.FPS = 15; |
---|
1553 | CameraShake(5, 0.5); |
---|
1554 | if (player1.kuva.Animation.IsPlaying == false) |
---|
1555 | { |
---|
1556 | |
---|
1557 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
1558 | { |
---|
1559 | |
---|
1560 | |
---|
1561 | PhysicsObject HitBox = new PhysicsObject(koko.X, koko.Y); |
---|
1562 | HitBox.Position = player1.Position + suunta; |
---|
1563 | Add(HitBox); |
---|
1564 | HitBox.LifetimeLeft = TimeSpan.FromSeconds(0.1); |
---|
1565 | HitBox.IgnoresCollisionResponse = true; |
---|
1566 | HitBox.Color = Color.Red; |
---|
1567 | HitBox.Tag = "PlayerAttack"; |
---|
1568 | HitBox.IsVisible = false; |
---|
1569 | }); |
---|
1570 | player1.kuva.Animation.Start(1); |
---|
1571 | player1.kuva.Animation.Played += delegate |
---|
1572 | { |
---|
1573 | CanRun = true; |
---|
1574 | player1.kuva.Animation.Stop(); |
---|
1575 | player1.kuva.Animation = new Animation(Idle); |
---|
1576 | |
---|
1577 | }; |
---|
1578 | |
---|
1579 | |
---|
1580 | |
---|
1581 | } |
---|
1582 | |
---|
1583 | |
---|
1584 | |
---|
1585 | |
---|
1586 | } |
---|
1587 | |
---|
1588 | //Camera and the camera shake |
---|
1589 | void Camero() |
---|
1590 | { |
---|
1591 | Kamera = new PhysicsObject(1, 1); |
---|
1592 | Add(Kamera); |
---|
1593 | Kamera.Position = player1.Position; |
---|
1594 | seuraajanAivot = new FollowerBrain(player1); |
---|
1595 | Kamera.IgnoresCollisionResponse = true; |
---|
1596 | seuraajanAivot.Speed = 400; |
---|
1597 | |
---|
1598 | Kamera.Brain = seuraajanAivot; |
---|
1599 | seuraajanAivot.Active = true; |
---|
1600 | } |
---|
1601 | void CameraShake(double shakeAmount, double vaimennus) |
---|
1602 | { |
---|
1603 | Timer shake = new Timer(); |
---|
1604 | shake.Interval = 0.05; |
---|
1605 | shake.Timeout += delegate |
---|
1606 | { |
---|
1607 | Kamera.Position += RandomGen.NextVector(0, shakeAmount); |
---|
1608 | |
---|
1609 | shakeAmount += -shakeAmount * vaimennus; |
---|
1610 | if (shakeAmount < 0.1) |
---|
1611 | { |
---|
1612 | shake.Stop(); |
---|
1613 | } |
---|
1614 | }; |
---|
1615 | shake.Start(); |
---|
1616 | |
---|
1617 | |
---|
1618 | } |
---|
1619 | |
---|
1620 | //Bosses |
---|
1621 | void Skeletor(Vector paikka, double leveys, double korkeus) |
---|
1622 | { |
---|
1623 | GameObject skelePoint = new GameObject(10, 10); |
---|
1624 | skelePoint.IsVisible = false; |
---|
1625 | skelePoint.Position = paikka; |
---|
1626 | Add(skelePoint); |
---|
1627 | |
---|
1628 | Skeletor skele = new Skeletor(this, 470, 520); |
---|
1629 | skele.IgnoresCollisionResponse = true; |
---|
1630 | skele.Image = SkeletorImage; |
---|
1631 | skele.Position = paikka; |
---|
1632 | // Image skeleShape = LoadImage("Bosses/Skeletor/skull män headShape"); |
---|
1633 | //skele.Shape = Shape.FromImage(SkeletorImage); |
---|
1634 | |
---|
1635 | skele.CanRotate = false; |
---|
1636 | skele.LinearDamping = 0.7; |
---|
1637 | FollowerBrain skeleAivot = new FollowerBrain(skelePoint); |
---|
1638 | skeleAivot.Speed = 400; |
---|
1639 | skele.Brain = skeleAivot; |
---|
1640 | skeleAivot.Active = true; |
---|
1641 | |
---|
1642 | |
---|
1643 | |
---|
1644 | AddCollisionHandler<Skeletor, PhysicsObject>(skele, "PlayerAttack", SkeletorHurt); |
---|
1645 | |
---|
1646 | ProgressBar BossHealth = new ProgressBar(800, 30); |
---|
1647 | BossHealth.X = Screen.Right - 400; |
---|
1648 | BossHealth.Y = Screen.Bottom + 80; |
---|
1649 | BossHealth.BarImage = FullHealth; |
---|
1650 | BossHealth.Image = NoHealth; |
---|
1651 | BossHealth.BindTo(skele.helttiLaskuri); |
---|
1652 | BossHealth.TextureWrapSize = new Vector(20, 1); |
---|
1653 | Add(BossHealth); |
---|
1654 | |
---|
1655 | |
---|
1656 | Add(skele); |
---|
1657 | |
---|
1658 | |
---|
1659 | Timer BossFight = new Timer(); |
---|
1660 | BossFight.Interval = 1; |
---|
1661 | BossFight.Start(); |
---|
1662 | |
---|
1663 | BossFight.Timeout += delegate |
---|
1664 | { |
---|
1665 | BossFight.Interval = 10; |
---|
1666 | Timer.SingleShot(1, delegate |
---|
1667 | { |
---|
1668 | |
---|
1669 | SkullAttackLaser(skele); |
---|
1670 | |
---|
1671 | |
---|
1672 | |
---|
1673 | |
---|
1674 | |
---|
1675 | }); |
---|
1676 | //BossFight.Interval = 25; |
---|
1677 | |
---|
1678 | |
---|
1679 | |
---|
1680 | Timer.SingleShot(5, delegate |
---|
1681 | { |
---|
1682 | |
---|
1683 | int maara = GetObjectsWithTag("Wraith").Count; |
---|
1684 | if (maara < 1) |
---|
1685 | { |
---|
1686 | LisaaWraith(new Vector(-300, 0), 240, 240, 10000); |
---|
1687 | |
---|
1688 | |
---|
1689 | } |
---|
1690 | if (maara < 2) |
---|
1691 | { |
---|
1692 | LisaaWraith(new Vector(300, 0), 240, 240, 10000); |
---|
1693 | |
---|
1694 | |
---|
1695 | } |
---|
1696 | if (maara < 3) |
---|
1697 | { |
---|
1698 | LisaaWraith(new Vector(-300, 400), 240, 240, 100000); |
---|
1699 | |
---|
1700 | |
---|
1701 | } |
---|
1702 | if (maara < 4) |
---|
1703 | { |
---|
1704 | LisaaWraith(new Vector(300, 400), 240, 240, 10000); |
---|
1705 | |
---|
1706 | |
---|
1707 | } |
---|
1708 | if (maara < 5) |
---|
1709 | { |
---|
1710 | LisaaWraith(new Vector(300, 800), 240, 240, 10000); |
---|
1711 | |
---|
1712 | |
---|
1713 | } |
---|
1714 | if (maara < 6) |
---|
1715 | { |
---|
1716 | LisaaWraith(new Vector(-300, 800), 240, 240, 10000); |
---|
1717 | |
---|
1718 | |
---|
1719 | } |
---|
1720 | |
---|
1721 | |
---|
1722 | }); |
---|
1723 | |
---|
1724 | |
---|
1725 | |
---|
1726 | |
---|
1727 | |
---|
1728 | |
---|
1729 | }; |
---|
1730 | |
---|
1731 | skele.Destroyed += BossFight.Stop; |
---|
1732 | |
---|
1733 | |
---|
1734 | |
---|
1735 | |
---|
1736 | |
---|
1737 | } |
---|
1738 | void SkullAttackLaser(Skeletor skele) |
---|
1739 | { |
---|
1740 | |
---|
1741 | GameObject Attack = new GameObject(1200, 1200); |
---|
1742 | Attack.Animation = new Animation(SkullAttack); |
---|
1743 | Attack.Animation.Start(); |
---|
1744 | //Attack.Position = skele.Position; |
---|
1745 | Attack.Y = -450; |
---|
1746 | PhysicsObject HitBox = null; |
---|
1747 | PhysicsObject HitBox2 = null; |
---|
1748 | // HitBox.Color = Color.Red; |
---|
1749 | Timer.SingleShot(0.3, delegate |
---|
1750 | { |
---|
1751 | ; |
---|
1752 | HitBox = Laaser(new Vector(100, 300), skele); |
---|
1753 | HitBox2 = Laaser(new Vector(-130, 300), skele); |
---|
1754 | }); |
---|
1755 | |
---|
1756 | |
---|
1757 | //Attack.Position = HeadPosition + new Vector(0, -450); |
---|
1758 | skele.Add(Attack); |
---|
1759 | |
---|
1760 | Attack.Animation.Played += delegate |
---|
1761 | { |
---|
1762 | Attack.Destroy(); |
---|
1763 | HitBox.Destroy(); |
---|
1764 | HitBox2.Destroy(); |
---|
1765 | |
---|
1766 | }; |
---|
1767 | |
---|
1768 | |
---|
1769 | |
---|
1770 | } |
---|
1771 | PhysicsObject Laaser(Vector paikka, Skeletor skele) |
---|
1772 | { |
---|
1773 | PhysicsObject HitBox = new PhysicsObject(100, 900); |
---|
1774 | HitBox.Position = paikka; |
---|
1775 | skele.Add(HitBox); |
---|
1776 | HitBox.IgnoresCollisionResponse = true; |
---|
1777 | HitBox.Color = Color.Red; |
---|
1778 | HitBox.IsVisible = false; |
---|
1779 | HitBox.Tag = "SkullAttack"; |
---|
1780 | |
---|
1781 | return HitBox; |
---|
1782 | |
---|
1783 | } |
---|
1784 | void SkeletorHurt(Skeletor skeleton, PhysicsObject HitBox) |
---|
1785 | { |
---|
1786 | Vector suunta = skeleton.Position - player1.Position; |
---|
1787 | suunta.Normalize(); |
---|
1788 | skeleton.helttiLaskuri.Value--; |
---|
1789 | Jypeli.Timer.SingleShot(0.1, delegate |
---|
1790 | { |
---|
1791 | skeleton.Image = SkeletorImage; |
---|
1792 | if (skeleton.helttiLaskuri.Value < 1) |
---|
1793 | { |
---|
1794 | |
---|
1795 | skeleton.Destroy(); |
---|
1796 | |
---|
1797 | } |
---|
1798 | |
---|
1799 | |
---|
1800 | }); |
---|
1801 | |
---|
1802 | skeleton.Image = SkeletorDmg; |
---|
1803 | skeleton.Hit(suunta * 40); |
---|
1804 | HitBox.Destroy(); |
---|
1805 | |
---|
1806 | } |
---|
1807 | |
---|
1808 | void WrathSpawner() |
---|
1809 | |
---|
1810 | { |
---|
1811 | Timer spawner = new Timer(); |
---|
1812 | spawner.Interval = 6; |
---|
1813 | |
---|
1814 | Vector TaloSpawnPoint = RandomGen.NextVector(-300, 500, 300, 900); |
---|
1815 | |
---|
1816 | spawner.Timeout += delegate |
---|
1817 | { |
---|
1818 | if (WraithCount < 2) |
---|
1819 | LisaaWraith(TaloSpawnPoint, 240, 240); |
---|
1820 | |
---|
1821 | }; |
---|
1822 | spawner.Start(); |
---|
1823 | |
---|
1824 | |
---|
1825 | } |
---|
1826 | void Houset(Vector paikka, double leveys, double korkeus) |
---|
1827 | { |
---|
1828 | |
---|
1829 | |
---|
1830 | PhysicsObject mediumtalot = new PhysicsObject(360, 390); |
---|
1831 | |
---|
1832 | mediumtalot.Image = MediumTalo; |
---|
1833 | //mediumtalot.Shape = Shape.FromImage(MediumTalo); |
---|
1834 | mediumtalot.Position = paikka; |
---|
1835 | mediumtalot.IgnoresCollisionResponse = true; |
---|
1836 | |
---|
1837 | PhysicsObject seinät = new PhysicsObject(240, 200); |
---|
1838 | seinät.Position = mediumtalot.Position; |
---|
1839 | seinät.X += 45; |
---|
1840 | seinät.Y -= 100; |
---|
1841 | |
---|
1842 | GameObject shadow = new GameObject(360, 390); |
---|
1843 | shadow.Image = MediumTaloShadow; |
---|
1844 | seinät.MakeStatic(); |
---|
1845 | //seina.MakeStatic(); |
---|
1846 | //meduimtaloo.talonsena = new PhysicsObject(400,200); |
---|
1847 | seinät.IsVisible = false; |
---|
1848 | // meduimtaloo.talonsena.Color = Color.Transparent; |
---|
1849 | shadow.Position = mediumtalot.Position; |
---|
1850 | |
---|
1851 | Add(shadow, -1); |
---|
1852 | |
---|
1853 | // seina2.MakeStatic(); |
---|
1854 | Add(seinät); |
---|
1855 | |
---|
1856 | //meduimtaloo.talonsena.Color = Color.Transparent; |
---|
1857 | Add(mediumtalot, 2); |
---|
1858 | |
---|
1859 | |
---|
1860 | |
---|
1861 | } |
---|
1862 | void LisaaWraith(Vector paikka, double leveys, double korkeus, double wanderDistance = 500) |
---|
1863 | { |
---|
1864 | |
---|
1865 | GameObject WraithSpawn = new GameObject(240, 240); |
---|
1866 | WraithSpawn.Animation = SpectreSpawn; |
---|
1867 | WraithSpawn.Animation.Start(); |
---|
1868 | Add(WraithSpawn); |
---|
1869 | WraithSpawn.Position = paikka; |
---|
1870 | |
---|
1871 | |
---|
1872 | Wraith wraiith = new Wraith(this, 240, 240, 3, wanderDistance); |
---|
1873 | wraiith.CollisionIgnoreGroup = 1; |
---|
1874 | wraiith.IgnoresCollisionResponse = true; |
---|
1875 | wraiith.Position = paikka; |
---|
1876 | WraithCount++; |
---|
1877 | GameObject shadow = new GameObject(240, 240); |
---|
1878 | Image wraithshadow = LoadImage("Enemies/Wraith/wraith shadow_shadow_0"); |
---|
1879 | shadow.Image = wraithshadow; |
---|
1880 | //shadow.Y = -10; |
---|
1881 | |
---|
1882 | wraiith.Tag = "Wraith"; |
---|
1883 | |
---|
1884 | AddCollisionHandler<Wraith, PhysicsObject>(wraiith, "PlayerAttack", WraithHurtState); |
---|
1885 | |
---|
1886 | wraiith.CanRotate = false; |
---|
1887 | wraiith.wraithaivot.Speed = 400; |
---|
1888 | wraiith.wraithaivot.Active = true; |
---|
1889 | |
---|
1890 | |
---|
1891 | |
---|
1892 | ProgressBar elamaPalkki = new ProgressBar(120, 30); |
---|
1893 | elamaPalkki.Y = 80; |
---|
1894 | elamaPalkki.BarImage = FullHealth; |
---|
1895 | elamaPalkki.Image = NoHealth; |
---|
1896 | elamaPalkki.BindTo(wraiith.helttiWraithLaskuri); |
---|
1897 | elamaPalkki.TextureWrapSize = new Vector(3, 1); |
---|
1898 | // wraiith.Add(elamaPalkki); |
---|
1899 | |
---|
1900 | wraiith.IsUpdated = true; |
---|
1901 | Timer.SingleShot(1 / 12.0 * 8, delegate |
---|
1902 | { |
---|
1903 | Add(wraiith, 2); |
---|
1904 | WraithSpawn.IsVisible = false; |
---|
1905 | wraiith.Add(elamaPalkki); |
---|
1906 | wraiith.Add(shadow); |
---|
1907 | WraithSpawn.Destroy(); |
---|
1908 | |
---|
1909 | |
---|
1910 | |
---|
1911 | |
---|
1912 | }); |
---|
1913 | |
---|
1914 | |
---|
1915 | |
---|
1916 | |
---|
1917 | } |
---|
1918 | void WraithHurtState(Wraith wraiith, PhysicsObject HitBox) |
---|
1919 | { |
---|
1920 | Vector suunta = wraiith.Position - player1.Position; |
---|
1921 | suunta.Normalize(); |
---|
1922 | wraiith.helttiWraithLaskuri.Value--; |
---|
1923 | Jypeli.Timer.SingleShot(0.3, delegate |
---|
1924 | { |
---|
1925 | if (wraiith.helttiWraithLaskuri.Value < 1) |
---|
1926 | { |
---|
1927 | |
---|
1928 | wraiith.Destroy(); |
---|
1929 | WraithCount--; |
---|
1930 | } |
---|
1931 | wraiith.LinearDamping = 0.7; |
---|
1932 | wraiith.Animation.Start(); |
---|
1933 | }); |
---|
1934 | wraiith.LinearDamping = 0.8; |
---|
1935 | wraiith.Animation.Stop(); |
---|
1936 | wraiith.Hit(suunta * 70); |
---|
1937 | HitBox.Destroy(); |
---|
1938 | |
---|
1939 | } |
---|
1940 | void gobliin(Vector paikka) |
---|
1941 | { |
---|
1942 | |
---|
1943 | Goblin gobo = new Goblin(this, 140, 140, 2); |
---|
1944 | |
---|
1945 | gobo.CollisionIgnoreGroup = 1; |
---|
1946 | gobo.Position = paikka; |
---|
1947 | gobo.Image = GDown; |
---|
1948 | Add(gobo); |
---|
1949 | |
---|
1950 | GameObject shadow = new GameObject(140, 140); |
---|
1951 | |
---|
1952 | Image rockshadow = LoadImage("Enemies/Goblin/goblin shadow"); |
---|
1953 | shadow.Image = rockshadow; |
---|
1954 | //shadow.Y = -10; |
---|
1955 | |
---|
1956 | gobo.Add(shadow); |
---|
1957 | |
---|
1958 | |
---|
1959 | |
---|
1960 | |
---|
1961 | AddCollisionHandler<Goblin, PhysicsObject>(gobo, "PlayerAttack", HurtState); |
---|
1962 | |
---|
1963 | gobo.CanRotate = false; |
---|
1964 | gobo.goboaivot.Speed = 300; |
---|
1965 | gobo.goboaivot.Active = true; |
---|
1966 | |
---|
1967 | gobo.IsUpdated = true; |
---|
1968 | |
---|
1969 | |
---|
1970 | ProgressBar elamaPalkki = new ProgressBar(80, 30); |
---|
1971 | elamaPalkki.Y = 60; |
---|
1972 | elamaPalkki.BarImage = FullHealth; |
---|
1973 | elamaPalkki.Image = NoHealth; |
---|
1974 | elamaPalkki.BindTo(gobo.helttiLaskuri); |
---|
1975 | elamaPalkki.TextureWrapSize = new Vector(2, 1); |
---|
1976 | gobo.Add(elamaPalkki); |
---|
1977 | |
---|
1978 | |
---|
1979 | |
---|
1980 | |
---|
1981 | |
---|
1982 | } |
---|
1983 | void HurtState(Goblin gobo, PhysicsObject Hitbox) |
---|
1984 | { |
---|
1985 | // gobo.Destroy(); |
---|
1986 | bool GoblinIsDestroyed = false; |
---|
1987 | Vector suunta = gobo.Position - player1.Position; |
---|
1988 | suunta.Normalize(); |
---|
1989 | gobo.helttiLaskuri.Value--; |
---|
1990 | if (gobo.helttiLaskuri.Value < 1) |
---|
1991 | { |
---|
1992 | gobo.Destroy(); |
---|
1993 | GoblinIsDestroyed = true; |
---|
1994 | goboKuolee(gobo); |
---|
1995 | } |
---|
1996 | Jypeli.Timer.SingleShot(0.3, delegate |
---|
1997 | { |
---|
1998 | |
---|
1999 | gobo.LinearDamping = 0.7; |
---|
2000 | gobo.Animation.Start(); |
---|
2001 | }); |
---|
2002 | gobo.LinearDamping = 0.8; |
---|
2003 | gobo.Animation.Stop(); |
---|
2004 | |
---|
2005 | if (GoblinIsDestroyed == false) |
---|
2006 | { |
---|
2007 | gobo.Hit(suunta * 70); |
---|
2008 | } |
---|
2009 | |
---|
2010 | Hitbox.Destroy(); |
---|
2011 | |
---|
2012 | } |
---|
2013 | void goboKuolee(Goblin gobo) |
---|
2014 | { |
---|
2015 | |
---|
2016 | gobo.Destroy(); |
---|
2017 | GameObject goboDeath = new GameObject(140, 140); |
---|
2018 | goboDeath.Animation = GoblinDeath; |
---|
2019 | goboDeath.Position = gobo.Position; |
---|
2020 | goboDeath.Animation.StopOnLastFrame = true; |
---|
2021 | goboDeath.Animation.FPS = 12; |
---|
2022 | |
---|
2023 | Add(goboDeath); |
---|
2024 | |
---|
2025 | goboDeath.Animation.Played += delegate |
---|
2026 | { |
---|
2027 | goboDeath.IsVisible = false; |
---|
2028 | goboDeath.Destroy(); |
---|
2029 | }; |
---|
2030 | |
---|
2031 | goboDeath.Animation.Start(); |
---|
2032 | |
---|
2033 | |
---|
2034 | |
---|
2035 | |
---|
2036 | } |
---|
2037 | void LisaaKivi(Vector paikka, double leveys, double korkeus) |
---|
2038 | { |
---|
2039 | PhysicsObject isokivi = new PhysicsObject(170, 100); |
---|
2040 | isokivi.MakeStatic(); |
---|
2041 | Image BigRock = LoadImage("Stuff/Ruins/large stone"); |
---|
2042 | isokivi.Image = BigRock; |
---|
2043 | isokivi.Position = paikka; |
---|
2044 | GameObject shadow = new GameObject(170, 100); |
---|
2045 | |
---|
2046 | Image rockshadow = LoadImage("Stuff/Ruins/large stone shadow"); |
---|
2047 | shadow.Image = rockshadow; |
---|
2048 | //shadow.Y = 10; |
---|
2049 | |
---|
2050 | isokivi.Add(shadow); |
---|
2051 | |
---|
2052 | Add(isokivi); |
---|
2053 | |
---|
2054 | |
---|
2055 | |
---|
2056 | } |
---|
2057 | void LisaaPieniKivi(Vector paikka, double leveys, double korkeus) |
---|
2058 | { |
---|
2059 | PhysicsObject pienikivi = new PhysicsObject(100, 50); |
---|
2060 | pienikivi.MakeStatic(); |
---|
2061 | Image BigRock = LoadImage("Stuff/Ruins/small stone"); |
---|
2062 | pienikivi.Image = BigRock; |
---|
2063 | pienikivi.Position = paikka; |
---|
2064 | GameObject shadow = new GameObject(100, 50); |
---|
2065 | |
---|
2066 | Image rockshadow = LoadImage("Stuff/Ruins/small stone shadow"); |
---|
2067 | shadow.Image = rockshadow; |
---|
2068 | //shadow.Y = 10; |
---|
2069 | |
---|
2070 | pienikivi.Add(shadow); |
---|
2071 | |
---|
2072 | Add(pienikivi); |
---|
2073 | |
---|
2074 | |
---|
2075 | |
---|
2076 | } |
---|
2077 | void LisaaIsoPylvas(Vector paikka, double leveys, double korkeus) |
---|
2078 | { |
---|
2079 | PhysicsObject IsoPylvas = new PhysicsObject(310, 280); |
---|
2080 | IsoPylvas.MakeStatic(); |
---|
2081 | IsoPylvas.Position = paikka; |
---|
2082 | Image IsoPylvasImg = LoadImage("Stuff/Ruins/medium pillar"); |
---|
2083 | IsoPylvas.Image = IsoPylvasImg; |
---|
2084 | IsoPylvas.Shape = Shape.FromImage(IsoPylvasImg); |
---|
2085 | GameObject shadow = new GameObject(310, 280); |
---|
2086 | Image PylvasShadow = LoadImage("Stuff/Ruins/medium pillar shadow"); |
---|
2087 | shadow.Image = PylvasShadow; |
---|
2088 | |
---|
2089 | shadow.Position = IsoPylvas.Position; |
---|
2090 | |
---|
2091 | Add(shadow, -1); |
---|
2092 | |
---|
2093 | Add(IsoPylvas, 1); |
---|
2094 | |
---|
2095 | |
---|
2096 | } |
---|
2097 | void LisaaPieniPylvas(Vector paikka, double leveys, double korkeus) |
---|
2098 | { |
---|
2099 | PhysicsObject PieniPylvas = new PhysicsObject(250, 200); |
---|
2100 | PieniPylvas.MakeStatic(); |
---|
2101 | PieniPylvas.Position = paikka; |
---|
2102 | Image IsoPylvasImg = LoadImage("Stuff/Ruins/small pillar"); |
---|
2103 | PieniPylvas.Image = IsoPylvasImg; |
---|
2104 | PieniPylvas.Shape = Shape.FromImage(IsoPylvasImg); |
---|
2105 | GameObject shadow = new GameObject(250, 200); |
---|
2106 | Image PylvasShadow = LoadImage("Stuff/Ruins/small pillar shadow"); |
---|
2107 | shadow.Image = PylvasShadow; |
---|
2108 | |
---|
2109 | shadow.Position = PieniPylvas.Position; |
---|
2110 | |
---|
2111 | Add(shadow, -1); |
---|
2112 | |
---|
2113 | Add(PieniPylvas, 1); |
---|
2114 | |
---|
2115 | |
---|
2116 | } |
---|
2117 | |
---|
2118 | void SignPost(Vector paikka) |
---|
2119 | { |
---|
2120 | PhysicsObject sign = new PhysicsObject(100, 120); |
---|
2121 | sign.Position = paikka; |
---|
2122 | Image signImage = LoadImage("Stuff/SignPost/Sign post"); |
---|
2123 | sign.Shape = Shape.FromImage(signImage); |
---|
2124 | sign.Image = signImage; |
---|
2125 | sign.MakeStatic(); |
---|
2126 | GameObject shadow = new GameObject(100, 120); |
---|
2127 | Image shadowImg = LoadImage("Stuff/SignPost/Sign post shadow"); |
---|
2128 | shadow.Image = shadowImg; |
---|
2129 | shadow.Position = sign.Position; |
---|
2130 | |
---|
2131 | Add(shadow, -1); |
---|
2132 | Add(sign, 1); |
---|
2133 | |
---|
2134 | |
---|
2135 | } |
---|
2136 | void LevelTeleport(Vector paikka, double korkeus, double leveys, string uusipaikka, Func<Vector> Tulopaikka) |
---|
2137 | { |
---|
2138 | PhysicsObject tp = new PhysicsObject(korkeus, leveys); |
---|
2139 | //AddCollisionHandler(player1); |
---|
2140 | AddCollisionHandler(tp, player1, delegate (PhysicsObject a, PhysicsObject b) |
---|
2141 | { |
---|
2142 | PlayrStartPoint = Tulopaikka(); |
---|
2143 | LataaMaa(uusipaikka); |
---|
2144 | }); |
---|
2145 | tp.IsVisible = false; |
---|
2146 | tp.IgnoresCollisionResponse = true; |
---|
2147 | tp.MakeStatic(); |
---|
2148 | tp.Position = paikka; |
---|
2149 | |
---|
2150 | Add(tp); |
---|
2151 | |
---|
2152 | } |
---|
2153 | void LisaaKartta() |
---|
2154 | { |
---|
2155 | Keyboard.Listen(Key.M, ButtonState.Pressed, Kartta, null); |
---|
2156 | |
---|
2157 | |
---|
2158 | |
---|
2159 | |
---|
2160 | } |
---|
2161 | void Kartta() |
---|
2162 | { |
---|
2163 | Label kartta = new Label(1200, 900); |
---|
2164 | Label pelaaja = new Label(20, 20); |
---|
2165 | |
---|
2166 | int paikkaNumero = int.Parse(NykyineneMaa); |
---|
2167 | int x = paikkaNumero % 8; |
---|
2168 | int y = (paikkaNumero / 8) + 2; |
---|
2169 | MessageDisplay.Add("" + x + "," + y); |
---|
2170 | |
---|
2171 | Vector paikka = new Vector(x * 1200 / 8, y * 900 / 8); |
---|
2172 | pelaaja.X = kartta.Left + paikka.X; |
---|
2173 | pelaaja.Y = kartta.Top - paikka.Y; |
---|
2174 | |
---|
2175 | kartta.Image = Map; |
---|
2176 | pelaaja.Image = Map; |
---|
2177 | |
---|
2178 | Add(kartta, 3); |
---|
2179 | Add(pelaaja, 3); |
---|
2180 | |
---|
2181 | Layers[3].RelativeTransition = new Vector(0, 0); |
---|
2182 | |
---|
2183 | Keyboard.Listen(Key.M, ButtonState.Released, () => |
---|
2184 | { |
---|
2185 | kartta.Destroy(); |
---|
2186 | pelaaja.Destroy(); |
---|
2187 | }, null); |
---|
2188 | |
---|
2189 | |
---|
2190 | |
---|
2191 | } |
---|
2192 | void LisaaTeltta1(Vector paikka) |
---|
2193 | |
---|
2194 | { |
---|
2195 | PhysicsObject teltta = new PhysicsObject(290, 190); |
---|
2196 | teltta.Position = paikka; |
---|
2197 | Image telttaright = LoadImage("Stuff/Teltat/tent facing down right"); |
---|
2198 | teltta.Image = telttaright; |
---|
2199 | teltta.MakeStatic(); |
---|
2200 | teltta.Shape = Shape.FromImage(telttaright); |
---|
2201 | Add(teltta); |
---|
2202 | |
---|
2203 | |
---|
2204 | |
---|
2205 | } |
---|
2206 | void LisaaTeltta2(Vector paikka) |
---|
2207 | |
---|
2208 | { |
---|
2209 | PhysicsObject teltta1 = new PhysicsObject(300, 180); |
---|
2210 | teltta1.Position = paikka; |
---|
2211 | Image telttaleft = LoadImage("Stuff/Teltat/tent facing down left"); |
---|
2212 | teltta1.Image = telttaleft; |
---|
2213 | teltta1.MakeStatic(); |
---|
2214 | teltta1.Shape = Shape.FromImage(telttaleft); |
---|
2215 | Add(teltta1); |
---|
2216 | |
---|
2217 | |
---|
2218 | |
---|
2219 | } |
---|
2220 | void Boat1(Vector paikka) |
---|
2221 | { |
---|
2222 | PhysicsObject boat = new PhysicsObject(170, 110); |
---|
2223 | boat.Position = paikka; |
---|
2224 | Image boatimage = LoadImage("Stuff/Teltat/boat facing up left"); |
---|
2225 | boat.Image = boatimage; |
---|
2226 | boat.MakeStatic(); |
---|
2227 | boat.Shape = Shape.FromImage(boatimage); |
---|
2228 | Add(boat); |
---|
2229 | |
---|
2230 | |
---|
2231 | |
---|
2232 | } |
---|
2233 | void Fense(Vector paikka) |
---|
2234 | { |
---|
2235 | PhysicsObject Fencee = new PhysicsObject(280, 190); |
---|
2236 | Fencee.Position = paikka; |
---|
2237 | Fencee.Image = Fence; |
---|
2238 | Fencee.MakeStatic(); |
---|
2239 | Fencee.Shape = Shape.FromImage(Fence); |
---|
2240 | Add(Fencee); |
---|
2241 | |
---|
2242 | |
---|
2243 | } |
---|
2244 | void AddPuu(Vector paikka) |
---|
2245 | { |
---|
2246 | PhysicsObject Puu = new PhysicsObject(240, 300); |
---|
2247 | Image PuuKuvat = LoadImage(RandomGen.SelectOne("Stuff/Trees/tree_1_0", "Stuff/Trees/tree_2_0", "Stuff/Trees/tree_3_0")); |
---|
2248 | Puu.Image = PuuKuvat; |
---|
2249 | Image PuuHitbox = LoadImage("Stuff/Trees/Blacks"); |
---|
2250 | Puu.Shape = Shape.FromImage(PuuHitbox); |
---|
2251 | Puu.Position = paikka; |
---|
2252 | Puu.MakeStatic(); |
---|
2253 | GameObject shadow = new GameObject(240, 300); |
---|
2254 | Image shadowImg = LoadImage("Stuff/Trees/SHADOW_1_0"); |
---|
2255 | shadow.Image = shadowImg; |
---|
2256 | shadow.Position = Puu.Position; |
---|
2257 | |
---|
2258 | Add(shadow, -1); |
---|
2259 | Add(Puu, 1); |
---|
2260 | |
---|
2261 | |
---|
2262 | |
---|
2263 | } |
---|
2264 | void AddPuuTrunk(Vector paikka) |
---|
2265 | { |
---|
2266 | PhysicsObject Puu = new PhysicsObject(240, 300); |
---|
2267 | Image PuuKuvatTrunk = LoadImage(RandomGen.SelectOne("Stuff/Trees/trunk_1_0", "Stuff/Trees/trunk_2_0", "Stuff/Trees/trunk_3_0")); |
---|
2268 | Puu.Image = PuuKuvatTrunk; |
---|
2269 | Image PuuHitbox = LoadImage("Stuff/Trees/Blacks"); |
---|
2270 | Puu.Shape = Shape.FromImage(PuuHitbox); |
---|
2271 | Puu.Position = paikka; |
---|
2272 | Puu.MakeStatic(); |
---|
2273 | GameObject shadow = new GameObject(240, 300); |
---|
2274 | Image shadowImg = LoadImage("Stuff/Trees/SHADOW_1_0"); |
---|
2275 | shadow.Image = shadowImg; |
---|
2276 | shadow.Position = Puu.Position; |
---|
2277 | |
---|
2278 | Add(shadow, -1); |
---|
2279 | Add(Puu, 1); |
---|
2280 | |
---|
2281 | |
---|
2282 | |
---|
2283 | } |
---|
2284 | void AddHenri(Vector paikka) |
---|
2285 | { |
---|
2286 | PhysicsObject kana = new PhysicsObject(90, 90); |
---|
2287 | kana.CanRotate = false; |
---|
2288 | kana.CollisionIgnoreGroup = 1; |
---|
2289 | |
---|
2290 | kana.Position = paikka; |
---|
2291 | |
---|
2292 | Timer HenrinSuuntaKuva = new Timer(); |
---|
2293 | HenrinSuuntaKuva.Interval = 0.6; |
---|
2294 | |
---|
2295 | HenrinSuuntaKuva.Timeout += delegate |
---|
2296 | { |
---|
2297 | kana.Image = LoadImage(RandomGen.SelectOne("Enemies/Kana/KANA_down_0", "Enemies/Kana/KANA_up_0", "Enemies/Kana/KANA_left_0", "Enemies/Kana/KANA_right_0")); |
---|
2298 | |
---|
2299 | }; |
---|
2300 | HenrinSuuntaKuva.Start(); |
---|
2301 | |
---|
2302 | //kana.Image = LoadImage("Enemies/Kana/Kana_left_0"); |
---|
2303 | |
---|
2304 | RandomMoverBrain wandererBrain = new RandomMoverBrain(); |
---|
2305 | wandererBrain.ChangeMovementSeconds = 0.6; |
---|
2306 | wandererBrain.WanderRadius = 100; |
---|
2307 | wandererBrain.Speed = 200; |
---|
2308 | kana.Brain = wandererBrain; |
---|
2309 | |
---|
2310 | AddCollisionHandler(kana, "PlayerAttack", KanaKuolee); |
---|
2311 | Add(kana); |
---|
2312 | |
---|
2313 | |
---|
2314 | } |
---|
2315 | void KanaKuolee(PhysicsObject kana, PhysicsObject hitbox) |
---|
2316 | { |
---|
2317 | GameObject KanaPosahtaa = new GameObject(90, 90); |
---|
2318 | KanaPosahtaa.Animation = KanaPoks; |
---|
2319 | KanaPosahtaa.Animation.Start(); |
---|
2320 | KanaPosahtaa.Position = kana.Position; |
---|
2321 | KanaPosahtaa.Animation.Played += delegate |
---|
2322 | { |
---|
2323 | KanaPosahtaa.IsVisible = false; |
---|
2324 | KanaPosahtaa.Destroy(); |
---|
2325 | }; |
---|
2326 | |
---|
2327 | |
---|
2328 | Add(KanaPosahtaa); |
---|
2329 | kana.Destroy(); |
---|
2330 | } |
---|
2331 | } |
---|