fixed all entities instanced an entity when grabbing functions from parent Entity. now it just sets metatable

This commit is contained in:
lustlion
2022-03-17 00:39:18 +01:00
parent 11a46e6227
commit d359afaf97
9 changed files with 83 additions and 53 deletions

View File

@@ -1,6 +1,8 @@
CursedBook = Entity:new()
CursedBook = {}
CursedBook.type = "CursedBook"
CursedBook.supertype = Entity.type
CursedBook.display = Animation:new(animation.cursed_book.flying)
setmetatable(CursedBook, Entity)
function CursedBook:new(x,y)
local o = Entity:new(x,y)
@@ -28,8 +30,12 @@ function CursedBook:new(x,y)
o:createBox(o.body)
-- light
o.light_range = 500
--o.light = Light:new(o.pos.x,o.pos.y,o.light_range,2,hex2rgb("#fe00d1"))
local light_data = {}
light_data.radius = 500
light_data.shine_radius = 0
light_data.flicker = nil
light_data.color = nil
o.light = Light:new(o.pos.x,o.pos.y,light_data)
o:id()