mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-01 11:15:34 +00:00
40 lines
No EOL
558 B
Lua
40 lines
No EOL
558 B
Lua
--M = {}
|
|
|
|
Actor = {}
|
|
--actor.__index = actor
|
|
function Actor:new(new_x,new_y)
|
|
local o = {
|
|
x=new_x,
|
|
y=new_y,
|
|
w=16,
|
|
h=16,
|
|
life=100,
|
|
shootable=false
|
|
--spriteIndex=0
|
|
}
|
|
|
|
return setmetatable(o, {__index=self})
|
|
end
|
|
|
|
function Actor:update()
|
|
|
|
end
|
|
|
|
function Actor:destroy()
|
|
|
|
end
|
|
|
|
function Actor:damage(amount)
|
|
self.life -= amount
|
|
if (self.life <= 0) then
|
|
self:destroy()
|
|
end
|
|
end
|
|
|
|
function Actor:draw()
|
|
spr(self.spriteIndex,self.x,self.y)
|
|
end
|
|
|
|
--M.actor = actor
|
|
|
|
return Actor |