home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / nat11.lua < prev    next >
Text File  |  2003-03-28  |  4KB  |  123 lines

  1. -- Time is Money
  2. -- A level for Enigma
  3. -- 
  4. -- Copyright (c) 2003 Nat Pryce
  5. -- Licensed under the GPL, v2.0 or greater
  6.  
  7.  
  8. function floor( floor_type, attribs )
  9.     return function( x, y )
  10.         set_floor( %floor_type, x, y, %attribs or {} )
  11.     end
  12. end
  13.  
  14. function stone( stone_type, attribs )
  15.     return function( x, y )
  16.         set_stone( %stone_type, x, y, %attribs or {} )
  17.     end
  18. end
  19.  
  20. function item( item_type, attribs )
  21.     return function( x, y )
  22.         set_item( %item_type, x, y, %attribs or {} )
  23.     end
  24. end
  25.  
  26. function actor( actor_type, attribs )
  27.     return function( x, y )
  28.         set_actor( %actor_type, x+0.5, y+0.5, %attribs
  29. or {} )
  30.     end
  31. end
  32.  
  33. function gradient( gradient_type )
  34.     return function( x, y )
  35.         set_floor( "fl-gradient", x, y, {type=%gradient_type} )
  36.     end
  37. end
  38.  
  39. function create_world_from_map( tiles, map )
  40.     create_world( strlen(map[1]), getn(map) )
  41.     
  42.     for y,line in map do
  43.         for x = 1,strlen(line) do
  44.             local tile = strchar(strbyte(line,x))
  45.             local constructors = tiles[tile]
  46.             
  47.             if constructors then
  48.                 for i,constructor in constructors do
  49.                     constructor(x-1,y-1)
  50.                 end
  51.             else
  52.                 error("invalid tile identifier " ..
  53. tile )
  54.             end
  55.         end
  56.     end
  57. end
  58.  
  59. default_floor = floor("fl-normal")
  60.  
  61.  
  62. oxyd_default_flavor = "b"
  63.  
  64. tiles = {
  65.     [" "] = { abyss },
  66.     ["S"] = { floor("fl-normal") },
  67.     ["W"] = { gradient(SLOPE_S) },
  68.     ["X"] = { gradient(SLOPE_N) },
  69.     ["A"] = { gradient(SLOPE_E) },
  70.     ["D"] = { gradient(SLOPE_W) },
  71.     ["Q"] = { gradient(SLOPE_LARGE_SE) },
  72.     ["Z"] = { gradient(SLOPE_LARGE_NE) },
  73.     ["E"] = { gradient(SLOPE_LARGE_SW) },
  74.     ["C"] = { gradient(SLOPE_LARGE_NW) },
  75.     ["q"] = { gradient(SLOPE_SMALL_SE) },
  76.     ["z"] = { gradient(SLOPE_SMALL_NE) },
  77.     ["e"] = { gradient(SLOPE_SMALL_SW) },
  78.     ["c"] = { gradient(SLOPE_SMALL_NW) },
  79.     ["o"] = { default_floor, 
  80.               actor("ac-blackball",{player=0}) },
  81.     ["#"] = { default_floor, 
  82.               stone("st-rock1") },
  83.     ["="] = { default_floor, 
  84.               stone("st-coinslot",
  85.               {target="laser",action="onoff"})},
  86.     ["$"] = { default_floor,
  87.               item("it-coin",{value=4}) },
  88.     ["x"] = { default_floor, oxyd },
  89.     [">"] = { default_floor, 
  90.               stone("st-laser",
  91.                     {name="laser",on=TRUE,dir=EAST})},
  92. }
  93.  
  94. create_world_from_map( tiles, {
  95. "                                       ",
  96. " ##################################### ",
  97. " #QWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWE# ",
  98. " =ASoS$SSSSSSSSSSSSSSSSSSSSSSSSSSSSSD# ",
  99. " #ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXzSD# ",
  100. " #################################ASD# ",
  101. "                                 #ASD# ",
  102. " #x#x# ###########################ASD# ",
  103. " #QWE# #QWWWWWWWWWWWWWWWWWWWWWWWWWqSD# ",
  104. " #ASD# #ASSSSSSSSSSSSSSSSSSSSSSSSSSSD# ",
  105. " #ASD# #AScXXXXXXXXXXXXXXXXXXXXXXXXXC# ",
  106. " >ASD# #ASD########################### ",
  107. " #ASD# #ASD#                           ",
  108. " #ASD# #ASD########################### ",
  109. " #ASD# #ASeWWWWWWWWWWWWWWWWWWWWWWWWWE# ",
  110. " #ASD# #ASSSSSSSSSSSSSSSSSSSSSSSSSSSD# ",
  111. " #ASD# #ZXXXXXXXXXXXXXXXXXXXXXXXXXzSD# ",
  112. " #ASD# ###########################ASD# ",
  113. " #ASD#                           #ASD# ",
  114. " #ASD#############################ASD# ",
  115. " #ASeWWWWWWWWWWWWWWWWWWWWWWWWWWWWWqSD# ",
  116. " #ASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSD# ",
  117. " #ZXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXC# ",
  118. " ##################################### ",
  119. "                                       ",
  120. })
  121.  
  122. oxyd_shuffle()
  123.