]>
Dogcows Code - chaz/yoink/blob - data/scenes/Classic.lua
fb4765fc1e30fbca4136a04c91a8dd7bc61b0e4b
4 "Created by Neil Carter",
5 "Converted to Lua by Charles McGarvey",
11 -- SetBounds(point1, point2)
14 -- Scale(x, y, z) or Scale(xyz)
15 -- Rotate(axis, degree) or Rotate(x, y, z)
17 -- DrawTilemap({width = $num, [surface = TOP | LEFT | RIGHT], tiles})
18 -- DrawTile(tile, [u_scale])
21 -- detail - level of detail of the scene (HIGH, MEDIUM, or LOW)
24 SetBounds({-5, 0, -6}, {45, 15, 7})
27 -- Left end tower block
28 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34 SetTexture("TowerBlock1")
91 -- Leftmost background tower block
92 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
108 4, 4, 5, 5, 5, 4, 4})
133 3, 3, 3, 3, 3, 3, 3, 3, 3,
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})
141 -- Foreground building with pitched roof
142 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149 SetTexture("Building")
197 Translate(10, 5, -0.00001)
202 -- Cheaty invisible platform
203 -- This draws nothing but creates a platform on the roof for walking.
214 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221 SetTexture("Scenery")
225 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
226 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
227 -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1})
235 if detail
> MEDIUM
then
238 Translate(1, -0.5, 2)
247 Translate(1, -0.5, -2)
258 Translate(1, -0.5, -2)
269 Translate(9, -0.5, -2)
275 -- Fence behind house
286 -- Background building with pitched roof
287 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
294 SetTexture("Building")
340 -- Right pitched roof
362 -- More ground to the right
363 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
365 -- Ground under house
370 SetTexture("Scenery")
382 -- Left part of center courtyard
390 1, 1, 1, 1, 1, 1, 1, 1,
391 1, 1, 1, 1, 1, 1, 1, 1,
392 1, 0, 0, 0, 0, 0, 0, 0,
393 1, 0, 0, 0, 0, 0, 1, 1,
394 0, 0, 0, 0, 0, 0, 1, 1,
395 1, 0, 0, 0, 0, 0, 0, 0,
396 1, 1, 1, 1, 1, 0, 0, 0})
400 if detail
> MEDIUM
then
403 Translate(14, -0.5, 2)
413 Translate(14, -0.5, -2)
419 -- Front grass next to door
422 Translate(13, -0.5, 0)
428 -- Back grass next to door
431 Translate(13, -0.5, -1)
441 Translate(14, -0.5, -2)
446 -- Grass left of house
450 Translate(18, -0.5, -3)
456 -- Grass right of house
460 Translate(24, -0.5, -3)
466 -- Front grass in center
470 Translate(19, -0.5, 1)
476 -- Back grass in center
480 Translate(19, -0.5, -1)
486 -- Left grass in center
491 Translate(19, -0.5, -1)
497 -- Right grass in center
502 Translate(23, -0.5, -1)
509 -- Right part of center courtyard
523 0, 0, 0, 1, 1, 1, 1})
525 -- Fence to right of back house
527 if detail
> MEDIUM
then
536 -- Grass in front of fence
540 Translate(24, -0.5, -2)
546 -- Grass to left of tower block
551 Translate(26, -0.5, 2)
557 -- Grass to right of tower block
562 Translate(35, -0.5, 2)
572 Translate(35, -0.5, 2)
582 Translate(34, -0.5, -2)
588 -- Extra bit of back grass
592 Translate(34, -0.5, -3)
599 -- Ground around tower block
619 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
620 0, 0, 1, 1, 1, 1, 1, 1, 1, 1,
621 0, 0, 0, 0, 0, 0, 0, -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, 1, 1, 1, 1, 1, 1, -1, -1, -1})
627 -- Right foreground tower block
628 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
634 SetTexture("TowerBlock1")
692 -- Right end tower block
693 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
745 Translate(40, 15, -3)
756 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
759 Translate(-0.3, -0.3, -35)
761 SetTexture("BackgroundFar")
765 SetTexture("BackgroundNear")
767 blend
= detail
> LOW
and true or false
771 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
780 Translate(7.75, -0.1, -2.5)
788 Translate(19, -0.1, -0.5)
793 Translate(20.25, -0.1, 0.5)
801 Translate(34, -0.1, -2.75)
806 Translate(36, -0.1, -3.5)
811 Translate(37, -0.1, -2.25)
818 -- DisplayText(text, seconds)
820 -- SpawnItem(what, coords, timeout)
821 -- SpawnRandomItem(coords, timeout)
822 -- SpawnCharacter(what, coords, ai level)
823 -- SpawnHeroine(coords)
829 -- Think() is called periodically
831 -- HeroineDied(player)
838 --SpawnHeroine({5, 5})
839 --local waveNum = BeginNewWave()
840 --PopulateScene(waveNum)
849 function Event
:Think()
852 function Event
:BadGuyDied(enemy
)
853 if numberOfBadGuys
== 0 then
854 local waveNum
= BeginNewWave()
855 PopulateScene(waveNum
)
857 if math
.random() <= 0.2 then
858 SpawnRandomItem(enemy
.position
)
866 function PopulateScene(waveNum
)
867 -- spawn some robot troopers
868 local numBadGuys
= math
.random(3, 2 * waveNum
)
869 for i
= 0, numBadGuys
do
870 SpawnCharacter("RobotTrooper", RandomSpawnPlace(), RandomSkillLevel())
873 -- spawn some alien warriors
874 if waveNum
>= 10 then
875 numBadGuys
= math
.random(3, 2 * waveNum
)
876 for i
= 0, numBadGuys
do
877 SpawnCharacter("AlienWarrior", RandomSpawnPlace(), RandomSkillLevel())
881 -- spawn some jetbots
882 if waveNum
>= 20 then
883 numBadGuys
= math
.random(3, 2 * waveNum
)
884 for i
= 0, numBadGuys
do
885 SpawnCharacter("Jetbot", RandomSpawnPlace(), RandomSkillLevel())
890 function RandomSpawnPlace()
894 function RandomSkillLevel()
899 -- vim: ts=4 sw=4 tw=80
This page took 0.08207 seconds and 4 git commands to generate.