Files
integration/luprex/core/lua/player.lua

52 lines
1.4 KiB
Lua
Raw Normal View History

2021-02-10 16:22:24 -05:00
maketangible('player')
2021-02-25 14:09:16 -05:00
function player.interface(actor, place)
-- print("actor=", actor)
-- print("place=", place)
-- print("t.actor=", tangible.actor())
-- print("t.place=", tangible.place())
2021-02-25 14:09:16 -05:00
gui.menu_item("north", "Go North")
gui.menu_item("south", "Go South")
gui.menu_item("east", "Go East")
gui.menu_item("west", "Go West")
2021-02-10 16:22:24 -05:00
end
function player:printanimstate()
local graphic,plane,x,y,z,facing = tangible.animstate(self)
print("Resulting state: ", graphic, plane, x, y, z, facing)
end
2021-02-25 14:09:16 -05:00
function player.action.north(actor, place, dialog)
2021-02-10 16:22:24 -05:00
print("Moving north")
2021-02-25 16:32:48 -05:00
tangible.animate(place, {action="walk", dy=1})
actor:printanimstate()
2021-02-10 16:22:24 -05:00
end
2021-02-25 14:09:16 -05:00
function player.action.south(actor, place, dialog)
2021-02-10 16:22:24 -05:00
print("Moving south")
2021-02-25 16:32:48 -05:00
tangible.animate(place, {action="walk", dy=-1})
actor:printanimstate()
2021-02-10 16:22:24 -05:00
end
2021-02-25 14:09:16 -05:00
function player.action.east(actor, place, dialog)
2021-02-10 16:22:24 -05:00
print("Moving east")
2021-02-25 16:32:48 -05:00
tangible.animate(place, {action="walk", dx=1})
actor:printanimstate()
2021-02-10 16:22:24 -05:00
end
2021-02-25 14:09:16 -05:00
function player.action.west(actor, place, dialog)
2021-02-10 16:22:24 -05:00
print("Moving west")
2021-02-25 16:32:48 -05:00
tangible.animate(place, {action="walk", dx=-1})
actor:printanimstate()
-- print("actor=", actor)
-- print("place=", place)
-- print("t.actor=", tangible.actor())
-- print("t.place=", tangible.place())
-- wait(1)
-- print("actor=", actor)
-- print("place=", place)
-- print("t.actor=", tangible.actor())
-- print("t.place=", tangible.place())
2021-02-10 16:22:24 -05:00
end
2021-02-25 16:32:48 -05:00