more naming convention

now there are spawn objects!
now entity spawns are loaded from level!
now entity spawns are saved to level!
This commit is contained in:
lustlion
2022-03-08 09:34:51 +01:00
parent a8ffae726f
commit 0acbfd5e9d
24 changed files with 165 additions and 139 deletions

View File

@@ -1,10 +1,10 @@
Arrow = Entity:new()
Arrow.type = "Arrow"
function Arrow:new(x,y,rotation,speed)
local o = Entity:new(x,y)
o.type = "arrow"
o.pos = {x = x, y = y}
o.speed = speed or 10
o.sprite_rotation = rotation or 0

View File

@@ -1,9 +1,9 @@
CursedBook = Entity:new()
CursedBook.type = "CursedBook"
function CursedBook:new(x,y)
local o = Entity:new(x,y)
o.type = "cursed_book"
-- behaviour
o.pos = {x = x, y = y}
o.speed = 0.01

View File

@@ -1,10 +1,9 @@
Decoration = Entity:new()
Decoration.type = "Decoration"
function Decoration:new(x,y,animation,light_radius)
local o = Entity:new(x,y)
o.type = "decoration"
o.pos = {x = x, y = y}
-- animations

View File

@@ -1,10 +1,9 @@
Fairy = Entity:new()
Fairy.type = "Fairy"
function Fairy:new(x,y)
local o = Entity:new(x,y)
o.type = "fairy"
-- behaviour
o.pos = {x = x, y = y}
o.speed = 1.4

View File

@@ -1,9 +1,9 @@
HookAnchor = Entity:new()
HookAnchor.type = "HookAnchor"
function HookAnchor:new(x,y,hook_distance)
local o = Entity:new(x,y)
o.type = "hook_anchor"
o.pos = {x = x, y = y}
o.hook_distance = hook_distance or 100

View File

@@ -1,10 +1,9 @@
Kupo = Entity:new()
Kupo.type = "Kupo"
function Kupo:new(x,y)
local o = Entity:new(x,y)
o.type = "kupo"
o.pos = {x = x, y = y}
o.speed = 20
o.range = 200
@@ -142,7 +141,7 @@ function Kupo:handleAnimation()
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
self.body:animate()
self:Draw(self.body)
self:draw(self.body)
if self.draw_bow == true then
self.bow:drawFrame(

View File

@@ -1,6 +1,8 @@
Particle = Entity:new()
LoadedObjects.Particles = {}
Particle = Entity:new()
Particle.type = "Particle"
function Particle:new(x,y,particle_data)
local o = Entity:new(x,y)

View File

@@ -1,9 +1,9 @@
Player = Entity:new()
Player.type = "Player"
function Player:new(x,y)
local o = Entity:new(x,y)
o.type = "player"
-- physics
o.zero_speed = 0.01 -- gameworld pixels
@@ -166,7 +166,7 @@ function Player:doLogic()
if self.is_hooked then
self:unhook()
else
local anchor = self:checkNearest("hook_anchor",self.hook_distance)
local anchor = self:checkNearest("HookAnchor",self.hook_distance)
if anchor then
self.is_hooked = true
self.hook_distance = anchor.hook_distance