]> Dogcows Code - chaz/yoink/blobdiff - data/scenes/Classic.lua
big batch of changes
[chaz/yoink] / data / scenes / Classic.lua
index 4cae26a55966de206ca1b1f7f1950c1554e4f55b..963db84f3b7e6f9ec3576be9012b63911b17f3fc 100644 (file)
@@ -6,22 +6,20 @@
 -- Scene API:
 --
 -- Functions:
--- SetPlayfieldBounds(point1, point2)
--- SetMaximumBounds(point1, point2)
+-- SetBounds(point1, point2)
 -- ResetTransform()
 -- Translate(x, y, z)
 -- Scale(x, y, z) or Scale(xyz)
 -- Rotate(axis, degree) or Rotate(x, y, z)
 -- SetTexture(name)
--- MakeTilemap({width = ..., surface_type = ..., tiles = {}})
--- MakeBillboard({tile = ..., u_scale = ...})
+-- DrawTilemap({width = $num, [surface = TOP | LEFT | RIGHT], tiles})
+-- DrawTile(tile, [u_scale])
 --
 -- Globals:
--- detail - level of detail of the scene
+-- detail - level of detail of the scene (HIGH, MEDIUM, or LOW)
 
 
-SetPlayfieldBounds({0, 0, -100}, {1280, 500, 100})
-SetMaximumBounds({-160, 0, -192}, {1440, 480, 224})
+SetBounds({-5, 0, -6}, {45, 15, 7})
 
 
 -- Left end tower block
@@ -31,134 +29,110 @@ SetMaximumBounds({-160, 0, -192}, {1440, 480, 224})
 
 ResetTransform()
 Translate(-5, 0, 5)
-Scale(32)
 SetTexture("TowerBlock1")
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       tiles = {
-               2,      2,      2,      2,      2,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               1,      0,      0,      1,      0,
-               4,      4,      4,      4,      4
-       }
-})
+       2,      2,      2,      2,      2,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       1,      0,      0,      1,      0,
+       4,      4,      4,      4,      4})
 
 -- Right side
 
 ResetTransform()
 Rotate(Y, 90)
 Translate(0, 0, 5)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = RIGHT,
-       tiles = {
-               2,      2,      2,      2,      2,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      6,
-               4,      5,      5,      5,      4
-       }
-})
+       surface = RIGHT,
+       2,      2,      2,      2,      2,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      6,
+       4,      5,      5,      5,      4})
                
 -- Top
 
 ResetTransform()
 Rotate(X, 90)
 Translate(-5, 15, 0)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = TOP,
-       tiles = {
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3
-       }
-})
+       surface = TOP,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3})
 
 -- Leftmost background tower block
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                
 -- Front
 
-if detail > 1 then
+if detail > LOW then
        ResetTransform()
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 7,
-               tiles = {
-                       2,      2,      2,      2,      2,      2,      2,
-                       0,      1,      0,      0,      0,      1,      0,
-                       0,      1,      0,      0,      0,      1,      0,
-                       0,      1,      0,      0,      6,      1,      0,
-                       0,      1,      0,      0,      0,      1,      0,
-                       0,      1,      0,      0,      0,      1,      0,
-                       0,      1,      0,      0,      0,      1,      0,
-                       4,      4,      5,      5,      5,      4,      4
-               }
-       })
+               2,      2,      2,      2,      2,      2,      2,
+               0,      1,      0,      0,      0,      1,      0,
+               0,      1,      0,      0,      0,      1,      0,
+               0,      1,      0,      0,      6,      1,      0,
+               0,      1,      0,      0,      0,      1,      0,
+               0,      1,      0,      0,      0,      1,      0,
+               0,      1,      0,      0,      0,      1,      0,
+               4,      4,      5,      5,      5,      4,      4})
 
        -- Right side
 
        ResetTransform()
        Rotate(Y, 90)
        Translate(7, 0, 0)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 6,
