-- Dustwalkers -- the Enigma Level -- (c) 2002 Petr Machata/ant_39 -- Licensed under GPL v2.0 or above dofile(enigma.FindDataFile("levels/ant.lua")) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- boldercount=0 function add_bolder(x,y,dir) boldercount = boldercount + 1 set_stone("st-bolder", x, y, {name="bolder"..boldercount, direction=dir}) end function add_bolder_west(x,y) add_bolder(x,y,enigma.WEST) end function add_bolder_east(x,y) add_bolder(x,y,enigma.EAST ) end function add_bolder_south(x,y) add_bolder(x,y,enigma.SOUTH) end function bolder_dir() for i = 1,3 do local bid = random(1,boldercount) local dir = random(0,4) if (dir ~= 4) then set_attribs(enigma.GetNamedObject("bolder"..bid), {direction=dir}) end end end cells={} cells[" "]=cell{floor={face="fl-sand"}} cells["#"]=cell{parent={cells[" "]},stone={face="st-greenbrown"}} cells["x"]=cell{parent={cells[" "]},stone={face="st-grate1"}} cells["@"]=cell{parent={cells[" "]},stone={face="st-wood"}} cells["O"]=cell{parent={cells[" "]},item={face="ac-blackball", attr={player=0}, actor=1}} cells["A"]=cell{parent={cells[" "]},stone={face="st-door", attr={name="doorA", type="v"}}} cells["B"]=cell{parent={cells[" "]},stone={face="st-door", attr={name="doorB", type="v"}}} cells["C"]=cell{parent={cells[" "]},stone={face="st-door", attr={name="doorC", type="h"}}} cells["D"]=cell{parent={cells[" "]},stone={face="st-door", attr={name="doorD", type="h"}}} cells["a"]=cell{parent={cells[" "]},item={face="it-trigger", attr={action="openclose", target="doorA"}}} cells["b"]=cell{parent={cells[" "]},item={face="it-trigger", attr={action="openclose", target="doorB"}}} cells["c"]=cell{parent={cells[" "]},item={face="it-trigger", attr={action="openclose", target="doorC"}}} cells["d"]=cell{parent={cells[" "]},item={face="it-trigger", attr={action="openclose", target="doorD"}}} cells["1"]=cell{parent={cells[" "]},stone={face="st-oxyd", attr={flavor="b", color="1"}}} cells["2"]=cell{parent={cells[" "]},stone={face="st-oxyd", attr={flavor="b", color="2"}}} cells[">"]=cell{parent={cells[" "], add_bolder_south}} cells["<"]=cell{parent={cells[" "], add_bolder_east}} cells["^"]=cell{parent={cells[" "], add_bolder_west}} cells["~"]=cell{parent={cells[" "]},stone={face="st-timer", attr={action="callback", target="bolder_dir", interval=0.25}}} level = { "############~############", "# 1#1 #", "# 2#2 #", "##A#########~########B###", "# # # # #", "# <#> b #", "# # # # <#", "# <#> a #", "# # @ # # # <#", "#> c # #", "# # #x#####x# <#", "#> @ x C D x #", "# # #x#####x# <#", "#> d # #", "# # # # # @ <#", "# ^ ^ ^ ^ <#> #", "##### # # # @ <#", "# # <#> #", "# O x # # #", "############~############" } -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- levelw = 20 levelh = 25 create_world(levelw, levelh) randomseed(enigma.GetTicks()) draw_map(0, 0, level, TRANSPOSE_MAP)