epervier-old/examples/gameplay/moveplayer3D/actors/player.lua

40 lines
778 B
Lua
Raw Normal View History

local cwd = (...):gsub('%.player$', '') .. "."
local Parent = require(cwd .. "parent")
local Player = Parent:extend()
function Player:new(world, x, y, z, id)
Player.super.new(self, world, "player", x, y, 0, 16, 16, 24, true)
self:setGravity(480)
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
if self.keys["A"].isDown then
self.zsp = 280
end
end
function Player:draw()
Player.super.draw(self)
end
function Player:drawHUD(id)
love.graphics.print(id .. " test", 4, 4)
end
return Player