-               tiles = {
-                       2,      2,      2,      2,      2,      2,
-                       0,      1,      0,      0,      1,      0,
-                       0,      1,      0,      0,      1,      0,
-                       0,      1,      0,      0,      1,      0,
-                       0,      1,      0,      0,      1,      0,
-                       0,      1,      0,      0,      1,      0,
-                       0,      1,      0,      0,      1,      0,
-                       4,      4,      4,      4,      4,      4
-               }
-       })
+               2,      2,      2,      2,      2,      2,
+               0,      1,      0,      0,      1,      0,
+               0,      1,      0,      0,      1,      0,
+               0,      1,      0,      0,      1,      0,
+               0,      1,      0,      0,      1,      0,
+               0,      1,      0,      0,      1,      0,
+               0,      1,      0,      0,      1,      0,
+               4,      4,      4,      4,      4,      4})
 
        -- Top
 
        ResetTransform()
        Rotate(X, 90)
        Translate(-2, 8, -6)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 9,
-               tiles = {
-                       3,      3,      3,      3,      3,      3,      3,      3,      3,
-                       3,      3,      3,      3,      3,      3,      3,      3,      3,
-                       3,      3,      3,      3,      3,      3,      3,      3,      3,
-                       3,      3,      3,      3,      3,      3,      3,      3,      3,
-                       3,      3,      3,      3,      3,      3,      3,      3,      3,
-                       3,      3,      3,      3,      3,      3,      3,      3,      3
-               }
-       })
+               3,      3,      3,      3,      3,      3,      3,      3,      3,
+               3,      3,      3,      3,      3,      3,      3,      3,      3,
+               3,      3,      3,      3,      3,      3,      3,      3,      3,
+               3,      3,      3,      3,      3,      3,      3,      3,      3,
+               3,      3,      3,      3,      3,      3,      3,      3,      3,
+               3,      3,      3,      3,      3,      3,      3,      3,      3})
 end
 
 -- Foreground building with pitched roof
@@ -169,51 +143,39 @@ end
 ResetTransform()
 Rotate(Y, -90)
 Translate(10, 0, 1)
-Scale(32)
 SetTexture("Building")
-MakeTilemap({
+DrawTilemap({
        width = 4,
-       surface_type = LEFT,
-       tiles = {
-               -1,     9,      11,     -1,
-               9,      10,     12,     11,
-               15,     7,      7,      16,
-               3,      5,      6,      4,
-               3,      6,      5,      4
-       }
-})
+       surface = LEFT,
+       -1,     9,      11,     -1,
+       9,      10,     12,     11,
+       15,     7,      7,      16,
+       3,      5,      6,      4,
+       3,      6,      5,      4})
 
 -- Right wall
 
 ResetTransform()
 Rotate(Y, -90)
 Translate(13, 0, 1)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 4,
-       surface_type = RIGHT,
-       tiles = {
-               -1,     9,      11,     -1,
-               9,      10,     12,     11,
-               15,     7,      7,      16,
-               3,      5,      6,      4,
-               3,      8,      5,      4
-       }
-})
+       surface = RIGHT,
+       -1,     9,      11,     -1,
+       9,      10,     12,     11,
+       15,     7,      7,      16,
+       3,      5,      6,      4,
+       3,      8,      5,      4})
 
 -- Front wall
 
 ResetTransform()
 Translate(10, 0, 5)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 3,
-       tiles = {
-               15,     7,      16,
-               3,      5,      4,
-               3,      6,      4
-       }
-})
+       15,     7,      16,
+       3,      5,      4,
+       3,      6,      4})
                
 -- Pitched roof
 
@@ -221,39 +183,27 @@ ResetTransform()
 Rotate(X, 135)
 Scale(1, 1.5, 1.5)
 Translate(10, 5, 3)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 3,
-       tiles = {
-               13,     13,     13,
-               13,     13,     13
-       }
-})
+       13,     13,     13,
+       13,     13,     13})
 
 -- Finial
 
 ResetTransform()
 Translate(10, 5, 3)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 3,
-       tiles = {
-               18,     18,     18
-       }
-})
+       18,     18,     18})
 
 -- Cheaty invisible platform
 
 ResetTransform()
 Translate(10, 4, 3)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 3,
