naming conventions act 2: the end
This commit is contained in:
@@ -20,14 +20,13 @@ function Fairy:new(x,y)
|
||||
|
||||
-- light
|
||||
o.light_radius = 80
|
||||
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius,nil,HEX2RGB("#fed100"))
|
||||
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius,nil,hex2rgb("#fed100"))
|
||||
|
||||
-- timer
|
||||
o.particle_timer = 0
|
||||
o.particle_time = 5
|
||||
|
||||
table.insert(LoadedObjects.Entities,o)
|
||||
o.id = #LoadedObjects.Entities
|
||||
o:id()
|
||||
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
@@ -36,10 +35,10 @@ end
|
||||
|
||||
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
|
||||
self.target.x = main_player.pos.x + main_player.target_offset.x
|
||||
self.target.y = main_player.pos.y + main_player.target_offset.y
|
||||
|
||||
local below = 1
|
||||
while not isThereObjectAt(
|
||||
@@ -64,7 +63,7 @@ function Fairy:doLogic()
|
||||
|
||||
local distance_x = self.target.x - self.pos.x
|
||||
local distance_y = self.target.y - self.pos.y
|
||||
local angle = GetAngleFromVector(distance_x,distance_y)
|
||||
local angle = getAngleFromVector(distance_x,distance_y)
|
||||
local distance = math.sqrt(distance_x ^ 2 + distance_y ^ 2)
|
||||
|
||||
if distance < self.range then
|
||||
@@ -80,7 +79,7 @@ function Fairy:doLogic()
|
||||
|
||||
local particle_data = {
|
||||
animation = animation.particle.simple,
|
||||
sprite_tint = HEX2RGB("#fed100"),
|
||||
sprite_tint = hex2rgb("#fed100"),
|
||||
direction = angle-math.rad(180+math.random(60)-30),
|
||||
speed = 0.8*(distance/50),
|
||||
speed_increase = -0.01,
|
||||
@@ -91,7 +90,7 @@ end
|
||||
|
||||
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
|
||||
--if self:isCollidingWith(main_player) then self.sprite_tint = {1,0,0} else self.sprite_tint = {1,1,1} end
|
||||
self:draw(self.body)
|
||||
end
|
||||
|
||||
@@ -111,5 +110,5 @@ end
|
||||
|
||||
function Fairy:debug()
|
||||
Entity.debug(self)
|
||||
self:checkVisionLineDebug(main_Player,self.vision_range)
|
||||
self:checkVisionLineDebug(main_player,self.vision_range)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user