39 lines
1019 B
Lua
39 lines
1019 B
Lua
maketangible('player')
|
|
|
|
function player.interface(actor, place)
|
|
gui.menu_item("north", "Go North")
|
|
gui.menu_item("south", "Go South")
|
|
gui.menu_item("east", "Go East")
|
|
gui.menu_item("west", "Go West")
|
|
end
|
|
|
|
function player:printanimstate()
|
|
graphic,plane,x,y,z,facing = tangible.animstate(self)
|
|
print("Resulting state: ", graphic, plane, x, y, z, facing)
|
|
end
|
|
|
|
function player.action.north(actor, place, dialog)
|
|
print("Moving north")
|
|
tangible.animate(place, {action="walk", dy=1})
|
|
actor:printanimstate()
|
|
end
|
|
|
|
function player.action.south(actor, place, dialog)
|
|
print("Moving south")
|
|
tangible.animate(place, {action="walk", dy=-1})
|
|
actor:printanimstate()
|
|
end
|
|
|
|
function player.action.east(actor, place, dialog)
|
|
print("Moving east")
|
|
tangible.animate(place, {action="walk", dx=1})
|
|
actor:printanimstate()
|
|
end
|
|
|
|
function player.action.west(actor, place, dialog)
|
|
print("Moving west")
|
|
tangible.animate(place, {action="walk", dx=-1})
|
|
actor:printanimstate()
|
|
end
|
|
|