home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / duffy27.lua < prev    next >
Text File  |  2003-08-27  |  5KB  |  187 lines

  1. levelw=25
  2. levelh=15
  3.  
  4. create_world( levelw, levelh)
  5.  
  6. fill_floor("fl-hay", 0,0,levelw,levelh)
  7.  
  8. function renderLine( line, pattern)
  9.     for i=1, strlen(pattern) do
  10.         local c = strsub( pattern, i, i)
  11.         if c =="#" then
  12.             set_stone( "st-greenbrown", i-1, line)
  13.         elseif c =="@" then
  14.             set_stone( "st-glass", i-1, line)
  15.                fill_floor("fl-ice_001", i-1,line, 1,1)
  16.         elseif c == "o" then
  17.             oxyd( i-1, line)
  18.             abyss(i-1,line)
  19.                 elseif c == "!" then
  20.             abyss(i-1,line)
  21. --                   fill_floor("fl-water", i-1,line, 1,1)
  22.         elseif c=="z" then
  23.            set_actor("ac-blackball", i-1,line, {player=0})
  24.       elseif c == "A" then
  25.          set_stone("st-door_a",i-1,line,{name="gate1"})
  26.       elseif c == "B" then
  27.          set_stone("st-door_a",i-1,line,{name="gate2"})
  28.       elseif c == "C" then
  29.          set_stone("st-door_a",i-1,line,{name="gate3"})
  30.       elseif c == "D" then
  31.          set_stone("st-door_a",i-1,line,{name="gate4"})
  32.       elseif c == "E" then
  33.          set_stone("st-door_a",i-1,line,{name="gate5"})
  34.       elseif c == "F" then
  35.          set_stone("st-door_a",i-1,line,{name="gate6"})
  36.       elseif c == "G" then
  37.          set_stone("st-door_a",i-1,line,{name="gate7"})
  38.       elseif c == "H" then
  39.          set_stone("st-door_a",i-1,line,{name="gate8"})    
  40.     end
  41.     end    
  42. end
  43.  
  44. -- Floor:  " "
  45. -- Border: "#"
  46. -- Oxyd:   "o"
  47.  
  48. renderLine(00,"!!!!@@@@@@@@@@@@!!!!")
  49. renderLine(01,"!!!!############!!!!")
  50. renderLine(02,"!!!oA          Bo!!!")
  51. renderLine(03,"!!!!#          #!!!!")
  52. renderLine(04,"!!!!#          #!!!!")
  53. renderLine(05,"!!!oH          Co!!!")
  54. renderLine(06,"!!!!#          #!!!!")
  55. renderLine(07,"!!!!#     z    #!!!!")
  56. renderLine(08,"!!!oG          Do!!!")
  57. renderLine(09,"!!!!#          #!!!!")
  58. renderLine(10,"!!!!#          #!!!!")
  59. renderLine(11,"!!!oF          Eo!!!")
  60. renderLine(12,"!!!!############!!!!")
  61.  
  62. oxyd_shuffle()
  63.  
  64. gate1=enigma.GetNamedObject("gate1")
  65. gate2=enigma.GetNamedObject("gate2")
  66. gate3=enigma.GetNamedObject("gate3")
  67. gate4=enigma.GetNamedObject("gate4")
  68. gate5=enigma.GetNamedObject("gate5")
  69. gate6=enigma.GetNamedObject("gate6")
  70. gate7=enigma.GetNamedObject("gate7")
  71. gate8=enigma.GetNamedObject("gate8")
  72.  
  73. set_stone( "st-timer", 21, 0, {action="callback", target="timer_handler",interval=1})
  74.  
  75. gatenum=0
  76.  
  77. mytimer=-1
  78. function timer_handler()
  79. mytimer=mytimer+1
  80. if mytimer==0 then
  81.         fill_floor("fl-wood", 4,0, 1,1)
  82.     xcor=random(1,10)
  83.     ycor=random(1,10)
  84.     stnum=random(1,4)
  85. if stnum==1 then
  86.     xx=4+xcor
  87.     yy=12-ycor
  88. stnpr=1
  89. elseif stnum==2 then
  90.         xx=15-xcor
  91.     yy=12-ycor
  92. stnpr=3
  93. elseif stnum==3 then
  94.         xx=15-xcor
  95.     yy=1+ycor
  96. stnpr=9
  97. elseif stnum==4 then
  98.     xx=4+xcor
  99.     yy=1+ycor
  100. stnpr=7
  101. end
  102.     if xcor==10 then
  103.        xcor=0
  104.     end
  105.     if ycor==10 then
  106.        ycor=0
  107.     end
  108.     randcorx=random(5,14)
  109.     randcory=random(2,11)
  110.     document(randcorx,randcory,stnpr..xcor..ycor)
  111. elseif mytimer==1 then
  112.     fill_floor("fl-wood", 5,0, 1,1)
  113. elseif mytimer==2 then
  114.     fill_floor("fl-wood", 6,0, 1,1)
  115. elseif mytimer==3 then
  116.     fill_floor("fl-wood", 7,0, 1,1)
  117. elseif mytimer==4 then
  118.     fill_floor("fl-wood", 8,0, 1,1)
  119. elseif mytimer==5 then
  120.     fill_floor("fl-wood", 9,0, 1,1)
  121. elseif mytimer==6 then
  122.     fill_floor("fl-wood", 10,0, 1,1)
  123. elseif mytimer==7 then
  124.     fill_floor("fl-wood", 11,0, 1,1)
  125. elseif mytimer==8 then
  126.     fill_floor("fl-wood", 12,0, 1,1)
  127. elseif mytimer==9 then
  128.     fill_floor("fl-wood", 13,0, 1,1)
  129. elseif mytimer==10 then
  130.     fill_floor("fl-wood", 14,0, 1,1)
  131. elseif mytimer==11 then
  132.     fill_floor("fl-wood", 15,0, 1,1)
  133. elseif mytimer==12 then
  134.    for a=5,14 do
  135.       for b=2,11 do
  136.      if a<xx or a>xx then
  137. aaa=1
  138.      elseif a==xx then
  139. aaa=0
  140. end
  141.      if b<yy or b>yy then
  142. bbb=1
  143.      elseif b==yy then
  144. bbb=0
  145.      end
  146.      if aaa==1 or bbb==1 then
  147.             fill_floor("fl-abyss", a,b, 1,1)
  148.       end
  149.       end
  150.    end    
  151. elseif mytimer==13 then       
  152.    fill_floor("fl-ice_001", 4,0, 12,1)
  153.    fill_floor("fl-hay", 5,2, 10,10)
  154.    mytimer=-1
  155.    if gatenum==0 then
  156.       enigma.SendMessage(gate1, "openclose", nil)
  157.    elseif gatenum==1 then
  158.       enigma.SendMessage(gate1, "openclose", nil)
  159.       enigma.SendMessage(gate2, "openclose", nil)
  160.    elseif gatenum==2 then
  161.       enigma.SendMessage(gate2, "openclose", nil)
  162.       enigma.SendMessage(gate3, "openclose", nil)
  163.    elseif gatenum==3 then
  164.       enigma.SendMessage(gate3, "openclose", nil)
  165.       enigma.SendMessage(gate4, "openclose", nil)
  166.    elseif gatenum==4 then
  167.       enigma.SendMessage(gate4, "openclose", nil)
  168.       enigma.SendMessage(gate5, "openclose", nil)
  169.    elseif gatenum==5 then
  170.       enigma.SendMessage(gate5, "openclose", nil)
  171.       enigma.SendMessage(gate6, "openclose", nil)
  172.    elseif gatenum==6 then
  173.       enigma.SendMessage(gate6, "openclose", nil)
  174.       enigma.SendMessage(gate7, "openclose", nil)
  175.    elseif gatenum==7 then
  176.       enigma.SendMessage(gate7, "openclose", nil)
  177.       enigma.SendMessage(gate8, "openclose", nil)
  178.    elseif gatenum==8 then
  179.       enigma.SendMessage(gate8, "openclose", nil)
  180.       enigma.SendMessage(gate1, "openclose", nil)
  181.    end
  182. gatenum=gatenum+1
  183. if gatenum==9 then
  184.    gatenum=1
  185. end
  186. end
  187. end