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

  1. -- Sven Siggelkow 2003
  2. -- ESPRIT #028
  3. -- question: how can I turn a fourswitch by a timer?
  4.  
  5. enigma.ConserveLevel = FALSE
  6. levelw = 20
  7. levelh = 13
  8. create_world(levelw, levelh)
  9. oxyd_default_flavor = "b"
  10. set_actor("ac-blackball", 8,6.5, {player=0})
  11. set_actor("ac-top", 13.5,10.5, {range=15, force=10})
  12. fill_floor("fl-water",0,0,levelw,levelh)
  13. fill_floor("fl-bluegreenx",4,1,levelw-9,levelh-2)
  14.  
  15. function renderLine( line, pattern)
  16.     for i=1, strlen(pattern) do
  17.       local c = strsub( pattern, i, i)
  18.       if c ==   "#" then
  19.          set_stone("st-fakeoxyd", i-1,line)
  20.       elseif c=="B" then
  21.          set_stone("st-actorimpulse", i-1,line)
  22.       elseif c=="S" then                                                                
  23.          set_stone("st-fourswitch", i-1,line, {name="switch",action="callback", target="s1"})
  24.       elseif c=="T" then
  25.          set_stone( "st-timer", i-1,line, {action="callback", target="s1"})      
  26.       elseif c=="1" then                                                                
  27.      set_item("it-magnet",i-1,line,{name="magnet1", on=1})
  28.       elseif c=="2" then                                                                
  29.          set_item("it-magnet",i-1,line,{name="magnet2", on=0})
  30.       elseif c=="3" then                                                                
  31.          set_item("it-magnet",i-1,line,{name="magnet3", on=0})
  32.       elseif c=="4" then                                                                
  33.          set_item("it-magnet",i-1,line,{name="magnet4", on=0})
  34.       elseif c=="O" then
  35.      oxyd(i-1,line)
  36.         end
  37.     end  
  38. end
  39. --               01234567890123456789
  40. renderLine(00 , "                    ")
  41. renderLine(01 , "    #####O#####     ")
  42. renderLine(02 , "    #    1    #     ")
  43. renderLine(03 , "    #         #     ")
  44. renderLine(04 , "    #         #     ")  
  45. renderLine(05 , "    #         #     ")
  46. renderLine(06 , "    O4   B   2O     ")
  47. renderLine(07 , "    #         #     ")
  48. renderLine(08 , "    #         #     ")
  49. renderLine(09 , "    #         #     ")
  50. renderLine(10 , "    #    3    #     ")
  51. renderLine(11 , "    #####O##ST#     ")
  52. renderLine(12 , "                    ")
  53. --               01234567890123456789
  54.  
  55. x=1
  56.  
  57. function s1() 
  58. enigma.SendMessage(enigma.GetNamedObject("magnet"..x), "off", nil)
  59. x=x+1
  60. if x==5 then x=1 end
  61. enigma.SendMessage(enigma.GetNamedObject("magnet"..x), "on", nil)
  62. enigma.Sendmessage(enigma.GetNamedObject("switch"), "turn", WEST)
  63. end
  64.  
  65. oxyd_shuffle()
  66.