2019-04-07 17:00:47 +02:00
|
|
|
local cwd = (...):gsub('%.player$', '') .. "."
|
|
|
|
local Parent = require(cwd .. "parent")
|
|
|
|
local Player = Parent:extend()
|
|
|
|
|
2019-04-29 15:27:40 +02:00
|
|
|
function Player:new(world, x, y, id)
|
2019-04-25 17:54:51 +02:00
|
|
|
Player.super.new(self, world, "player", x, y, 16, 16, true)
|
2019-04-29 15:27:40 +02:00
|
|
|
self.playerid = id
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
function Player:update(dt)
|
2019-04-28 09:31:37 +02:00
|
|
|
self.xfrc, self.yfrc = 480*3, 480*3
|
2019-04-29 15:27:40 +02:00
|
|
|
|
2019-04-07 22:53:59 +02:00
|
|
|
if self.keys["up"].isDown then
|
2019-04-22 12:02:52 +02:00
|
|
|
self.ysp = -120
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
2019-04-07 22:53:59 +02:00
|
|
|
if self.keys["down"].isDown then
|
2019-04-22 12:02:52 +02:00
|
|
|
self.ysp = 120
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
2019-04-07 22:53:59 +02:00
|
|
|
if self.keys["left"].isDown then
|
2019-04-22 12:02:52 +02:00
|
|
|
self.xsp = -120
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
2019-04-07 22:53:59 +02:00
|
|
|
if self.keys["right"].isDown then
|
2019-04-22 12:02:52 +02:00
|
|
|
self.xsp = 120
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
|
|
|
|
2019-04-13 09:40:14 +02:00
|
|
|
Player.super.update(self, dt)
|
2019-04-07 17:00:47 +02:00
|
|
|
end
|
|
|
|
|
2019-04-29 15:27:40 +02:00
|
|
|
function Player:draw()
|
|
|
|
Player.super.draw(self)
|
|
|
|
love.graphics.print(self.playerid, self.x, self.y)
|
|
|
|
end
|
|
|
|
|
2019-04-07 17:00:47 +02:00
|
|
|
return Player
|