3 -- This script is executed every time an Entity finishes walking onto a tile.
5 -- We are called from within Entity::postMove() in entity.cpp. There, we are
6 -- passed some game data. We pass three variables to this script from the
7 -- Entity object: x, y, and entity, which represents the Entity itself.
9 -- We also have a C function we can call, gotoRandomTile, which takes an Entity
10 -- object as a parameter.
13 -- Returns true if we are standing on the specified X,Y location.
15 return x
== X
and y
== Y
18 -- Returns true if we are standing on any of the specified locations.
19 function onAny(locations
)
20 for _
,loc
in ipairs(locations
) do
21 if on(loc
.x
, loc
.y
) then
28 local redPortalLocations
= {
33 -- The red portals teleport us! *gasp* Excitement!
34 if onAny(redPortalLocations
) then
36 gotoRandomTile(entity
)