-       surface_type = TOP,
-       tiles = {
-               -1,     -1,     -1
-       }
-})
+       surface = TOP,
+       -1,     -1,     -1})
 
 -- The ground
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -263,42 +213,35 @@ MakeTilemap({
 ResetTransform()
 Rotate(X, 90)
 Translate(-3, 0, 0)
-Scale(32)
 SetTexture("Scenery")
-MakeTilemap({
+DrawTilemap({
        width = 13,
-       surface_type = TOP,
-       tiles = {
-               1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,
-               1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,
-               -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
-               -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
-               -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
-               -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
-               -1,     -1,     -1,     1,      1,      1,      1,      1,      1,      1,      1,      1,      1
-       }
-})
+       surface = TOP,
+       1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,
+       1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,      1,
+       -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
+       -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
+       -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
+       -1,     -1,     -1,     1,      0,      0,      0,      0,      0,      0,      0,      0,      1,
+       -1,     -1,     -1,     1,      1,      1,      1,      1,      1,      1,      1,      1,      1})
 
 -- Front grass
 
-if detail > 2 then
+if detail > MEDIUM then
        ResetTransform()
        Scale(8, 1, 1)
        Translate(1, -0.5, 5)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
-               u_scale = 8
-       })
+       DrawTile({
+               2,
+               u_scale = 8})
 
        -- Back grass
 
        ResetTransform()
        Scale(8, 1, 1)
        Translate(1, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 8
        })
 
@@ -308,9 +251,8 @@ if detail > 2 then
        Scale(4, 1, 1)
        Rotate(Y, -90)
        Translate(1, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
 
@@ -320,9 +262,8 @@ if detail > 2 then
        Scale(4, 1, 1)
        Rotate(Y, -90)
        Translate(9, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
 
@@ -331,9 +272,8 @@ if detail > 2 then
        ResetTransform()
        Scale(11, 1, 1)
        Translate(7, 0, 0)
-       Scale(32)
-       MakeBillboard({
-               tile = 4,
+       DrawTile({
+               4,
                u_scale = 11
        })
 end
@@ -343,54 +283,42 @@ end
                
 -- Front wall
 
-if detail > 1 then
+if detail > LOW then
        ResetTransform()
        Translate(19, 0, 0)
-       Scale(32)
        SetTexture("Building")
-       MakeTilemap({
+       DrawTilemap({
                width = 4,
-               tiles = {
-                       -1,     9,      11,     -1,
-                       9,      10,     12,     11,
-                       15,     7,      7,      16,
-                       3,      6,      5,      4,
-                       3,      5,      6,      4,
-                       3,      8,      5,      4
-               }
-       })
+               -1,     9,      11,     -1,
+               9,      10,     12,     11,
+               15,     7,      7,      16,
+               3,      6,      5,      4,
+               3,      5,      6,      4,
+               3,      8,      5,      4})
 
        -- Left wall
 
        ResetTransform()
        Rotate(Y, -90)
        Translate(19, 0, -3)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 3,
-               tiles = {
-                       15,     1,      16,
-                       3,      7,      4,
-                       3,      5,      4,
-                       3,      0,      4
-               }
-       })
+               15,     1,      16,
+               3,      7,      4,
+               3,      5,      4,
+               3,      0,      4})
 
        -- Right wall
 
        ResetTransform()
        Rotate(Y, -90)
        Translate(23, 0, -3)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 3,
-               tiles = {
-                       15,     0,      16,
-                       3,      7,      4,
-                       3,      6,      4,
-                       3,      2,      4
-               }
-       })
+               15,     0,      16,
+               3,      7,      4,
+               3,      6,      4,
+               3,      2,      4})
 
        -- Left pitched roof
 
@@ -399,14 +327,10 @@ if detail > 1 then
        Scale(1, 1.5, 1.5)
        Rotate(Y, -90)
        Translate(21, 6, -3)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 3,
