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

  1. --Siegfried Fennig 27.04.2003 Rev.1
  2.  
  3. levelw = 20
  4. levelh = 13
  5.  
  6. create_world(levelw, levelh)
  7. draw_border("st-rock4")
  8. enigma.ConserveLevel = FALSE
  9. --oxyd_default_flavor = "d"
  10. fill_floor("fl-bluegreen", 0, 0, level_width, level_height)
  11.  
  12. function renderLine( line, pattern)
  13.     for i=1, strlen(pattern) do
  14.       local c = strsub( pattern, i, i)
  15.       if c =="t" then
  16.          set_stone("st-turnstile",i-1,line)
  17.       elseif c == "n" then
  18.          set_stone("st-turnstile-n",i-1,line)
  19.       elseif c == "e" then
  20.          set_stone("st-turnstile-e",i-1,line)
  21.       elseif c == "s" then
  22.          set_stone("st-turnstile-s",i-1,line)
  23.       elseif c == "w" then
  24.          set_stone("st-turnstile-w",i-1,line)
  25.       elseif c == "r" then
  26.          set_stone("st-rock4",i-1,line)
  27.       elseif c == "X" then
  28.          set_stone("st-swap",i-1,line)
  29.       elseif c == "Y" then
  30.          set_stone("st-wood",i-1,line)
  31.       elseif c == "E" then
  32.          set_stone("st-oneway",i-1,line, {orientation=enigma.EAST})
  33.       elseif c == "S" then
  34.          set_stone("st-oneway",i-1,line, {orientation=enigma.SOUTH})
  35.       elseif c == "W" then
  36.          set_stone("st-oneway",i-1,line, {orientation=enigma.WEST})
  37.       elseif c == "q" then
  38.          set_item("it-trigger",i-1,line, {action="callback", target="callback1"})
  39.       elseif c == "p" then
  40.          set_item("it-trigger",i-1,line, {action="callback", target="callback2"})
  41.       elseif c == "l" then
  42.          set_attrib(laser(i-1,line, 0, NORTH), "name", "laser")
  43.       elseif c == "m" then
  44.          mirrorp(i-1,line,0,1,3)
  45.       elseif c == "M" then
  46.          mirrorp(i-1,line,0,1,1)
  47.       elseif c == "f" then
  48.          mirror3(i-1,line,0,0,1)
  49.       elseif c == "H" then
  50.          set_item("it-hollow",i-1,line)
  51.       elseif c == "h" then
  52.          set_item("it-tinyhollow",i-1,line)
  53.       elseif c == "K" then
  54.          set_item("it-hill",i-1,line)
  55.       elseif c == "k" then
  56.          set_item("it-tinyhill",i-1,line)
  57.       elseif c == "Z" then
  58.          set_item("it-spade",i-1,line)
  59.       elseif c == "i" then
  60.          yy1( "white",  i-1, line)
  61.       elseif c == "j" then
  62.          yy1( "black",  i-1, line)
  63.       elseif c == "o" then
  64.          set_stone("st-oxyd",i-1,line,{color="1", flavor="d"})
  65.       elseif c == "#" then
  66.          set_floor("fl-water",i-1,line)
  67.       elseif c == "a" then
  68.          set_actor("ac-blackball", i-.5,line+.5, {player=0})
  69.          set_item("it-yinyang", i-1, line+.5)
  70.       elseif c == "b" then
  71.          set_actor("ac-whiteball", i-.5,line+.5, {player=1})
  72.          set_item("it-yinyang", i-1, line+.5)
  73.       elseif c == "d" then
  74.          document(i-1,line,"Dig in...")
  75.         end
  76.     end
  77. end
  78.  
  79. function yy1( color, x, y)
  80.         stone = format( "st-%s1", color)
  81.         set_stone( stone, x, y)
  82. end
  83.  
  84. --              01234567890123456789
  85. renderLine(00, "                    ")
  86. renderLine(01, " rrrrrroMmfMorrrrrr ")
  87. renderLine(02, " rrrrr########rrrrr ")
  88. renderLine(03, " rrrrrrr jk rrrrrrr ")
  89. renderLine(04, " rrrrrrr rl rrrrrrr ")
  90. renderLine(05, " rrrrrrr rr rrrrrrr ")
  91. renderLine(06, " rrrrr E  X Ejrrrrr ")
  92. renderLine(07, " rr Zr rwtterSrrrrr ")
  93. renderLine(08, " rriYr W s HYjrrrrr ")
  94. renderLine(09, " rr hrrr rr jjrr n  ")
  95. renderLine(10, " rr  hK  rr rrrrwte ")
  96. renderLine(11, " rrr    irrda b qsp ")
  97. renderLine(12, "                    ")
  98. --              01234567890123456789
  99.  
  100. trigger1 = 0
  101. trigger2 = 0
  102.  
  103. function triggeraction()
  104.     lasera=enigma.GetNamedObject("laser")
  105.     if trigger1 == 1 and trigger2 == 1 then
  106.         enigma.SendMessage(lasera, "on", nil)
  107.     end
  108.     if trigger1 == 0 and trigger2 == 1 then
  109.         enigma.SendMessage(lasera, "off", nil)
  110.     end
  111.     if trigger1 == 1 and trigger2 == 0 then
  112.         enigma.SendMessage(lasera, "off", nil)
  113.     end
  114.     if trigger1 == 0 and trigger2 == 0 then
  115.         enigma.SendMessage(lasera, "off", nil)
  116.     end
  117. end
  118.  
  119. function callback1 (ispressed)
  120.      trigger1=ispressed
  121.      triggeraction()
  122. end
  123.  
  124. function callback2 (ispressed)
  125.      trigger2=ispressed
  126.      triggeraction()
  127. end
  128.  
  129.