use class() in more places
This commit is contained in:
parent
fa62e1428b
commit
8edcbe2d9b
@ -1,4 +1,4 @@
|
||||
Collision = {}
|
||||
Collision = class()
|
||||
|
||||
LoadedObjects.Collisions = {}
|
||||
LoadedObjects.Platforms = {}
|
||||
@ -48,7 +48,6 @@ function Collision:new(ox,oy,tx,ty)
|
||||
end
|
||||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
|
||||
return o
|
||||
end
|
||||
|
@ -1,8 +1,7 @@
|
||||
Arrow = {}
|
||||
Arrow.type = "Arrow"
|
||||
Arrow.supertype = Entity.type
|
||||
Arrow.display = Animation:new(animation.kupo.arrow)
|
||||
setmetatable(Arrow, Entity)
|
||||
Arrow = class(Entity, {
|
||||
type = "Arrow",
|
||||
display = Animation:new(animation.kupo.arrow),
|
||||
})
|
||||
|
||||
|
||||
function Arrow:new(x,y,rotation,speed)
|
||||
|
@ -1,8 +1,7 @@
|
||||
CursedBook = {}
|
||||
CursedBook.type = "CursedBook"
|
||||
CursedBook.supertype = Entity.type
|
||||
CursedBook.display = Animation:new(animation.cursed_book.flying)
|
||||
setmetatable(CursedBook, Entity)
|
||||
CursedBook = class(Entity, {
|
||||
type = "CursedBook",
|
||||
display = Animation:new(animation.cursed_book.flying),
|
||||
})
|
||||
|
||||
function CursedBook:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -1,8 +1,7 @@
|
||||
Candelabra = {}
|
||||
Candelabra.type = "Candelabra"
|
||||
Candelabra.supertype = Decoration.type
|
||||
Candelabra.display = Animation:new(animation.decoration.candelabra)
|
||||
setmetatable(Candelabra, Decoration)
|
||||
Candelabra = class(Decoration, {
|
||||
type = "Candelabra",
|
||||
display = Animation:new(animation.decoration.candelabra),
|
||||
})
|
||||
|
||||
function Candelabra:new(x,y)
|
||||
local light_data = {}
|
||||
|
@ -1,8 +1,7 @@
|
||||
Fairy = {}
|
||||
Fairy.type = "Fairy"
|
||||
Fairy.supertype = Entity.type
|
||||
Fairy.display = Animation:new(animation.fairy.flying)
|
||||
setmetatable(Fairy, Entity)
|
||||
Fairy = class(Entity, {
|
||||
type = "Fairy",
|
||||
display = Animation:new(animation.fairy.flying),
|
||||
})
|
||||
|
||||
function Fairy:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -1,8 +1,7 @@
|
||||
HookAnchor = {}
|
||||
HookAnchor.type = "HookAnchor"
|
||||
HookAnchor.supertype = Entity.type
|
||||
HookAnchor.display = Animation:new(animation.fairy.flying)
|
||||
setmetatable(HookAnchor, Entity)
|
||||
HookAnchor = class(Entity, {
|
||||
type = "HookAnchor",
|
||||
display = Animation:new(animation.fairy.flying),
|
||||
})
|
||||
|
||||
function HookAnchor:new(x,y,hook_distance)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -1,8 +1,7 @@
|
||||
Kupo = {}
|
||||
Kupo.type = "Kupo"
|
||||
Kupo.supertype = Entity.type
|
||||
Kupo.display = Animation:new(animation.kupo.body)
|
||||
setmetatable(Kupo, Entity)
|
||||
Kupo = class(Entity, {
|
||||
type = "Kupo",
|
||||
display = Animation:new(animation.kupo.body),
|
||||
})
|
||||
|
||||
function Kupo:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -1,9 +1,8 @@
|
||||
LoadedObjects.Particles = {}
|
||||
Particle = {}
|
||||
Particle.type = "Particle"
|
||||
Particle.supertype = Entity.type
|
||||
Particle.display = Animation:new(animation.particle.simple)
|
||||
setmetatable(Particle, Entity)
|
||||
Particle = class(Entity, {
|
||||
type = "Particle",
|
||||
display = Animation:new(animation.particle.simple),
|
||||
})
|
||||
|
||||
function Particle:new(x,y,particle_data)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -1,8 +1,7 @@
|
||||
Player = {}
|
||||
Player.type = "Player"
|
||||
Player.supertype = Entity.type
|
||||
Player.display = Animation:new(animation.nancy.idle)
|
||||
setmetatable(Player, Entity)
|
||||
Player = class(Entity, {
|
||||
type = "Player",
|
||||
display = Animation:new(animation.nancy.idle),
|
||||
})
|
||||
|
||||
function Player:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
@ -13,7 +13,7 @@ local function backspace(text)
|
||||
return ""
|
||||
end
|
||||
|
||||
Prompt = {
|
||||
Prompt = class(nil, {
|
||||
-- defaults for instance variables
|
||||
pos = { x = 10, y = 10 },
|
||||
input = "",
|
||||
@ -23,7 +23,7 @@ Prompt = {
|
||||
color = {1,1,1,1},
|
||||
background_color = {0,0,0,1},
|
||||
active_prompt = nil,
|
||||
}
|
||||
})
|
||||
function Prompt:cancelActive()
|
||||
if Prompt.active_prompt then
|
||||
Prompt.active_prompt.canceled = true
|
||||
@ -33,7 +33,6 @@ end
|
||||
function Prompt:new(o)
|
||||
o = o or {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
return o
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user