home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / duffy30.lua < prev    next >
Text File  |  2003-08-27  |  8KB  |  360 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 == "g" then
  17.            set_stone("st-oxyd", i-1, line,{color="0",name="o1"})
  18.         elseif c == "h" then
  19.            set_stone("st-oxyd", i-1, line,{color="0",name="o2"})
  20.         elseif c == "i" then
  21.            set_stone("st-oxyd", i-1, line,{color="1",name="o3"})
  22.         elseif c == "j" then
  23.            set_stone("st-oxyd", i-1, line,{color="1",name="o4"})
  24.         elseif c == "k" then
  25.            set_stone("st-oxyd", i-1, line,{color="2",name="o5"})
  26.         elseif c == "l" then
  27.            set_stone("st-oxyd", i-1, line,{color="2",name="o6"})
  28.         elseif c == "m" then
  29.            set_stone("st-oxyd", i-1, line,{color="3",name="o7"})
  30.         elseif c == "n" then
  31.            set_stone("st-oxyd", i-1, line,{color="3",name="o8"})
  32.         elseif c == "p" then
  33.            set_stone("st-oxyd", i-1, line,{color="4",name="o9"})
  34.         elseif c == "q" then
  35.            set_stone("st-oxyd", i-1, line,{color="4",name="o10"})
  36.         elseif c == "r" then
  37.            set_stone("st-oxyd", i-1, line,{color="5",name="o11"})
  38.         elseif c == "s" then
  39.            set_stone("st-oxyd", i-1, line,{color="5",name="o12"})
  40.         elseif c == "t" then
  41.            set_stone("st-oxyd", i-1, line,{color="6",name="o13"})
  42.         elseif c == "u" then
  43.            set_stone("st-oxyd", i-1, line,{color="6",name="o14"})
  44.         elseif c == "v" then
  45.            set_stone("st-oxyd", i-1, line,{color="7",name="o15"})
  46.         elseif c == "w" then
  47.            set_stone("st-oxyd", i-1, line,{color="7",name="o16"})
  48.                 elseif c == "!" then
  49.             abyss(i-1,line)
  50. --                   fill_floor("fl-water", i-1,line, 1,1)
  51.         elseif c=="z" then
  52.            set_actor("ac-blackball", i-.5,line+.5, {player=0})
  53.       elseif c == "A" then
  54.          set_stone("st-door_a",i-1,line,{name="gate1"})
  55.       elseif c == "B" then
  56.          set_stone("st-door_a",i-1,line,{name="gate2"})
  57.       elseif c == "C" then
  58.          set_stone("st-door_a",i-1,line,{name="gate3"})
  59.       elseif c == "D" then
  60.          set_stone("st-door_a",i-1,line,{name="gate4"})
  61.       elseif c == "E" then
  62.          set_stone("st-door_a",i-1,line,{name="gate5"})
  63.       elseif c == "F" then
  64.          set_stone("st-door_a",i-1,line,{name="gate6"})
  65. elseif c=="a" then
  66. set_item("it-trigger", i-1,line, {action="openclose", target="gate1"})
  67. elseif c=="b" then
  68. set_item("it-trigger", i-1,line, {action="openclose", target="gate2"})
  69. elseif c=="c" then
  70. set_item("it-trigger", i-1,line, {action="openclose", target="gate3"})
  71. elseif c=="d" then
  72. set_item("it-trigger", i-1,line, {action="openclose", target="gate4"})
  73. elseif c=="e" then
  74. set_item("it-trigger", i-1,line, {action="openclose", target="gate5"})
  75. elseif c=="f" then
  76. set_item("it-trigger", i-1,line, {action="openclose", target="gate6"})
  77.         elseif c=="1" then
  78.             set_stone("st-switch", i-1,line, {action="callback",target="funccU"})
  79.         elseif c=="2" then
  80.             set_stone("st-switch", i-1,line, {action="callback",target="funccR"})
  81.         elseif c=="3" then
  82.             set_stone("st-switch", i-1,line, {action="callback",target="funccD"})
  83.         elseif c=="4" then
  84.             set_stone("st-switch", i-1,line, {action="callback",target="funccL"})
  85.         elseif c=="5" then
  86.             set_stone("st-switch", i-1,line, {action="callback",target="funccP"})
  87.         elseif c=="R" then
  88.            set_stone("st-switch", i-1,line, {action="callback",target="funccX"})
  89.         elseif c=="G" then
  90.            set_stone("st-switch", i-1,line, {action="callback",target="funccU2"})
  91.         elseif c=="H" then
  92.            set_stone("st-switch", i-1,line, {action="callback",target="funccR2"})
  93.         elseif c=="I" then
  94.            set_stone("st-switch", i-1,line, {action="callback",target="funccD2"})
  95.         elseif c=="J" then
  96.            set_stone("st-switch", i-1,line, {action="callback",target="funccL2"})
  97.         elseif c=="K" then
  98.            set_stone("st-switch", i-1,line, {action="callback",target="funccP2"})
  99.         elseif c == "=" then
  100.            puzzle(i-1,line,PUZ_0101)
  101.         elseif c == "$" then
  102.            puzzle(i-1,line,PUZ_1010)
  103.         elseif c == "`" then
  104.            puzzle(i-1,line,PUZ_0011)
  105.         elseif c == "/" then
  106.            puzzle(i-1,line,PUZ_0110)
  107.         elseif c == "%" then
  108.            puzzle(i-1,line,PUZ_1001)
  109.         elseif c == "L" then
  110.            puzzle(i-1,line,PUZ_1100)
  111.     end
  112.     end    
  113. end
  114.  
  115. -- Floor:  " "
  116. -- Border: "#"
  117. -- Oxyd:   "o"
  118.  
  119. renderLine(00,"/======`############")
  120. renderLine(01,"$a#     #ghij#  G  #")
  121. renderLine(02,"$       #klmn# J#H #")
  122. renderLine(03,"$      b#pqrs#  I  #")
  123. renderLine(04,"$       #tuvw#K    #")
  124. renderLine(05,"$   c   ##########F#")
  125. renderLine(06,"$       #        #E#")
  126. renderLine(07,"$  d    # z  1   #D#")
  127. renderLine(08,"$       #        #C#")
  128. renderLine(09,"$     e #  4 5 2 #B#")
  129. renderLine(10,"$       #        #A#")
  130. renderLine(11,"$ f     #R   3     #")
  131. renderLine(12,"L======%############")
  132. renderLine(13,"####################")
  133.  
  134. oxyd_shuffle()
  135.  
  136. o1=enigma.GetNamedObject("o1")
  137. o2=enigma.GetNamedObject("o2")
  138. o3=enigma.GetNamedObject("o3")
  139. o4=enigma.GetNamedObject("o4")
  140. o5=enigma.GetNamedObject("o5")
  141. o6=enigma.GetNamedObject("o6")
  142. o7=enigma.GetNamedObject("o7")
  143. o8=enigma.GetNamedObject("o8")
  144. o9=enigma.GetNamedObject("o9")
  145. o10=enigma.GetNamedObject("o10")
  146. o11=enigma.GetNamedObject("o11")
  147. o12=enigma.GetNamedObject("o12")
  148. o13=enigma.GetNamedObject("o13")
  149. o14=enigma.GetNamedObject("o14")
  150. o15=enigma.GetNamedObject("o15")
  151. o16=enigma.GetNamedObject("o16")
  152.  
  153.  
  154. xx=4
  155. yy=6
  156. xx2=10
  157. yy2=2
  158.  
  159. direc=0
  160. mv=0
  161.  
  162. function funccU()
  163. if yy<2 then
  164. if xx==7 then
  165. yy=11
  166.    move()
  167. end
  168. else
  169. if xx<2 or xx>2 or yy<2 or yy>1 then
  170. yy=yy-1
  171.    move()
  172. end
  173. end
  174. end
  175.  
  176. function funccR()
  177. if xx<7 then
  178. if xx<1 or xx>1 or yy<1 or yy>1 then
  179. xx=xx+1
  180.    move()
  181. end
  182. end
  183. end
  184.  
  185. function funccD()
  186. if yy>10 then
  187. if xx==7 then
  188. yy=1
  189.    move()
  190. end
  191. else
  192. yy=yy+1
  193.    move()
  194. end
  195. end
  196.  
  197. function funccL()
  198. if xx>1 then
  199. if xx<3 or xx>3 or yy<1 or yy>1 then
  200. xx=xx-1
  201.    move()
  202. end
  203. end
  204. end
  205.  
  206. pla=0
  207. function funccP()
  208. if direc==0 then
  209. placx=xx
  210. placy=yy-1
  211. elseif direc==1 then
  212. placx=xx+1
  213. placy=yy
  214. elseif direc==2 then
  215. placx=xx
  216. placy=yy+1
  217. elseif direc==3 then
  218. placx=xx-1
  219. placy=yy
  220. end
  221. if pla<6 then
  222. if placx>0 and placx<8 and placy>0 and placy<12 then
  223. if placx<2 or placx>2 or placy<1 or placy>1 then
  224.    set_stone( "st-rock1", placx, placy)
  225. pla=pla+1
  226. end
  227. end
  228. end
  229. end
  230.  
  231. function funccX()
  232.    for i=1,7 do
  233.    for j=1,11 do
  234. if i<2 or i>2 or j<1 or j>1 then
  235.    enigma.KillStone(i,j)
  236. end
  237. end
  238. end
  239. pla=0
  240. xx=4
  241. yy=6
  242. direc=0
  243. end
  244.  
  245. function move()
  246. if direc<3 then
  247. direc=direc+1
  248. else
  249. direc=0
  250. end
  251. end
  252.  
  253. function funccU2()
  254. if mv==0 then
  255. if yy2>1 then
  256. yy2=yy2-1
  257.    move2()
  258. end
  259. elseif mv==1 then
  260. if yy2>2 then
  261. yy2=yy2-2
  262.    move2()
  263. end
  264. end
  265. end
  266.  
  267. function funccR2()
  268. if mv==0 then
  269. if xx2<12 then
  270. xx2=xx2+1
  271.    move2()
  272. end
  273. elseif mv==1 then
  274. if xx2<11 then
  275. xx2=xx2+2
  276.    move2()
  277. end
  278. end
  279. end
  280.  
  281. function funccD2()
  282. if mv==0 then
  283. if yy2<4 then
  284. yy2=yy2+1
  285.    move2()
  286. end
  287. elseif mv==1 then
  288. if yy2<3 then
  289. yy2=yy2+2
  290.    move2()
  291. end
  292. end
  293. end
  294.  
  295. function funccL2()
  296. if mv==0 then
  297. if xx2>9 then
  298. xx2=xx2-1
  299.    move2()
  300. end
  301. elseif mv==1 then
  302. if xx2>10 then
  303. xx2=xx2-2
  304.    move2()
  305. end
  306. end
  307. end
  308.  
  309. function move2()
  310. if mv==0 then
  311. mv=1
  312. elseif mv==1 then
  313. mv=0
  314. end
  315. end
  316.  
  317. function funccP2()
  318. if yy2==1 then
  319. if xx2==9 then
  320. ox=o1
  321. elseif xx2==10 then
  322. ox=o2
  323. elseif xx2==11 then
  324. ox=o3
  325. elseif xx2==12 then
  326. ox=o4
  327. end
  328. elseif yy2==2 then
  329. if xx2==9 then
  330. ox=o5
  331. elseif xx2==10 then
  332. ox=o6
  333. elseif xx2==11 then
  334. ox=o7
  335. elseif xx2==12 then
  336. ox=o8
  337. end
  338. elseif yy2==3 then
  339. if xx2==9 then
  340. ox=o9
  341. elseif xx2==10 then
  342. ox=o10
  343. elseif xx2==11 then
  344. ox=o11
  345. elseif xx2==12 then
  346. ox=o12
  347. end
  348. elseif yy2==4 then
  349. if xx2==9 then
  350. ox=o13
  351. elseif xx2==10 then
  352. ox=o14
  353. elseif xx2==11 then
  354. ox=o15
  355. elseif xx2==12 then
  356. ox=o16
  357. end
  358. end
  359. enigma.SendMessage(ox, "trigger", nil)
  360. end