naming convention for most stuff but not all
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
Kupo = Entity:New()
|
||||
Kupo = Entity:new()
|
||||
|
||||
function Kupo:New(x,y)
|
||||
local o = Entity:New(x,y)
|
||||
function Kupo:new(x,y)
|
||||
local o = Entity:new(x,y)
|
||||
|
||||
o.type = "kupo"
|
||||
|
||||
@@ -12,8 +12,8 @@ function Kupo:New(x,y)
|
||||
o.sprite_offset = {x = 8, y = 5}
|
||||
|
||||
-- animations
|
||||
o.body = Animation:New(animation.kupo.body)
|
||||
o.bow = Animation:New(animation.kupo.bow)
|
||||
o.body = Animation:new(animation.kupo.body)
|
||||
o.bow = Animation:new(animation.kupo.bow)
|
||||
|
||||
-- bow
|
||||
o.bow_flip = 1
|
||||
@@ -27,8 +27,8 @@ function Kupo:New(x,y)
|
||||
o.bow_aim_frames = 8
|
||||
o.hostile = true
|
||||
|
||||
o.lightRange = o.range/2
|
||||
o.light = Light:New(o.pos.x,o.pos.y,o.lightRange)
|
||||
o.light_radius = o.range/2
|
||||
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius)
|
||||
|
||||
table.insert(LoadedObjects.Entities,o)
|
||||
o.id = #LoadedObjects.Entities
|
||||
@@ -38,9 +38,8 @@ function Kupo:New(x,y)
|
||||
return o
|
||||
end
|
||||
|
||||
function Kupo:Smart()
|
||||
self.light.pos.x = self.pos.x-self.target_offset.x
|
||||
self.light.pos.y = self.pos.y-self.target_offset.y
|
||||
function Kupo:doLogic()
|
||||
self:adjustLight(self.target_offset.x,self.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
|
||||
@@ -89,7 +88,7 @@ function Kupo:Smart()
|
||||
if self.bow_aim_frame > self.bow_aim_frames then
|
||||
self.bow_aim_frame = self.bow_aim_frame - self.bow_aim_frames
|
||||
self.bow_frame = self.bow_frame + 1
|
||||
Arrow:New(self.pos.x,self.pos.y,self.bow_rotation,10)
|
||||
Arrow:new(self.pos.x,self.pos.y,self.bow_rotation,10)
|
||||
end
|
||||
else
|
||||
self.bow_frame = self.bow_frame + 1
|
||||
@@ -130,7 +129,7 @@ function Kupo:Smart()
|
||||
self.angle = angle
|
||||
end
|
||||
|
||||
function Kupo:HandleAnimation()
|
||||
function Kupo:handleAnimation()
|
||||
local distance_x = self.target.x - self.pos.x
|
||||
local distance_y = self.target.y - self.pos.y
|
||||
|
||||
@@ -143,11 +142,11 @@ function Kupo:HandleAnimation()
|
||||
-- flip sprite to look in the direction is moving
|
||||
if self.vel.x ~= 0 then self.sprite_flip.x = math.sign(self.vel.x) end
|
||||
|
||||
self.body:Animate()
|
||||
self.body:animate()
|
||||
self:Draw(self.body)
|
||||
|
||||
if self.draw_bow == true then
|
||||
self.bow:DrawFrame(
|
||||
self.bow:drawFrame(
|
||||
math.min(self.bow_frame,self.bow_frames),
|
||||
self.pos.x + ( 8 * math.sin(self.bow_rotation)),
|
||||
self.pos.y + (2 - 6 * math.cos(self.bow_rotation)),
|
||||
@@ -156,6 +155,6 @@ function Kupo:HandleAnimation()
|
||||
end
|
||||
end
|
||||
|
||||
function Kupo:DoPhysics()
|
||||
self:CollisionMove()
|
||||
function Kupo:doPhysics()
|
||||
self:moveWithCollision()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user