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 @@
Kupo = Entity:new()
Kupo = {}
Kupo.type = "Kupo"
Kupo.supertype = Entity.type
Kupo.display = Animation:new(animation.kupo.body)
setmetatable(Kupo, Entity)
function Kupo:new(x,y)
local o = Entity:new(x,y)
@@ -27,8 +29,13 @@ function Kupo:new(x,y)
o.bow_aim_frames = 8
o.hostile = true
o.light_radius = o.range/2
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius)
-- light values
local light_data = {}
light_data.radius = 100
light_data.shine_radius = 20
light_data.flicker = nil
light_data.color = nil
o.light = Light:new(o.pos.x,o.pos.y,light_data)
o:id()