-               tiles = {
-                       13,     13,     13,
-                       13,     13,     13
-               }
-       })
+               13,     13,     13,
+               13,     13,     13})
 
        -- Right pitched roof
 
@@ -415,27 +339,19 @@ if detail > 1 then
        Scale(1, 1.5, 1.5)
        Rotate(Y, -90)
        Translate(21, 6, -3)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 3,
-               tiles = {
-                       13,     13,     13,
-                       13,     13,     13
-               }
-       })
+               13,     13,     13,
+               13,     13,     13})
 
        -- Finial
 
        ResetTransform()
        Rotate(Y, -90)
        Translate(21, 6, -3)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 3,
-               tiles = {
-                       18,     18,     18
-               }
-       })
+               18,     18,     18})
 end
 
 -- More ground to the right
@@ -446,51 +362,42 @@ end
 ResetTransform()
 Rotate(X, 90)
 Translate(10, 0, 0)
-Scale(32)
 SetTexture("Scenery")
-MakeTilemap({
+DrawTilemap({
        width = 3,
-       surface_type = TOP,
-       tiles = {
-               1,      1,      1,
-               1,      1,      1,
-               -1,     -1,     -1,
-               -1,     -1,     -1,
-               -1,     -1,     -1,
-               -1,     -1,     -1,
-               1,      1,      1
-       }
-})
+       surface = TOP,
+       1,      1,      1,
+       1,      1,      1,
+       -1,     -1,     -1,
+       -1,     -1,     -1,
+       -1,     -1,     -1,
+       -1,     -1,     -1,
+       1,      1,      1})
 
 -- Left part of center courtyard
 
 ResetTransform()
 Rotate(X, 90)
 Translate(13, 0, 0)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 8,
-       surface_type = TOP,
-       tiles = {
-               1,      1,      1,      1,      1,      1,      1,      1,
-               1,      1,      1,      1,      1,      1,      1,      1,
-               1,      0,      0,      0,      0,      0,      0,      0,
-               1,      0,      0,      0,      0,      0,      1,      1,
-               0,      0,      0,      0,      0,      0,      1,      1,
-               1,      0,      0,      0,      0,      0,      0,      0,
-               1,      1,      1,      1,      1,      0,      0,      0
-       }
-})
+       surface = TOP,
+       1,      1,      1,      1,      1,      1,      1,      1,
+       1,      1,      1,      1,      1,      1,      1,      1,
+       1,      0,      0,      0,      0,      0,      0,      0,
+       1,      0,      0,      0,      0,      0,      1,      1,
+       0,      0,      0,      0,      0,      0,      1,      1,
+       1,      0,      0,      0,      0,      0,      0,      0,
+       1,      1,      1,      1,      1,      0,      0,      0})
 
 -- Front grass
 
-if detail > 2 then
+if detail > MEDIUM then
        ResetTransform()
        Scale(12, 1, 1)
        Translate(14, -0.5, 5)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 12
        })
 
@@ -499,9 +406,8 @@ if detail > 2 then
        ResetTransform()
        Scale(4, 1, 1)
        Translate(14, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
 
@@ -509,9 +415,8 @@ if detail > 2 then
 
        ResetTransform()
        Translate(13, -0.5, 3)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 1
        })
 
@@ -519,9 +424,8 @@ if detail > 2 then
 
        ResetTransform()
        Translate(13, -0.5, 2)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 1
        })
 
@@ -530,22 +434,17 @@ if detail > 2 then
        ResetTransform()
        Rotate(Y, -90)
        Translate(14, -0.5, 1)
-       Scale(32)
-       MakeTilemap({
+       DrawTilemap({
                width = 4,
-               tiles = {
-                       2,      -1,     2,      2
-               }
-       })
+               2,      -1,     2,      2})
 
        -- Grass left of house
 
        ResetTransform()
        Rotate(Y, -90)
        Translate(18, -0.5, 0)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 1
        })
 
@@ -554,9 +453,8 @@ if detail > 2 then
        ResetTransform()
        Rotate(Y, -90)
        Translate(24, -0.5, 0)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 1
        })
 
