cirnofarm/src/actor2.lua

40 lines
558 B
Lua
Raw Normal View History

2024-04-25 23:07:49 +02:00
--M = {}
2024-04-28 17:06:07 +02:00
Actor = {}
2024-04-26 11:22:51 +02:00
--actor.__index = actor
function Actor:new(new_x,new_y)
local o = {
x=new_x,
2024-04-26 14:24:25 +02:00
y=new_y,
w=16,
2024-04-28 17:06:07 +02:00
h=16,
life=100,
shootable=false
--spriteIndex=0
2024-04-26 11:22:51 +02:00
}
return setmetatable(o, {__index=self})
2024-04-25 23:07:49 +02:00
end
2024-04-26 11:22:51 +02:00
function Actor:update()
2024-04-25 23:07:49 +02:00
end
2024-04-28 17:06:07 +02:00
function Actor:destroy()
end
function Actor:damage(amount)
self.life -= amount
if (self.life <= 0) then
self:destroy()
end
end
2024-04-26 11:22:51 +02:00
function Actor:draw()
2024-04-25 23:07:49 +02:00
spr(self.spriteIndex,self.x,self.y)
end
--M.actor = actor
2024-04-26 11:22:51 +02:00
return Actor