Proper actors implementation

This commit is contained in:
MaddoScientisto 2024-04-26 11:22:51 +02:00
commit 6a7e938a39
5 changed files with 88 additions and 68 deletions

View file

@ -1,4 +1,4 @@
--local actor = require("actor2")
local Actor = require(make_path("actor2"))
-- barrel = setmetatable({}, {__index = actor})
-- function barrel:new(actor)
@ -9,25 +9,18 @@
-- return barrel
barrel = {}
barrel.__index = barrel
function barrel:new(x,y)
local o = setmetatable({}, barrel)
o.x=x
o.y=y
o.life=100
o.spriteIndex=0
return o
end
Barrel = Actor:new()
Barrel.spriteIndex = 3
function barrel:update()
function Barrel:update()
end
function barrel:draw()
spr(self.spriteIndex,self.x,self.y)
end
--function Barrel:draw()
-- spr(self.spriteIndex,self.x,self.y)
--end
--M.actor = actor
return barrel
return Barrel