naming convention for most stuff but not all
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
CursedBook = Entity:New()
|
||||
CursedBook = Entity:new()
|
||||
|
||||
function CursedBook:New(x,y)
|
||||
local o = Entity:New(x,y)
|
||||
function CursedBook:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
||||
o.type = "cursed_book"
|
||||
-- behaviour
|
||||
@@ -20,14 +20,14 @@ function CursedBook:New(x,y)
|
||||
o.attack_range = 50
|
||||
|
||||
-- animations
|
||||
o.body = Animation:New(animation.cursed_book.spawn)
|
||||
o.body = Animation:new(animation.cursed_book.spawn)
|
||||
o.sprite_tint = {0.7,0.7,0.7}
|
||||
o:centerOffset(o.body)
|
||||
o:getBoundingBox(o.body)
|
||||
o:createBox(o.body)
|
||||
|
||||
-- light
|
||||
o.light_range = 500
|
||||
o.light = Light:New(o.pos.x,o.pos.y,o.light_range,2,HEX2RGB("#fe00d1"))
|
||||
o.light = Light:new(o.pos.x,o.pos.y,o.light_range,2,HEX2RGB("#fe00d1"))
|
||||
|
||||
table.insert(LoadedObjects.Entities,o)
|
||||
o.id = #LoadedObjects.Entities
|
||||
@@ -37,7 +37,7 @@ function CursedBook:New(x,y)
|
||||
return o
|
||||
end
|
||||
|
||||
function CursedBook:Smart()
|
||||
function CursedBook:doLogic()
|
||||
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 distance_x = self.target.x - self.pos.x
|
||||
@@ -66,7 +66,7 @@ function CursedBook:Smart()
|
||||
end
|
||||
end
|
||||
|
||||
function CursedBook:HandleAnimation()
|
||||
function CursedBook:handleAnimation()
|
||||
if self.status == 1 then
|
||||
if self.body.path == "assets/entities/cursed_book/spawn" then
|
||||
self.body.speed = 1/3
|
||||
@@ -74,7 +74,7 @@ function CursedBook:HandleAnimation()
|
||||
self.sprite_tint = {tint,tint,tint}
|
||||
if self.body.frame == self.body.frames then
|
||||
self.status = 2
|
||||
self.body = self.body:ChangeTo(animation.cursed_book.flying)
|
||||
self.body = self.body:change(animation.cursed_book.flying)
|
||||
self.sprite_tint = {1,1,1}
|
||||
--self:getBoundingBox(self.body,2,2,-2,-2)
|
||||
self:centerOffset(self.body)
|
||||
@@ -82,21 +82,21 @@ function CursedBook:HandleAnimation()
|
||||
end
|
||||
elseif self.status == 3 then
|
||||
if self.body.path == "assets/entities/cursed_book/flying" then
|
||||
self.body = self.body:ChangeTo(animation.cursed_book.attack_transition)
|
||||
self.body = self.body:change(animation.cursed_book.attack_transition)
|
||||
self.body.speed = 1/3
|
||||
self:centerOffset(self.body)
|
||||
if self.body.frame == self.body.frames then
|
||||
self.status = 4
|
||||
self.body = self.body:ChangeTo(animation.cursed_book.attack_loop)
|
||||
self.body = self.body:change(animation.cursed_book.attack_loop)
|
||||
self:centerOffset(self.body)
|
||||
end
|
||||
end
|
||||
end
|
||||
self.body:Animate()
|
||||
self:Draw(self.body)
|
||||
self.body:animate()
|
||||
self:draw(self.body)
|
||||
end
|
||||
|
||||
function CursedBook:DoPhysics()
|
||||
function CursedBook:doPhysics()
|
||||
if self.isFlying then
|
||||
local random_x = math.random(-4, 4)/100
|
||||
local random_y = math.random(-4, 4)/100
|
||||
@@ -105,11 +105,11 @@ function CursedBook:DoPhysics()
|
||||
end
|
||||
-- move
|
||||
|
||||
self:CollisionMove()
|
||||
self:LightAdjust()
|
||||
self:moveWithCollision()
|
||||
self:adjustLight()
|
||||
end
|
||||
|
||||
function CursedBook:Debug()
|
||||
function CursedBook:debug()
|
||||
-- draw center GREEN
|
||||
love.graphics.setColor(0,1,0)
|
||||
love.graphics.circle("line", -Camera.pos.x + self.pos.x, -Camera.pos.y + self.pos.y, self.spawn_range)
|
||||
|
||||
Reference in New Issue
Block a user