home *** CD-ROM | disk | FTP | other *** search
/ GameStar Special 2004 August / GSSH0804.iso / Geschicklichkeit / Enigma / Enigma-081.exe / data / levels / ss13.lua < prev    next >
Encoding:
Text File  |  2003-09-24  |  4.6 KB  |  146 lines

  1. -- Sven Siggelkow 2003
  2. -- Thanks to Thomas Schmalz
  3.  
  4. levelw = 20
  5. levelh = 13
  6. create_world(levelw, levelh)
  7.  
  8. fill_floor("fl-dunes")
  9.  
  10. function renderLine( line, pattern)
  11.     for i=1, strlen(pattern) do
  12.       local c = strsub( pattern, i, i)
  13.       if c ==   "#" then
  14.          set_stone("st-greenbrown",i-1,line)
  15.       elseif c=="D" then
  16.          set_stone("st-death",i-1,line)
  17.       elseif c=="p" then               
  18.          set_stone("st-door_a",i-1,line)
  19.       elseif c=="|" then
  20.      set_stone("st-greenbrown_hole",i-1,line)
  21.      if (options.Difficulty==1) then -- easy
  22.        set_stone("st-grate2",i-1,line)
  23.      else                            -- hard
  24.        set_stone("st-greenbrown_hole",i-1,line)
  25.      end
  26.      set_floor("fl-gradient",  i-1,  line, {type=1})
  27.       elseif c=="a" then
  28.      if (options.Difficulty==1) then -- easy
  29.        set_stone("st-grate2",i-1,line)
  30.      else                            -- hard
  31.        set_stone("st-greenbrown_hole",i-1,line)
  32.      end
  33.          hollow(i-1,line, {name="hollow1"})
  34.       elseif c=="b" then
  35.      if (options.Difficulty==1) then -- easy
  36.        set_stone("st-grate2",i-1,line)
  37.      else                            -- hard
  38.        set_stone("st-greenbrown_hole",i-1,line)
  39.      end
  40.          hollow(i-1,line, {name="hollow2"})
  41.       elseif c=="c" then
  42.      if (options.Difficulty==1) then -- easy
  43.        set_stone("st-grate2",i-1,line)
  44.      else                            -- hard
  45.        set_stone("st-greenbrown_hole",i-1,line)
  46.      end
  47.          hollow(i-1,line, {name="hollow3"})
  48.       elseif c=="d" then
  49.      if (options.Difficulty==1) then -- easy
  50.        set_stone("st-grate2",i-1,line)
  51.      else                            -- hard
  52.        set_stone("st-greenbrown_hole",i-1,line)
  53.      end
  54.          hollow(i-1,line, {name="hollow4"})
  55.       elseif c=="e" then
  56.          set_stone("st-door_a", i-1,line, {name="door1", type="v"})
  57.       elseif c=="f" then
  58.          set_stone("st-door_a", i-1,line, {name="door2", type="v"})
  59.       elseif c=="g" then
  60.          set_stone("st-door_a", i-1,line, {name="door3", type="v"})
  61.       elseif c=="h" then
  62.          set_stone("st-door_a", i-1,line, {name="door4", type="v"})
  63.       elseif c=="1" then
  64.      set_stone("st-switch",i-1,line, {action="callback", target="s1"})
  65.       elseif c=="2" then
  66.      set_stone("st-switch",i-1,line, {action="callback", target="s2"})
  67.       elseif c=="3" then
  68.      set_stone("st-switch",i-1,line, {action="callback", target="s3"})
  69.       elseif c=="4" then
  70.      set_stone("st-switch",i-1,line, {action="callback", target="s4"})    
  71.       elseif c=="W" then
  72.      set_stone("st-timer",i-1,line, {action="openclose", target="door1"})
  73.       elseif c=="X" then
  74.      set_stone("st-timer",i-1,line, {action="openclose", target="door2"})
  75.       elseif c=="Y" then
  76.      set_stone("st-timer",i-1,line, {action="openclose", target="door3"})
  77.       elseif c=="Z" then
  78.      set_stone("st-timer",i-1,line, {action="openclose", target="door4"})
  79.       elseif c=="5" then
  80.      set_stone("st-fourswitch",i-1,line, {name="switch1", action="openclose", target="door1"})
  81.       elseif c=="6" then
  82.      set_stone("st-fourswitch",i-1,line, {name="switch2", action="openclose", target="door2"})
  83.       elseif c=="7" then
  84.      set_stone("st-fourswitch",i-1,line, {name="switch3", action="openclose", target="door3"})
  85.       elseif c=="8" then
  86.      set_stone("st-fourswitch",i-1,line, {name="switch4", action="openclose", target="door4"})    
  87.       elseif c=="x" then
  88.          set_actor("ac-whiteball-small", i,line+.5, {player=0})
  89.         end
  90.     end
  91. end
  92. --              01234567890123456789
  93. renderLine(00, "####W#56#XY#78#Z####")
  94. renderLine(01, "#                  #")
  95. renderLine(02, "# x   x      x   x #")
  96. renderLine(03, "#                  #")
  97. renderLine(04, "#                  #")  
  98. renderLine(05, "#   pepfp  pgphp   #")
  99. renderLine(06, "#   p|p|p  p|p|p   #")
  100. renderLine(07, "#   p|p|p  p|p|p   #")
  101. renderLine(08, "#   p|p|p  p|p|p   #")
  102. renderLine(09, "#   p|p|p  p|p|p   #")
  103. renderLine(10, "#   p|p|p  p|p|p   #")
  104. renderLine(11, "#   pcpdp  papbp   #")
  105. renderLine(12, "#DDD#1#2#DD#3#4#DDD#")
  106. --              01234567890123456789
  107.  
  108. local s={0, 0, 0, 0}
  109.  
  110. function s1()
  111.    %s[1] = 1-%s[1]
  112.    if (%s[1] == 1) then 
  113.       set_item("it-hill",12,11)
  114.    else 
  115.       set_item("it-hollow",12,11)
  116.    end
  117. end
  118.  
  119. function s2()
  120.    %s[2] = 1-%s[2]
  121.    if (%s[2] == 1) then 
  122.       set_item("it-hill",14,11)
  123.    else 
  124.       set_item("it-hollow",14,11)
  125.    end
  126. end
  127.  
  128. function s3()
  129.    %s[3] = 1-%s[3]
  130.    if (%s[3] == 1) then 
  131.       set_item("it-hill",5,11)
  132.    else 
  133.       set_item("it-hollow",5,11)
  134.    end
  135. end
  136.  
  137. function s4()
  138.    %s[4] = 1-%s[4]
  139.    if (%s[4] == 1) then 
  140.       set_item("it-hill",7,11)
  141.    else 
  142.       set_item("it-hollow",7,11)
  143.    end
  144. end
  145.  
  146.