YAY
- Mask functionality - Rehandled Animations (now consistent)
This commit is contained in:
@@ -8,8 +8,12 @@ Kupo = Entity:New(x,y)
|
||||
o.range = 200
|
||||
o.target = {x = x, y = y}
|
||||
o.sprite_offset = {x = 8, y = 5}
|
||||
-- kupo bow
|
||||
o.bow = self:NewAnimation(animation.kupo.bow)
|
||||
|
||||
-- animations
|
||||
o.body = Animation:New(animation.kupo.body)
|
||||
o.bow = Animation:New(animation.kupo.bow)
|
||||
|
||||
-- bow
|
||||
o.bow_flip = 1
|
||||
o.bow_rotation = 0
|
||||
o.bow_frame = 1
|
||||
@@ -19,7 +23,7 @@ Kupo = Entity:New(x,y)
|
||||
o.bow_frames = 6
|
||||
o.bow_extraframes = 18
|
||||
o.bow_aim_frames = 8
|
||||
o.hostile = false
|
||||
o.hostile = true
|
||||
|
||||
o.lightRange = o.range/10
|
||||
o.light = CreateLight(o.pos.x,o.pos.y,o.lightRange)
|
||||
@@ -131,29 +135,24 @@ end
|
||||
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:LoadAnimation(animation.kupo.body)
|
||||
|
||||
self.body:Animate()
|
||||
self.body:Draw(
|
||||
self.pos.x - Camera.pos.x - ( (self.sprite_offset.x) * math.cos(self.sprite_rotation) - (self.sprite_offset.y) * math.sin(self.sprite_rotation)) * self.sprite_scale.x * self.sprite_flip.x,
|
||||
self.pos.y - Camera.pos.y - ( (self.sprite_offset.x) * math.sin(self.sprite_rotation) + (self.sprite_offset.y) * math.cos(self.sprite_rotation)) * self.sprite_scale.y * self.sprite_flip.y,
|
||||
self.sprite_rotation,
|
||||
self.sprite_scale.x * self.sprite_flip.x,
|
||||
self.sprite_scale.y * self.sprite_flip.y
|
||||
)
|
||||
|
||||
if self.draw_bow == true then
|
||||
DrawAnimationFrame(
|
||||
self.bow,
|
||||
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)),
|
||||
self.bow_rotation
|
||||
)
|
||||
end
|
||||
if debug_collision then
|
||||
love.graphics.setColor(1,0,0)
|
||||
love.graphics.line(
|
||||
self.pos.x - Camera.pos.x,
|
||||
self.pos.y - Camera.pos.y,
|
||||
self.target.x - Camera.pos.x,
|
||||
self.target.y - Camera.pos.y
|
||||
)
|
||||
love.graphics.circle( "line", self.pos.x - Camera.pos.x, self.pos.y - Camera.pos.y, self.range )
|
||||
love.graphics.setColor(1,1,1)
|
||||
love.graphics.print(self.bow_rotation, self.pos.x, self.pos.y+30)
|
||||
love.graphics.print(self.angle, self.pos.x, self.pos.y+50)
|
||||
end
|
||||
end
|
||||
|
||||
function Kupo:DoPhysics()
|
||||
|
||||
Reference in New Issue
Block a user