@@ -565,9 +463,8 @@ if detail > 2 then
        ResetTransform()
        Scale(4, 1, 1)
        Translate(19, -0.5, 4)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
 
@@ -576,9 +473,8 @@ if detail > 2 then
        ResetTransform()
        Scale(4, 1, 1)
        Translate(19, -0.5, 2)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
 
@@ -588,9 +484,8 @@ if detail > 2 then
        Scale(2, 1, 1)
        Rotate(Y, -90)
        Translate(19, -0.5, 2)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 2
        })
 
@@ -600,9 +495,8 @@ if detail > 2 then
        Scale(2, 1, 1)
        Rotate(Y, -90)
        Translate(23, -0.5, 2)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 2
        })
 end
@@ -612,30 +506,25 @@ end
 ResetTransform()
 Rotate(X, 90)
 Translate(21, 0, 0)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 7,
-       surface_type = TOP,
-       tiles = {
-               1,      1,      1,      1,      1,      0,      0,
-               1,      1,      1,      1,      1,      0,      0,
-               0,      0,      0,      0,      0,      0,      0,
-               1,      1,      0,      0,      0,      0,      0,
-               1,      1,      0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,      0,      0,
-               0,      0,      0,      1,      1,      1,      1
-       }
-})
+       surface = TOP,
+       1,      1,      1,      1,      1,      0,      0,
+       1,      1,      1,      1,      1,      0,      0,
+       0,      0,      0,      0,      0,      0,      0,
+       1,      1,      0,      0,      0,      0,      0,
+       1,      1,      0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,      0,      0,
+       0,      0,      0,      1,      1,      1,      1})
 
 -- Fence to right of back house
 
-if detail > 2 then
+if detail > MEDIUM then
        ResetTransform()
        Scale(4, 1, 1)
        Translate(24, 0, 0)
-       Scale(32)
-       MakeBillboard({
-               tile = 4,
+       DrawTile({
+               4,
                u_scale = 4
        })
 
@@ -644,9 +533,8 @@ if detail > 2 then
        ResetTransform()
        Scale(4, 1, 1)
        Translate(24, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 4
        })
                        
@@ -656,9 +544,8 @@ if detail > 2 then
        Scale(2, 1, 1)
        Rotate(Y, -90)
        Translate(26, -0.5, 5)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 2
        })
 
@@ -668,9 +555,8 @@ if detail > 2 then
        Scale(2, 1, 1)
        Rotate(Y, -90)
        Translate(35, -0.5, 5)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 2
        })
 
@@ -679,9 +565,8 @@ if detail > 2 then
        ResetTransform()
        Scale(5, 1, 1)
        Translate(35, -0.5, 5)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 5
        })
 
@@ -690,9 +575,8 @@ if detail > 2 then
        ResetTransform()
        Scale(6, 1, 1)
        Translate(34, -0.5, 1)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 6
        })
 
@@ -701,9 +585,8 @@ if detail > 2 then
        ResetTransform()
        Rotate(Y, -90)
        Translate(34, -0.5, 0)
-       Scale(32)
-       MakeBillboard({
-               tile = 2,
+       DrawTile({
+               2,
                u_scale = 1
        })
 end
@@ -713,36 +596,28 @@ end
 ResetTransform()
 Rotate(X, 90)
 Translate(28, 0, 4)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = TOP,
-       tiles = {
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0
-       }
-})
+       surface = TOP,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0})
 
 -- Rightmost ground
 
 ResetTransform()
 Rotate(X, 90)
 Translate(33, 0, 0)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 10,
