simplified win32 installer build script
[chaz/yoink] / data / scenes / Classic.lua
1
2 -- Scene: Classic Yoink
3 -- created by Neil Carter
4 -- converted to Lua by Charles McGarvey
5
6 LogInfo("-----", "Scene: Classic", "Created by Neil Carter",
7 "Converted to Lua by Charles McGarvey", "-----")
8
9 -- Scene API:
10 --
11 -- Functions:
12 -- SetBounds(point1, point2)
13 -- ResetTransform()
14 -- Translate(x, y, z)
15 -- Scale(x, y, z) or Scale(xyz)
16 -- Rotate(axis, degree) or Rotate(x, y, z)
17 -- SetTexture(name)
18 -- DrawTilemap({width = $num, [surface = TOP | LEFT | RIGHT], tiles})
19 -- DrawTile(tile, [u_scale])
20 --
21 -- Globals:
22 -- detail - level of detail of the scene (HIGH, MEDIUM, or LOW)
23
24
25 SetBounds({-5, 0, -6}, {45, 15, 7})
26
27
28 -- Left end tower block
29 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30
31 -- Front
32
33 ResetTransform()
34 Translate(-5, 0, 2)
35 SetTexture("TowerBlock1")
36 DrawTilemap({
37 width = 5,
38 2, 2, 2, 2, 2,
39 1, 0, 0, 1, 0,
40 1, 0, 0, 1, 0,
41 1, 0, 0, 1, 0,
42 1, 0, 0, 1, 0,
43 1, 0, 0, 1, 0,
44 1, 0, 0, 1, 0,
45 1, 0, 0, 1, 0,
46 1, 0, 0, 1, 0,
47 1, 0, 0, 1, 0,
48 1, 0, 0, 1, 0,
49 1, 0, 0, 1, 0,
50 1, 0, 0, 1, 0,
51 1, 0, 0, 1, 0,
52 4, 4, 4, 4, 4})
53
54 -- Right side
55
56 ResetTransform()
57 Rotate(Y, 90)
58 Translate(0, 0, 2)
59 DrawTilemap({
60 width = 5,
61 surface = RIGHT,
62 2, 2, 2, 2, 2,
63 0, 0, 0, 0, 0,
64 0, 0, 0, 0, 0,
65 0, 0, 0, 0, 0,
66 0, 0, 0, 0, 0,
67 0, 0, 0, 0, 0,
68 0, 0, 0, 0, 0,
69 0, 0, 0, 0, 0,
70 0, 0, 0, 0, 0,
71 0, 0, 0, 0, 0,
72 0, 0, 0, 0, 0,
73 0, 0, 0, 0, 0,
74 0, 0, 0, 0, 0,
75 0, 0, 0, 0, 6,
76 4, 5, 5, 5, 4})
77
78 -- Top
79
80 ResetTransform()
81 Rotate(X, 90)
82 Translate(-5, 15, -3)
83 DrawTilemap({
84 width = 5,
85 surface = TOP,
86 3, 3, 3, 3, 3,
87 3, 3, 3, 3, 3,
88 3, 3, 3, 3, 3,
89 3, 3, 3, 3, 3,
90 3, 3, 3, 3, 3})
91
92 -- Leftmost background tower block
93 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
94
95 -- Front
96
97 if detail > LOW then
98 ResetTransform()
99 Translate(0, 0, -3)
100 DrawTilemap({
101 width = 7,
102 2, 2, 2, 2, 2, 2, 2,
103 0, 1, 0, 0, 0, 1, 0,
104 0, 1, 0, 0, 0, 1, 0,
105 0, 1, 0, 0, 6, 1, 0,
106 0, 1, 0, 0, 0, 1, 0,
107 0, 1, 0, 0, 0, 1, 0,
108 0, 1, 0, 0, 0, 1, 0,
109 4, 4, 5, 5, 5, 4, 4})
110
111 -- Right side
112
113 ResetTransform()
114 Rotate(Y, 90)
115 Translate(7, 0, -3)
116 DrawTilemap({
117 width = 6,
118 2, 2, 2, 2, 2, 2,
119 0, 1, 0, 0, 1, 0,
120 0, 1, 0, 0, 1, 0,
121 0, 1, 0, 0, 1, 0,
122 0, 1, 0, 0, 1, 0,
123 0, 1, 0, 0, 1, 0,
124 0, 1, 0, 0, 1, 0,
125 4, 4, 4, 4, 4, 4})
126
127 -- Top
128
129 ResetTransform()
130 Rotate(X, 90)
131 Translate(-2, 8, -9)
132 DrawTilemap({
133 width = 9,
134 3, 3, 3, 3, 3, 3, 3, 3, 3,
135 3, 3, 3, 3, 3, 3, 3, 3, 3,
136 3, 3, 3, 3, 3, 3, 3, 3, 3,
137 3, 3, 3, 3, 3, 3, 3, 3, 3,
138 3, 3, 3, 3, 3, 3, 3, 3, 3,
139 3, 3, 3, 3, 3, 3, 3, 3, 3})
140 end
141
142 -- Foreground building with pitched roof
143 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
144
145 -- Left wall
146
147 ResetTransform()
148 Rotate(Y, -90)
149 Translate(10, 0, -2)
150 SetTexture("Building")
151 DrawTilemap({
152 width = 4,
153 surface = LEFT,
154 -1, 9, 11, -1,
155 9, 10, 12, 11,
156 15, 7, 7, 16,
157 3, 5, 6, 4,
158 3, 6, 5, 4})
159
160 -- Right wall
161
162 ResetTransform()
163 Rotate(Y, -90)
164 Translate(13, 0, -2)
165 DrawTilemap({
166 width = 4,
167 surface = RIGHT,
168 -1, 9, 11, -1,
169 9, 10, 12, 11,
170 15, 7, 7, 16,
171 3, 5, 6, 4,
172 3, 8, 5, 4})
173
174 -- Front wall
175
176 ResetTransform()
177 Translate(10, 0, 2)
178 DrawTilemap({
179 width = 3,
180 15, 7, 16,
181 3, 5, 4,
182 3, 6, 4})
183
184 -- Pitched roof
185
186 ResetTransform()
187 Rotate(X, 135)
188 Scale(1, 1.5, 1.5)
189 Translate(10, 5, 0)
190 DrawTilemap({
191 width = 3,
192 13, 13, 13,
193 13, 13, 13})
194
195 -- Finial
196
197 ResetTransform()
198 Translate(10, 5, -0.00001)
199 DrawTilemap({
200 width = 3,
201 18, 18, 18})
202
203 -- Cheaty invisible platform
204 -- This draws nothing but creates a platform on the roof for walking.
205
206 ResetTransform()
207 Rotate(X, 90)
208 Translate(10, 5, 0)
209 DrawTilemap({
210 width = 3,
211 surface = TOP,
212 -1, -1, -1})
213
214 -- The ground
215 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
216
217 -- Courtyard
218
219 ResetTransform()
220 Rotate(X, 90)
221 Translate(-3, 0, -3)
222 SetTexture("Scenery")
223 DrawTilemap({
224 width = 13,
225 surface = TOP,
226 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
227 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
228 -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
229 -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
230 -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
231 -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
232 -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1})
233
234 -- Front grass
235
236 if detail > MEDIUM then
237 ResetTransform()
238 Scale(8, 1, 1)
239 Translate(1, -0.5, 2)
240 DrawTile({
241 2,
242 u_scale = 8})
243
244 -- Back grass
245
246 ResetTransform()
247 Scale(8, 1, 1)
248 Translate(1, -0.5, -2)
249 DrawTile({
250 2,
251 u_scale = 8
252 })
253
254 -- Left grass
255
256 ResetTransform()
257 Scale(4, 1, 1)
258 Rotate(Y, -90)
259 Translate(1, -0.5, -2)
260 DrawTile({
261 2,
262 u_scale = 4
263 })
264
265 -- Right grass
266
267 ResetTransform()
268 Scale(4, 1, 1)
269 Rotate(Y, -90)
270 Translate(9, -0.5, -2)
271 DrawTile({
272 2,
273 u_scale = 4
274 })
275
276 -- Fence behind house
277
278 ResetTransform()
279 Scale(11, 1, 1)
280 Translate(7, 0, -3)
281 DrawTile({
282 4,
283 u_scale = 11
284 })
285 end
286
287 -- Background building with pitched roof
288 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289
290 -- Front wall
291
292 if detail > LOW then
293 ResetTransform()
294 Translate(19, 0, -3)
295 SetTexture("Building")
296 DrawTilemap({
297 width = 4,
298 -1, 9, 11, -1,
299 9, 10, 12, 11,
300 15, 7, 7, 16,
301 3, 6, 5, 4,
302 3, 5, 6, 4,
303 3, 8, 5, 4})
304
305 -- Left wall
306
307 ResetTransform()
308 Rotate(Y, -90)
309 Translate(19, 0, -6)
310 DrawTilemap({
311 width = 3,
312 15, 1, 16,
313 3, 7, 4,
314 3, 5, 4,
315 3, 0, 4})
316
317 -- Right wall
318
319 ResetTransform()
320 Rotate(Y, -90)
321 Translate(23, 0, -6)
322 DrawTilemap({
323 width = 3,
324 15, 0, 16,
325 3, 7, 4,
326 3, 6, 4,
327 3, 2, 4})
328
329 -- Left pitched roof
330
331 ResetTransform()
332 Rotate(X, 135)
333 Scale(1, 1.5, 1.5)
334 Rotate(Y, -90)
335 Translate(21, 6, -6)
336 DrawTilemap({
337 width = 3,
338 13, 13, 13,
339 13, 13, 13})
340
341 -- Right pitched roof
342
343 ResetTransform()
344 Rotate(X, -135)
345 Scale(1, 1.5, 1.5)
346 Rotate(Y, -90)
347 Translate(21, 6, -6)
348 DrawTilemap({
349 width = 3,
350 13, 13, 13,
351 13, 13, 13})
352
353 -- Finial
354
355 ResetTransform()
356 Rotate(Y, -90)
357 Translate(21, 6, -6)
358 DrawTilemap({
359 width = 3,
360 18, 18, 18})
361 end
362
363 -- More ground to the right
364 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
365
366 -- Ground under house
367
368 ResetTransform()
369 Rotate(X, 90)
370 Translate(10, 0, -3)
371 SetTexture("Scenery")
372 DrawTilemap({
373 width = 3,
374 surface = TOP,
375 1, 1, 1,
376 1, 1, 1,
377 -1, -1, -1,
378 -1, -1, -1,
379 -1, -1, -1,
380 -1, -1, -1,
381 1, 1, 1})
382
383 -- Left part of center courtyard
384
385 ResetTransform()
386 Rotate(X, 90)
387 Translate(13, 0, -3)
388 DrawTilemap({
389 width = 8,
390 surface = TOP,
391 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 0, 0, 0, 0, 0, 0, 0,
394 1, 0, 0, 0, 0, 0, 1, 1,
395 0, 0, 0, 0, 0, 0, 1, 1,
396 1, 0, 0, 0, 0, 0, 0, 0,
397 1, 1, 1, 1, 1, 0, 0, 0})
398
399 -- Front grass
400
401 if detail > MEDIUM then
402 ResetTransform()
403 Scale(12, 1, 1)
404 Translate(14, -0.5, 2)
405 DrawTile({
406 2,
407 u_scale = 12
408 })
409
410 -- Back grass
411
412 ResetTransform()
413 Scale(4, 1, 1)
414 Translate(14, -0.5, -2)
415 DrawTile({
416 2,
417 u_scale = 4
418 })
419
420 -- Front grass next to door
421
422 ResetTransform()
423 Translate(13, -0.5, 0)
424 DrawTile({
425 2,
426 u_scale = 1
427 })
428
429 -- Back grass next to door
430
431 ResetTransform()
432 Translate(13, -0.5, -1)
433 DrawTile({
434 2,
435 u_scale = 1
436 })
437
438 -- Left grass
439
440 ResetTransform()
441 Rotate(Y, -90)
442 Translate(14, -0.5, -2)
443 DrawTilemap({
444 width = 4,
445 2, -1, 2, 2})
446
447 -- Grass left of house
448
449 ResetTransform()
450 Rotate(Y, -90)
451 Translate(18, -0.5, -3)
452 DrawTile({
453 2,
454 u_scale = 1
455 })
456
457 -- Grass right of house
458
459 ResetTransform()
460 Rotate(Y, -90)
461 Translate(24, -0.5, -3)
462 DrawTile({
463 2,
464 u_scale = 1
465 })
466
467 -- Front grass in center
468
469 ResetTransform()
470 Scale(4, 1, 1)
471 Translate(19, -0.5, 1)
472 DrawTile({
473 2,
474 u_scale = 4
475 })
476
477 -- Back grass in center
478
479 ResetTransform()
480 Scale(4, 1, 1)
481 Translate(19, -0.5, -1)
482 DrawTile({
483 2,
484 u_scale = 4
485 })
486
487 -- Left grass in center
488
489 ResetTransform()
490 Scale(2, 1, 1)
491 Rotate(Y, -90)
492 Translate(19, -0.5, -1)
493 DrawTile({
494 2,
495 u_scale = 2
496 })
497
498 -- Right grass in center
499
500 ResetTransform()
501 Scale(2, 1, 1)
502 Rotate(Y, -90)
503 Translate(23, -0.5, -1)
504 DrawTile({
505 2,
506 u_scale = 2
507 })
508 end
509
510 -- Right part of center courtyard
511
512 ResetTransform()
513 Rotate(X, 90)
514 Translate(21, 0, -3)
515 DrawTilemap({
516 width = 7,
517 surface = TOP,
518 1, 1, 1, 1, 1, 0, 0,
519 1, 1, 1, 1, 1, 0, 0,
520 0, 0, 0, 0, 0, 0, 0,
521 1, 1, 0, 0, 0, 0, 0,
522 1, 1, 0, 0, 0, 0, 0,
523 0, 0, 0, 0, 0, 0, 0,
524 0, 0, 0, 1, 1, 1, 1})
525
526 -- Fence to right of back house
527
528 if detail > MEDIUM then
529 ResetTransform()
530 Scale(4, 1, 1)
531 Translate(24, 0, -3)
532 DrawTile({
533 4,
534 u_scale = 4
535 })
536
537 -- Grass in front of fence
538
539 ResetTransform()
540 Scale(4, 1, 1)
541 Translate(24, -0.5, -2)
542 DrawTile({
543 2,
544 u_scale = 4
545 })
546
547 -- Grass to left of tower block
548
549 ResetTransform()
550 Scale(2, 1, 1)
551 Rotate(Y, -90)
552 Translate(26, -0.5, 2)
553 DrawTile({
554 2,
555 u_scale = 2
556 })
557
558 -- Grass to right of tower block
559
560 ResetTransform()
561 Scale(2, 1, 1)
562 Rotate(Y, -90)
563 Translate(35, -0.5, 2)
564 DrawTile({
565 2,
566 u_scale = 2
567 })
568
569 -- Next bit of grass
570
571 ResetTransform()
572 Scale(5, 1, 1)
573 Translate(35, -0.5, 2)
574 DrawTile({
575 2,
576 u_scale = 5
577 })
578
579 -- Back grass
580
581 ResetTransform()
582 Scale(6, 1, 1)
583 Translate(34, -0.5, -2)
584 DrawTile({
585 2,
586 u_scale = 6
587 })
588
589 -- Extra bit of back grass
590
591 ResetTransform()
592 Rotate(Y, -90)
593 Translate(34, -0.5, -3)
594 DrawTile({
595 2,
596 u_scale = 1
597 })
598 end
599
600 -- Ground around tower block
601
602 ResetTransform()
603 Rotate(X, 90)
604 Translate(28, 0, 1)
605 DrawTilemap({
606 width = 5,
607 surface = TOP,
608 0, 0, 0, 0, 0,
609 0, 0, 0, 0, 0,
610 0, 0, 0, 0, 0})
611
612 -- Rightmost ground
613
614 ResetTransform()
615 Rotate(X, 90)
616 Translate(33, 0, -3)
617 DrawTilemap({
618 width = 10,
619 surface = TOP,
620 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
621 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
622 0, 0, 0, 0, 0, 0, 0, -1, -1, -1,
623 0, 0, 0, 0, 0, 0, 0, -1, -1, -1,
624 0, 0, 0, 0, 0, 0, 0, -1, -1, -1,
625 0, 0, 0, 0, 0, 0, 0, -1, -1, -1,
626 0, 1, 1, 1, 1, 1, 1, -1, -1, -1})
627
628 -- Right foreground tower block
629 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
630
631 -- Front
632
633 ResetTransform()
634 Translate(28, 0, 1)
635 SetTexture("TowerBlock1")
636 DrawTilemap({
637 width = 5,
638 2, 2, 2, 2, 2,
639 0, 0, 0, 0, 0,
640 0, 0, 0, 0, 6,
641 0, 0, 0, 0, 0,
642 0, 0, 0, 0, 0,
643 0, 0, 0, 6, 0,
644 4, 4, 4, 4, 4})
645
646 -- Right side
647
648 ResetTransform()
649 Rotate(Y, 90)
650 Translate(33, 0, 1)
651 DrawTilemap({
652 width = 6,
653 surface = RIGHT,
654 2, 2, 2, 2, 2, 2,
655 0, 1, 0, 0, 1, 0,
656 0, 1, 0, 0, 1, 0,
657 0, 1, 0, 0, 1, 0,
658 0, 1, 0, 0, 1, 0,
659 0, 1, 0, 0, 1, 0,
660 5, 4, 5, 5, 4, 5})
661
662 -- Left side
663
664 ResetTransform()
665 Rotate(Y, 90)
666 Translate(28, 0, 1)
667 DrawTilemap({
668 width = 6,
669 surface = LEFT,
670 2, 2, 2, 2, 2, 2,
671 0, 1, 6, 0, 1, 0,
672 0, 1, 0, 0, 1, 0,
673 0, 1, 0, 0, 1, 0,
674 0, 1, 0, 0, 1, 0,
675 0, 1, 0, 0, 1, 0,
676 5, 4, 5, 5, 4, 5})
677
678 -- Top
679
680 ResetTransform()
681 Rotate(X, 90)
682 Translate(28, 7, -5)
683 DrawTilemap({
684 width = 5,
685 surface = TOP,
686 3, 3, 3, 3, 3,
687 3, 3, 3, 3, 3,
688 3, 3, 3, 3, 3,
689 3, 3, 3, 3, 3,
690 3, 3, 3, 3, 3,
691 3, 3, 3, 3, 3})
692
693 -- Right end tower block
694 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
695
696 -- Front
697
698 ResetTransform()
699 Translate(40, 0, 2)
700 DrawTilemap({
701 width = 5,
702 2, 2, 2, 2, 2,
703 0, 1, 0, 0, 1,
704 0, 1, 0, 0, 1,
705 0, 1, 0, 0, 1,
706 0, 1, 0, 0, 1,
707 6, 1, 0, 0, 1,
708 0, 1, 0, 0, 1,
709 0, 1, 0, 0, 1,
710 0, 1, 0, 0, 1,
711 0, 1, 0, 0, 1,
712 0, 1, 0, 0, 1,
713 6, 1, 0, 0, 1,
714 0, 1, 0, 0, 1,
715 0, 1, 0, 0, 1,
716 4, 4, 4, 4, 4})
717
718 -- Left side
719
720 ResetTransform()
721 Rotate(Y, 90)
722 Translate(40, 0, 2)
723 DrawTilemap({
724 width = 5,
725 surface = LEFT,
726 2, 2, 2, 2, 2,
727 6, 0, 0, 0, 0,
728 0, 0, 0, 0, 0,
729 0, 0, 0, 0, 0,
730 0, 0, 0, 6, 0,
731 0, 0, 0, 0, 0,
732 0, 0, 0, 0, 0,
733 0, 0, 6, 0, 0,
734 0, 0, 0, 0, 0,
735 0, 0, 0, 0, 0,
736 0, 0, 0, 0, 0,
737 0, 0, 0, 0, 0,
738 0, 0, 0, 0, 0,
739 0, 0, 0, 0, 0,
740 4, 5, 5, 5, 4})
741
742 -- Top
743
744 ResetTransform()
745 Rotate(X, 90)
746 Translate(40, 15, -3)
747 DrawTilemap({
748 width = 5,
749 surface = TOP,
750 3, 3, 3, 3, 3,
751 3, 3, 3, 3, 3,
752 3, 3, 3, 3, 3,
753 3, 3, 3, 3, 3,
754 3, 3, 3, 3, 3})
755
756 -- Background
757 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
758
759 ResetTransform()
760 Translate(-0.32, -0.28, -27)
761 Scale(105, 52, 1)
762 SetTexture("BackgroundFar")
763 DrawTile()
764
765 Translate(0, 0, 5)
766 SetTexture("BackgroundNear")
767 DrawTile({
768 blend = detail > LOW and true or false
769 })
770
771 -- Trees
772 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
773
774 SetTexture("Trees")
775
776 -- Left courtyard
777
778 if detail > LOW then
779 ResetTransform()
780 Scale(3)
781 Translate(7.75, -0.1, -2.5)
782 DrawTile(1)
783 end
784
785 -- Center courtyard
786
787 ResetTransform()
788 Scale(3)
789 Translate(19, -0.1, -0.5)
790 DrawTile(0)
791
792 ResetTransform()
793 Scale(3)
794 Translate(20.25, -0.1, 0.5)
795 DrawTile(1)
796
797 -- Right courtyard
798
799 if detail > LOW then
800 ResetTransform()
801 Scale(3)
802 Translate(34, -0.1, -2.75)
803 DrawTile(1)
804
805 ResetTransform()
806 Scale(3)
807 Translate(36, -0.1, -3.5)
808 DrawTile(0)
809
810 ResetTransform()
811 Scale(3)
812 Translate(37, -0.1, -2.25)
813 DrawTile(1)
814 end
815
816
817
818 -- Functions:
819 -- DisplayText(text, seconds)
820 -- Yield(seconds)
821 -- SpawnItem(what, coords, timeout)
822 -- SpawnRandomItem(coords, timeout)
823 -- SpawnCharacter(what, coords, ai level)
824 -- SpawnHeroine(coords)
825 -- PlaySound(name)
826 -- PlayMusic(name)
827 -- BeginNewWave()
828
829 -- Events:
830 -- Think() is called periodically
831 -- BadGuyDied(enemy)
832 -- HeroineDied(player)
833
834 -- Globals:
835 -- numberOfBadGuys
836
837
838 --do
839 --SpawnHeroine({5, 5})
840 --local waveNum = BeginNewWave()
841 --PopulateScene(waveNum)
842 --end
843
844
845 -- Events
846 ---------
847
848 Event = {}
849
850 function Event:Think()
851 end
852
853 function Event:BadGuyDied(enemy)
854 if numberOfBadGuys == 0 then
855 local waveNum = BeginNewWave()
856 PopulateScene(waveNum)
857 end
858 if math.random() <= 0.2 then
859 SpawnRandomItem(enemy.position)
860 end
861 end
862
863
864 -- Helper functions
865 -------------------
866
867 function PopulateScene(waveNum)
868 -- spawn some robot troopers
869 local numBadGuys = math.random(3, 2 * waveNum)
870 for i = 0, numBadGuys do
871 SpawnCharacter("RobotTrooper", RandomSpawnPlace(), RandomSkillLevel())
872 end
873
874 -- spawn some alien warriors
875 if waveNum >= 10 then
876 numBadGuys = math.random(3, 2 * waveNum)
877 for i = 0, numBadGuys do
878 SpawnCharacter("AlienWarrior", RandomSpawnPlace(), RandomSkillLevel())
879 end
880 end
881
882 -- spawn some jetbots
883 if waveNum >= 20 then
884 numBadGuys = math.random(3, 2 * waveNum)
885 for i = 0, numBadGuys do
886 SpawnCharacter("Jetbot", RandomSpawnPlace(), RandomSkillLevel())
887 end
888 end
889 end
890
891 function RandomSpawnPlace()
892 return {5, 5}
893 end
894
895 function RandomSkillLevel()
896 return "dumb"
897 end
898
899
900 -- vim: ts=4 sw=4 tw=80
901
This page took 0.070322 seconds and 4 git commands to generate.