Skip to content

Commit

Permalink
Fixed diagonal dash launching downwards after colliding ground
Browse files Browse the repository at this point in the history
fixed dash being excended upon dashing upwards from ground
  • Loading branch information
kot9pa16lvl committed Apr 7, 2024
1 parent 2b00c60 commit ccd230f
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions CelesteDash/CelesteDash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ private void CCancelRecoulHz(On.HeroController.orig_CancelRecoilHorizontal orig,

private void CUpdate()
{


if ((HeroControllerR.cState.recoilingLeft))
{
if (slashBoostOption) { canExceedSpeed = true; }
Expand All @@ -153,8 +155,8 @@ private void CUpdate()
{
if (slashBoostOption) { canExceedSpeed = true; }
HeroControllerR.rb2d.velocity = new Vector2(recoilSpeed, HeroControllerR.rb2d.velocity.y);
}
if (HeroControllerR.cState.onGround && (HeroControllerR.dashCooldownTimer <= 0f))
}
if (HeroControllerR.cState.onGround && (HeroControllerR.dashCooldownTimer <= 0f)) ///refill on wallslide
{
isDashJumpExtended = true;
}
Expand Down Expand Up @@ -194,6 +196,8 @@ private void CDash(On.HeroController.orig_Dash orig, HeroController self)
//HeroControllerR.dashBurst.transform.localPosition = new Vector3(-0.07f, 3.74f, 0.01f);
if (dashDir.x < EPS) { dashAngle = 180f - dashAngle; }
HeroControllerR.dashBurst.transform.localEulerAngles = new Vector3(0f, 0f, dashAngle);

if (dashDir.y > EPS) { HeroControllerR.airDashed = true; }
}
groundFrames = 0;
dashFrames++;
Expand All @@ -216,12 +220,22 @@ private void CDash(On.HeroController.orig_Dash orig, HeroController self)
//dashDir = Vector2.zero; intended ultra
return;
}
HeroControllerR.rb2d.velocity = dashDir;

if ((HeroControllerR.dash_timer < EPS) || (dashDir.y > EPS)) // first time entering dash
{ HeroControllerR.rb2d.velocity = dashDir; }
if ((!HeroControllerR.cState.onGround) && (dashDir.y < -EPS) && (Math.Abs(HeroControllerR.rb2d.velocity.y) < EPS)) //diagonal dash hit ground and left it
{
Vector2 lastVel = HeroControllerR.rb2d.velocity;
HeroControllerR.FinishedDashing();
HeroControllerR.rb2d.velocity = lastVel;
return;
}
if (HeroControllerR.cState.onGround)
{
isDashJumpExtended = true;
if (dashDir.y < -0.001f)
{

HeroControllerR.rb2d.velocity = new Vector2(dashDir.x, 0f);// * (float)Math.Sqrt(2), 0f);
}
}
Expand Down

0 comments on commit ccd230f

Please sign in to comment.