-       surface_type = TOP,
-       tiles = {
-               0,      0,      1,      1,      1,      1,      1,      1,      1,      1,
-               0,      0,      1,      1,      1,      1,      1,      1,      1,      1,
-               0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
-               0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
-               0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
-               0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
-               0,      1,      1,      1,      1,      1,      1,      -1,     -1,     -1
-       }
-})
+       surface = TOP,
+       0,      0,      1,      1,      1,      1,      1,      1,      1,      1,
+       0,      0,      1,      1,      1,      1,      1,      1,      1,      1,
+       0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
+       0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
+       0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
+       0,      0,      0,      0,      0,      0,      0,      -1,     -1,     -1,
+       0,      1,      1,      1,      1,      1,      1,      -1,     -1,     -1})
 
 -- Right foreground tower block
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -751,79 +626,63 @@ MakeTilemap({
 
 ResetTransform()
 Translate(28, 0, 4)
-Scale(32)
 SetTexture("TowerBlock1")
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       tiles = {
-               2,      2,      2,      2,      2,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      6,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      6,      0,
-               4,      4,      4,      4,      4
-       }
-})
+       2,      2,      2,      2,      2,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      6,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      6,      0,
+       4,      4,      4,      4,      4})
 
 -- Right side
 
 ResetTransform()
 Rotate(Y, 90)
 Translate(33, 0, 4)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 6,
-       surface_type = RIGHT,
-       tiles = {
-               2,      2,      2,      2,      2,      2,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               5,      4,      5,      5,      4,      5
-       }
-})
+       surface = RIGHT,
+       2,      2,      2,      2,      2,      2,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       5,      4,      5,      5,      4,      5})
 
 -- Left side
 
 ResetTransform()
 Rotate(Y, 90)
 Translate(28, 0, 4)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 6,
-       surface_type = LEFT,
-       tiles = {
-               2,      2,      2,      2,      2,      2,
-               0,      1,      6,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               0,      1,      0,      0,      1,      0,
-               5,      4,      5,      5,      4,      5
-       }
-})
+       surface = LEFT,
+       2,      2,      2,      2,      2,      2,
+       0,      1,      6,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       0,      1,      0,      0,      1,      0,
+       5,      4,      5,      5,      4,      5})
 
 -- Top
 
 ResetTransform()
 Rotate(X, 90)
 Translate(28, 7, -2)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = TOP,
-       tiles = {
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3
-       }
-})
+       surface = TOP,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3})
 
 -- Right end tower block
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -832,87 +691,75 @@ MakeTilemap({
 
 ResetTransform()
 Translate(40, 0, 5)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       tiles = {
-               2,      2,      2,      2,      2,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               6,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               6,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               0,      1,      0,      0,      1,
-               4,      4,      4,      4,      4
-       }
-})
+       2,      2,      2,      2,      2,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       6,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       6,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       0,      1,      0,      0,      1,
+       4,      4,      4,      4,      4})
 
 -- Left side
 
 ResetTransform()
 Rotate(Y, 90)
 Translate(40, 0, 5)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = LEFT,
-       tiles = {
-               2,      2,      2,      2,      2,
-               6,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      6,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      6,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               0,      0,      0,      0,      0,
-               4,      5,      5,      5,      4
-       }
-})
+       surface = LEFT,
+       2,      2,      2,      2,      2,
+       6,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      6,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      6,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       0,      0,      0,      0,      0,
+       4,      5,      5,      5,      4})
 
 -- Top
 
 ResetTransform()
 Rotate(X, 90)
 Translate(40, 15, 0)
-Scale(32)
-MakeTilemap({
+DrawTilemap({
        width = 5,
-       surface_type = TOP,
-       tiles = {
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3,
-               3,      3,      3,      3,      3
-       }
-})
+       surface = TOP,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3,
+       3,      3,      3,      3,      3})
 
 -- Background
 -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 ResetTransform()
-Translate(-0.3, -0.17, -900)
-Scale(3200, 1600, 1)
+Translate(-0.3, -0.17, -28)
+Scale(100, 50, 1)
 SetTexture("BackgroundFar")
-MakeBillboard()
+DrawTile()
 
-Translate(0, 0, 300)
+Translate(0, 0, 5)
 SetTexture("BackgroundNear")
