mirror of
https://gitlab.com/MaddoScientisto/cirnofarm.git
synced 2026-06-05 21:35:55 +00:00
Proper actors implementation
This commit is contained in:
parent
4407ce108b
commit
6a7e938a39
5 changed files with 88 additions and 68 deletions
|
|
@ -1,24 +1,27 @@
|
|||
--M = {}
|
||||
|
||||
actor = {}
|
||||
actor.__index = actor
|
||||
function actor:new(x,y)
|
||||
local o = setmetatable({}, actor)
|
||||
o.x=x
|
||||
o.y=y
|
||||
o.life=100
|
||||
o.spriteIndex=0
|
||||
return o
|
||||
Actor = {
|
||||
life=100,
|
||||
spriteIndex=0,
|
||||
}
|
||||
--actor.__index = actor
|
||||
function Actor:new(new_x,new_y)
|
||||
local o = {
|
||||
x=new_x,
|
||||
y=new_y,
|
||||
}
|
||||
|
||||
return setmetatable(o, {__index=self})
|
||||
end
|
||||
|
||||
function actor:update()
|
||||
function Actor:update()
|
||||
|
||||
end
|
||||
|
||||
function actor:draw()
|
||||
function Actor:draw()
|
||||
spr(self.spriteIndex,self.x,self.y)
|
||||
end
|
||||
|
||||
--M.actor = actor
|
||||
|
||||
return actor
|
||||
return Actor
|
||||
Loading…
Add table
Add a link
Reference in a new issue