/[enigma]/enigma/data/levels/ant.lua
ViewVC logotype

Diff of /enigma/data/levels/ant.lua

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by ant_39, Sat Jan 25 15:16:49 2003 UTC revision 1.6 by ant_39, Mon Feb 3 18:33:35 2003 UTC
# Line 283  function add_rubber_bands(gr1, gr2, leng Line 283  function add_rubber_bands(gr1, gr2, leng
283     end     end
284  end  end
285    
286    function add_rubber_band_pairs(gr1, gr2, length)
287       for key1,obj1 in gr1 do
288          AddRubberBand(obj1, gr2[key1], length, 0)
289       end
290    end
291    
292  function send_group_message(group, message, third)  function send_group_message(group, message, third)
293     for _,item in group do     for _,item in group do
294        enigma.SendMessage(item, message, third)        enigma.SendMessage(item, message, third)
# Line 417  end Line 423  end
423  function path_empty(opts,x,y)  function path_empty(opts,x,y)
424     add_path_empty(x,y,opts[1])     add_path_empty(x,y,opts[1])
425  end  end
426    
427    
428    
429    
430    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
431    -- PUZZLE GENERATORS -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
432    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
433    
434    -- use this function right like other parent function, for example checkerfloor or randomfloor
435    -- in contrast to common parent functions, its attribute should be a single table variable which
436    -- holds list of already registered puzzle cells
437    function puzzlecell (tab, x, y)
438       tab[getkey(x,y)] = {}
439       tab[getkey(x,y)].x = x
440       tab[getkey(x,y)].y = y
441    end
442    
443    -- this functions is called at the end of level file. It accepts
444    --  tab, which is a list of registered puzzle cells
445    --  generatorfunc, which is a cell[] function to add the floor or items to each registered cell
446    -- the function goes through all registered cells, observing their neighbors
447    -- and adding right puzzle stones to right places
448    function render_puzzles (tab, generatorfunc)
449       for _,val in tab do
450          local x,y = val.x, val.y
451    
452          local up   = (tab[getkey(x, y-1)] ~= nil) or 0;
453          local down = (tab[getkey(x, y+1)] ~= nil) or 0;
454          local left = (tab[getkey(x-1, y)] ~= nil) or 0;
455          local right= (tab[getkey(x+1, y)] ~= nil) or 0;
456    
457          dostring("puz = PUZ_"..up..right..down..left)
458          generatorfunc(x,y);
459          puzzle(x, y, puz)
460       end
461    end

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26