-MakeBillboard({
-       blend = detail > 1 and true or false
+DrawTile({
+       blend = detail > LOW and true or false
 })
 
 -- Trees
@@ -922,53 +769,126 @@ SetTexture("Trees")
 
 -- Left courtyard
 
-if detail > 1 then
+if detail > LOW then
        ResetTransform()
-       Scale(96)
-       Translate(250, -2.5, 16)
-       MakeBillboard({
-               tile = 1
-       })
+       Scale(3)
+       Translate(7.75, -0.1, 0.5)
+       DrawTile(1)
 end
 
 -- Center courtyard
 
 ResetTransform()
-Scale(96)
-Translate(610, -2.5, 85)
-MakeBillboard({
-       tile = 0
-})
+--Translate(610, -2.5, 85)
+Scale(3)
+Translate(19, -0.1, 2.5)
+DrawTile(0)
 
 ResetTransform()
-Scale(96)
-Translate(650, -2.5, 115)
-MakeBillboard({
-       tile = 1
-})
+Scale(3)
+Translate(20.25, -0.1, 3.5)
+DrawTile(1)
 
 -- Right courtyard
 
-if detail > 1 then
+if detail > LOW then
        ResetTransform()
-       Scale(96)
-       Translate(1080, -2.5, 10)
-       MakeBillboard({
-               tile = 1
-       })
+       Scale(3)
+       Translate(34, -0.1, 0.25)
+       DrawTile(1)
 
        ResetTransform()
-       Scale(96)
-       Translate(1120, -2.5, -15)
-       MakeBillboard({
-               tile = 0
-       })
+       Scale(3)
+       Translate(36, -0.1, -0.5)
+       DrawTile(0)
 
        ResetTransform()
-       Scale(96)
-       Translate(1220, -2.5, -30)
-       MakeBillboard({
-               tile = 1
-       })
+       Scale(3)
+       Translate(37, -0.1, 0.75)
+       DrawTile(1)
+end
+
+
+
+function GetZCoord(x, y)
+       return 3
+end
+
+
+-- Functions:
+-- DisplayText(text, seconds)
+-- Yield(seconds)
+-- SpawnItem(what, coords, timeout)
+-- SpawnRandomItem(coords, timeout)
+-- SpawnCharacter(what, coords, ai level)
+-- SpawnHeroine(coords)
+-- PlaySound(name)
+-- PlayMusic(name)
+-- BeginNewWave()
+
+-- Events:
+-- BadGuyDied(enemy)
+-- PlayedDied(player)
+-- SceneLoaded()
+
+-- Globals:
+-- numberOfBadGuys
+
+
+-- Events
+---------
+
+Event = {}
+
+function Event:SceneLoaded()
+       SpawnHeroine({500, 500})
+       local waveNum = BeginNewWave()
+       PopulateScene(waveNum)
+end
+
+function Event:BadGuyDied(enemy)
+       if numberOfBadGuys == 0 then
+               local waveNum = BeginNewWave()
+               PopulateScene(waveNum)
+       end
+       if math.random() <= 0.2 then
+               SpawnRandomItem(enemy.position)
+       end
+end
+
+
+-- Helper functions
+-------------------
+
+function PopulateScene(waveNum)
+       -- spawn some robot troopers
+       local numBadGuys = math.random(3, 2 * waveNum)
+       for i = 0, numBadGuys do
+               SpawnCharacter("RobotTrooper", RandomSpawnPlace(), RandomSkillLevel())
+       end
+
+       -- spawn some alien warriors
+       if waveNum >= 10 then
+               numBadGuys = math.random(3, 2 * waveNum)
+               for i = 0, numBadGuys do
+                       SpawnCharacter("AlienWarrior", RandomSpawnPlace(), RandomSkillLevel())
+               end
+       end
+
+       -- spawn some jetbots
+       if waveNum >= 20 then
+               numBadGuys = math.random(3, 2 * waveNum)
+               for i = 0, numBadGuys do
+                       SpawnCharacter("Jetbot", RandomSpawnPlace(), RandomSkillLevel())
+               end
+       end
+end
+
+function RandomSpawnPlace()
+       return {500, 500}
+end
+
+function RandomSkillLevel()
+       return "dumb"
 end
 
This page took 0.048494 seconds and 4 git commands to generate.