|
From: | Michi Hostettler |
Subject: | [Enigma-devel] Call a function with current x/y coordinates using CELLS |
Date: | Sun, 5 Oct 2003 16:22:01 +0200 |
hi,
is it possible to get the
current x and y coordinates for a cell? for
example:
Require("levels/ant.lua")
function
file_oxyd(x,y,f)
oxyd_default_flavor=f
oxyd(x,y)
end
function
GTarget(x,y) <--x and y should be the cordinates of the
cell
print("gt:",tostring(x))
print("gt:",tostring(y))
if (x==1) and
(y==0) then retval="laser1" <-- Only if current cell is
the cell with the red marked !
return (retval)
end
function
GAction(x,y) <--x and y should be the cordinates of the
cell
print("ga:",tostring(x))
print("ga:",tostring(y))
if (x==1) and
(y==0) then retval="laser1" <-- Only if current cell is
the cell with the red marked !
return
(retval)
end
cells["!"]=cell{stone={"st-switch",
{action="" <-- if a cell is ! then it should call
GAction and GTarget with this cell's coordinates.
cells["."]=cell{stone={"st-laser-w",
{on=1,name="laser1"}}}
level={"!!!!!!!!!!!!!!!!!!!!",
"!
!",
"! ##
.
!",
"!
##
!",
"!
$$
!",
"!
$$
!",
"! %%
(
!",
"!
%%
!",
"!
&&
!",
"!
&&
!",
"!
''
!",
"!
!",
"!!!!!!!!!!!!!!!!!!!!"}
thanks you very much
michi
[Prev in Thread] | Current Thread | [Next in Thread] |