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

  1. -- A level for Enigma
  2. -- Name:        Khun Phan
  3. -- Filename:    ralf10.lua
  4. -- Copyright:     (C) May 2003 Ralf Westram
  5. -- Contact:     amgine@reallysoft.de
  6. -- License:     GPL v2.0 or above
  7.  
  8. dofile(enigma.FindDataFile("levels/ralf.lua"))
  9.  
  10. --debug_mode()
  11.  
  12. level={
  13.    "*************************",
  14.    "o bbbbbbbbbbbbbbbbbbbbbb*",
  15.    "* *********************b*",
  16.    "*                     *b*",
  17.    "*   ################# *b*",
  18.    "*   # ^  ^     ^  ^ # *b*",
  19.    "*   #<+=-+>   <+=-+># *b*",
  20.    "*   # v  v     v  v # *b*",
  21.    "*   # ^  ^  ^  ^  ^ # *b*",
  22.    "*   #<] <+><+><+><+># *b*",
  23.    "*   # |a =  |  v  v # *b*",
  24.    "*   # =  |  =  ^  ^ # *b*",
  25.    "*   #<+-=+><+><+><+># *b*",
  26.    "*   # v  v  v  v  v # *b*",
  27.    "*   # ^  ^     ^  ^ # *b*",
  28.    "*   #<+=-+>   <+=-+># *b*",
  29.    "*   # v  v     v  v # * o",
  30.    "*   ################# ***",
  31.    "*                       *",
  32.    "*                     ! t",
  33.    "*                       *",
  34.    "*************************",
  35. }
  36.  
  37. switchpad={
  38.    " x  x ",
  39.    "xx xxx",
  40.    " x  x ",
  41.    " x  x ",
  42.    "xxxxxx",
  43.    " x  x ",
  44. }
  45.  
  46. bridges=0
  47. function set_bridge(x,y)
  48.    bridges = bridges+1
  49.    set_floor("fl-bridge",x,y,{name="bridge"..bridges})
  50. end
  51.  
  52. switches=0
  53. function set_switch(x,y,toggle)
  54.    switches=switches+1
  55.    set_item("it-trigger",x,y,{action="openclose",target="bridge"..switches})
  56.    if (toggle==1) then
  57.       enigma.SendMessage(enigma.GetNamedObject("bridge"..switches), "openclose", nil)
  58.    end
  59. end
  60.  
  61. function set_pad(pad,x,y)
  62.    padw,padh = get_map_size(pad)
  63.    for py=1,padh do
  64.       for px=1,padw do
  65.          local col = strsub(pad[py],px,px)
  66.          if (col == "x") then
  67.             set_switch(x+px,y+py,0)
  68.          else
  69.             set_switch(x+px,y+py,1)
  70.          end
  71.       end
  72.    end
  73. end
  74.  
  75. docx = 0
  76. docy = 0
  77. hints = 0
  78.  
  79. function hint()
  80.    hints = hints+1
  81.  
  82.    if (hints<=2) then
  83.       enigma.PlaySound(enigma.GetNamedObject("soundstone"), "st-magic")
  84.    end
  85.  
  86.    if hints==1 then
  87.       document(docx, docy, "One of the puzzle stones needs to be placed onto the trigger field.                       Guess which.. :)");
  88.    elseif hints==2 then
  89.       document(docx, docy, "The level preview might help..");
  90.    end
  91. end
  92.  
  93. function store_doc_pos(x,y)
  94.    docx,docy=x,y
  95. end
  96.  
  97. cells={}
  98.  
  99.  
  100. cells[" "] = cell{floor="fl-tigris"}
  101. cells["#"] = cell{parent=cells[" "],stone="st-grate1"}
  102. cells["*"] = cell{parent=cells[" "],stone="st-rock1"}
  103. cells["a"] = cell{parent=cells[" "],actor={"ac-blackball", {player=0}}}
  104. cells["o"] = cell{oxyd}
  105.  
  106. cells["i"] = cell{parent=cells[" "],stone="st-stoneimpulse"}
  107. cells["I"] = cell{parent=cells[" "],stone="st-stoneimpulse_movable"}
  108.  
  109. cells["-"]=cell{{{puzzle, PUZ_0101}}}
  110. cells[">"]=cell{{{puzzle, PUZ_0001}}}
  111. cells["<"]=cell{{{puzzle, PUZ_0100}}}
  112.  
  113. cells["|"]=cell{{{puzzle, PUZ_1010}}}
  114. cells["^"]=cell{{{puzzle, PUZ_0010}}}
  115. cells["v"]=cell{{{puzzle, PUZ_1000}}}
  116.  
  117. cells["+"]=cell{{{puzzle, PUZ_1111}}}
  118. cells["]"]=cell{{{puzzle, PUZ_1011}}}
  119. cells["="]=cell{{{puzzle, PUZ_0000}}}
  120. cells["/"]=cell{{{puzzle, PUZ_0110}}}
  121. cells["`"]=cell{{{puzzle, PUZ_0011}}}
  122. cells["."]=cell{{{puzzle, PUZ_1100}}}
  123. cells[","]=cell{{{puzzle, PUZ_1001}}}
  124.  
  125. cells["b"]=cell{parent={set_bridge}}
  126.  
  127. cells["!"] = cell{floor="fl-sahara",parent={store_doc_pos}}
  128. cells["t"] = cell{parent=cells[" "],stone={face="st-timer",attr={action="callback", target="hint", interval=180, name="soundstone"}}}
  129.  
  130. rs_create_world(level,cells)
  131.  
  132. set_pad(switchpad,xlo+13,ylo+7)
  133.  
  134. display.SetFollowMode(display.FOLLOW_SCROLLING)
  135. oxyd_shuffle()
  136.