A Little Space Game made in Love2D
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
487 B

--! file: player.lua
Player = Object:extend()
function Player:new()
self.x = 100
self.y = 100
self.health = 100
self.speed = 100
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()
local vert = { self.x, self.y, (self.x - 70), (self.y + 70), (self.x + 70), (self.y + 70) }
love.graphics.polygon("fill", vert)
end