naming convention for most stuff but not all

This commit is contained in:
lustlion
2022-03-04 23:28:30 +01:00
parent c978855711
commit cef2096577
29 changed files with 354 additions and 436 deletions

View File

@@ -1,7 +1,7 @@
Fairy = Entity:New()
Fairy = Entity:new()
function Fairy:New(x,y)
local o = Entity:New(x,y)
function Fairy:new(x,y)
local o = Entity:new(x,y)
o.type = "fairy"
@@ -14,13 +14,13 @@ function Fairy:New(x,y)
o.hover_distance = 60
-- animations
o.body = Animation:New(animation.fairy.flying)
o.body = Animation:new(animation.fairy.flying)
o:centerOffset(o.body)
o:getBoundingBox(o.body)
o:createBox(o.body)
-- light
o.light_range = 80
o.light = Light:New(o.pos.x,o.pos.y,o.light_range,nil,HEX2RGB("#fed100"))
o.light_radius = 80
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius,nil,HEX2RGB("#fed100"))
-- timer
o.particle_timer = 0
@@ -34,9 +34,9 @@ function Fairy:New(x,y)
return o
end
function Fairy:Smart()
function Fairy:doLogic()
if self:CheckVisionLine(main_Player,self.vision_range) then
if self:checkVisionLine(main_Player,self.vision_range) then
self.target.x = main_Player.pos.x + main_Player.target_offset.x
self.target.y = main_Player.pos.y + main_Player.target_offset.y
@@ -85,31 +85,31 @@ function Fairy:Smart()
speed = 0.8*(distance/50),
speed_increase = -0.01,
}
Particle:New(self.pos.x,self.pos.y,particle_data)
Particle:new(self.pos.x,self.pos.y,particle_data)
end
end
function Fairy:HandleAnimation()
self.body:Animate()
function Fairy:handleAnimation()
self.body:animate()
--if self:isCollidingWith(main_Player) then self.sprite_tint = {1,0,0} else self.sprite_tint = {1,1,1} end
self:Draw(self.body)
self:draw(self.body)
end
function Fairy:DoPhysics()
function Fairy:doPhysics()
local random_x = math.random(-4, 4)/10
local random_y = math.random(-4, 4)/10
self.vel.x = self.vel.x + random_x
self.vel.y = self.vel.y + random_y
self:CollisionMove()
self:moveWithCollision()
self.vel.x = 0
self.vel.y = 0
self:LightAdjust()
self:adjustLight()
end
function Fairy:Debug()
Entity.Debug(self)
self:CheckVisionLineDebug(main_Player,self.vision_range)
function Fairy:debug()
Entity.debug(self)
self:checkVisionLineDebug(main_Player,self.vision_range)
end