|
|
@ -5,11 +5,19 @@ function Player:new() |
|
|
self.x = 100 |
|
|
self.x = 100 |
|
|
self.y = 100 |
|
|
self.y = 100 |
|
|
self.health = 100 |
|
|
self.health = 100 |
|
|
|
|
|
self.speed = 100 |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
function Player:update(dt) end |
|
|
function Player:update(dt) |
|
|
|
|
|
if love.keyboard.isDown("left") then |
|
|
|
|
|
self.x = self.x - self.speed * dt |
|
|
|
|
|
end |
|
|
|
|
|
if love.keyboard.isDown("right") then |
|
|
|
|
|
self.x = self.x + self.speed * dt |
|
|
|
|
|
end |
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
function Player:draw() |
|
|
function Player:draw() |
|
|
local vert = { self.x, self.y, (self.x - 50), (self.y - 50), (self.x + 50), (self.y - 50) } |
|
|
local vert = { self.x, self.y, (self.x - 70), (self.y + 70), (self.x + 70), (self.y + 70) } |
|
|
love.graphics.polygon("fill", vert) |
|
|
love.graphics.polygon("fill", vert) |
|
|
end |
|
|
end |
|
|
|