Code: Select all
require("class")
entity = class:new()
function entity:new()
self.x = 100
self.y = 100
self.width = 32
self.height = 32
self.info = "entity"
self.alive = true
self.color = {r = 255, g = 0, b = 0}
return self
end
function entity:load()
end
function entity:update()
if self.alive then
end
end
function entity:draw()
if self.alive then
love.graphics.setColor(self.color.r, self.color.g, self.color.b)
end
end
function entity:destroy()
self.alive = false
end
Code: Select all
require("entity")
player = entity:new()
function player:load()
end
function player:draw()
love.graphics.rectangle("fill", self.x, self.y, self.width, self.height)
end
function player:update()
self.x = self.x + 5
end
So could anyone help me with this? All help is appreciated.