home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / nat6.lua < prev    next >
Text File  |  2003-01-05  |  3KB  |  112 lines

  1. -- Twelve Doors
  2. -- A public domain Sokoban level adapted for Enigma
  3. -- 
  4. -- Copyright (c) 2002 Nat Pryce
  5.  
  6.  
  7. trigger_count = 0
  8. function trigger( x, y )
  9.     door_id = "door"..trigger_count
  10.     trigger_count = trigger_count + 1
  11.     
  12.     set_floor( "fl-rough", x, y )
  13.     set_item( "it-trigger", x, y, {target=door_id, action="openclose"} )
  14. end
  15.  
  16. door_count = 0
  17. function door( x, y )
  18.     id = "door"..door_count
  19.     door_count = door_count + 1
  20.     
  21.     set_floor( "fl-rough", x, y )
  22.     doorh( x, y, {name=id} )
  23. end
  24.  
  25.  
  26. level = {
  27. "                     ################# ",
  28. "                   ###o##::::::::::::# ",
  29. "                   #....#++++++++++++# ",
  30. "                   #.a..#::::::::::::# ",
  31. "                   #.aa.#::::::::::::# ",
  32. "                   ##.a.###b######=### ",
  33. "                    #,###..a.#   #=#   ",
  34. "                   ##...b..a.#   #=#   ",
  35. "                   #..a.#..a.#   #=#   ",
  36. "                ####.a..#....#   #=#   ",
  37. "                #s.#..a.#....#   #=#   ",
  38. "                #..@....#....#   #=#   ",
  39. "                ##############   #=#   ",
  40. "                                 #=#   ",
  41. "                                 #=#   ",
  42. "                                 #=#   ",
  43. "                               #x#=#x# ",
  44. "                               x:::::x ",
  45. "                               #:::::# ",
  46. "                               x::^::x ",
  47. "                               #:::::# ",
  48. "                               x:::::x ",
  49. "                               #x###x# ",
  50. "                                       ",
  51. "                                       ",
  52. }
  53.  
  54. cells = {}
  55. cells[" "] = function( x, y )
  56.     set_floor( "fl-leaves", x,y )
  57. end
  58. cells["#"] = function( x, y )
  59.     set_floor( "fl-leaves", x, y )
  60.     set_stone( "st-greenbrown", x, y )
  61. end
  62. cells["@"] = function( x, y )
  63.     set_floor( "fl-gray", x, y )
  64.     set_stone( "st-greenbrown_move", x, y )
  65. end
  66. cells["o"] = function( x, y )
  67.     set_floor( "fl-gray", x, y )
  68.     set_actor( "ac-blackball", x+0.5, y+0.5, {player=0} )
  69. end
  70. cells["x"] = function( x, y )
  71.     set_floor( "fl-gray", x, y )
  72.     oxyd(x,y)
  73. end
  74. cells["."] = function( x, y )
  75.     set_floor( "fl-gray", x, y )
  76. end
  77. cells["a"] = function( x, y )
  78.     set_floor( "fl-gray", x, y )
  79.     set_stone( "st-brownie", x, y )
  80. end
  81. cells[","] = function( x, y )
  82.     set_floor( "fl-normal", x, y )
  83. end
  84. cells["b"] = function( x, y )
  85.     set_floor( "fl-normal", x, y )
  86.     set_stone( "st-brownie", x, y )
  87. end
  88. cells[":"] = function( x, y )
  89.     set_floor( "fl-rough", x, y )
  90. end
  91. cells["+"] = trigger
  92. cells["="] = door
  93. cells["^"] = function( x, y )
  94.     set_floor( "fl-rough", x, y )
  95.     set_stone( "st-laser", x, y, {name="laser", dir=NORTH, on=1} )
  96. end
  97. cells["s"] = function( x, y )
  98.     set_floor( "fl-hay", x, y )
  99.     set_stone( "st-switch", x, y, {on=1,target="laser", action="onoff"} )
  100. end
  101.  
  102.  
  103. create_world( strlen(level[1]), getn(level) )
  104. oxyd_default_flavor = "a"
  105. for y,line in level do
  106.     for x = 1,strlen(line) do
  107.         cell = strchar(strbyte(line,x))
  108.         cells[cell]( x-1, y-1 )
  109.     end
  110. end
  111. oxyd_shuffle()
  112.