epervier-old/examples/gameplay/moveplayer/actors/player.lua
Kazhnuz 6f59f1e732 refactor(examples): use updateStart(dt) and updateEnd(dt)
Allow to drop easily some instance of calling the parent's same function
2019-06-13 18:44:13 +02:00

31 lines
612 B
Lua

local cwd = (...):gsub('%.player$', '') .. "."
local Parent = require(cwd .. "parent")
local Player = Parent:extend()
function Player:new(world, x, y, id)
Player.super.new(self, world, "player", x, y, 16, 16, true)
end
function Player:updateStart(dt)
self.xfrc, self.yfrc = 480*3, 480*3
if self.keys["up"].isDown then
self.ysp = -120
end
if self.keys["down"].isDown then
self.ysp = 120
end
if self.keys["left"].isDown then
self.xsp = -120
end
if self.keys["right"].isDown then
self.xsp = 120
end
end
function Player:draw()
Player.super.draw(self)
end
return Player