bugfix and slide animation
- bugfix for hook swing not taking in consideration the length of rope - bugfix for player hitbox size - bugfix for fairy flight control system FCS - added slide animation for wall slide and wall jump
This commit is contained in:
@@ -10,7 +10,7 @@ function Fairy:new(x,y)
|
||||
o.range = 20
|
||||
o.vision_range = 120
|
||||
o.target = {x = x, y = y}
|
||||
o.hover_distance = 60
|
||||
o.hover_distance = 40
|
||||
|
||||
-- animations
|
||||
o.body = Animation:new(animation.fairy.flying)
|
||||
@@ -41,8 +41,8 @@ function Fairy:doLogic()
|
||||
|
||||
local below = 1
|
||||
while not isThereObjectAt(
|
||||
self.target.x,
|
||||
self.target.y + below * game.scale,
|
||||
self.pos.x,
|
||||
self.pos.y + below * game.scale,
|
||||
LoadedObjects.Collisions
|
||||
) do
|
||||
below = below + 1
|
||||
@@ -50,8 +50,8 @@ function Fairy:doLogic()
|
||||
end
|
||||
local top = 1
|
||||
while not isThereObjectAt(
|
||||
self.target.x,
|
||||
self.target.y - top * game.scale,
|
||||
self.pos.x,
|
||||
self.pos.y - top * game.scale,
|
||||
LoadedObjects.Collisions
|
||||
) do
|
||||
top = top + 1
|
||||
|
||||
@@ -71,7 +71,7 @@ function Player:new(x,y)
|
||||
o.mask = Animation:new(animation.moth_mask.idle)
|
||||
|
||||
o:centerOffset(o.body)
|
||||
o:createBox(o.body,0,3,-1,-3)
|
||||
o:createBox(o.body,0,4,-1,-5)
|
||||
|
||||
-- lights
|
||||
o.light = Light:new(o.pos.x,o.pos.y,o.light_radius)
|
||||
@@ -131,10 +131,13 @@ function Player:doLogic()
|
||||
if self.dash_cooldown_timer == 0
|
||||
and not self.is_dashing
|
||||
and self.dash_count > 0 then
|
||||
|
||||
self:unhook()
|
||||
self.nodrift_frames = 0
|
||||
|
||||
-- state player
|
||||
self.is_dashing = true
|
||||
self.is_sliding = false
|
||||
self.dash_count = self.dash_count - 1
|
||||
|
||||
-- get dash direction
|
||||
@@ -312,9 +315,11 @@ function Player:handleAnimation()
|
||||
elseif self.move_x ~= 0 then
|
||||
self.sprite_flip.x = math.sign(self.move_x)
|
||||
end
|
||||
|
||||
-- animation priority
|
||||
if self.vel.y > 1.25 or self.is_sliding then
|
||||
if self.is_sliding then
|
||||
self.body = self.body:change(animation.nancy.slide)
|
||||
self.mask = self.mask:change(self.mask_type.slide)
|
||||
elseif self.vel.y > 1.25 then
|
||||
self.body = self.body:change(animation.nancy.fall)
|
||||
self.mask = self.mask:change(self.mask_type.fall)
|
||||
elseif self.vel.y < 0 then
|
||||
|
||||
Reference in New Issue
Block a user