Skip to content

Commit

Permalink
Shadowdash effect now has correct angle
Browse files Browse the repository at this point in the history
  • Loading branch information
kot9pa16lvl committed Apr 9, 2024
1 parent 62c8330 commit 98b732f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions CelesteDash/CelesteDash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,27 @@ private void CDash(On.HeroController.orig_Dash orig, HeroController self)
{
if (HeroControllerR.dash_timer < EPS) // first time entering dash
{
if ((dashDir.x > EPS) && (!HeroControllerR.cState.facingRight)) { HeroControllerR.FaceRight(); }
if ((dashDir.x < -EPS) && (HeroControllerR.cState.facingRight)) { HeroControllerR.FaceLeft(); }
float dashAngle = Vector2.SignedAngle(dashDir, new Vector2(1f, 0f));
float shadowDashAngle = dashAngle;
Vector2 particleDashDir = -dashDir.normalized * 3.74f;
Vector2 particleShadowDashDir = -dashDir.normalized * 5.21f;
if (dashDir.y > EPS) { particleDashDir.y -= 1f; }
HeroControllerR.dashBurst.transform.localPosition = new Vector3(Math.Abs(particleDashDir.x), particleDashDir.y, 0.01f);
//HeroControllerR.dashBurst.transform.localPosition = new Vector3(-0.07f, 3.74f, 0.01f);

if (dashDir.x < EPS) { dashAngle = 180f - dashAngle; }
if (dashDir.x < -EPS) { shadowDashAngle = 180 - shadowDashAngle; }
if ( (HeroControllerR.cState.facingRight) && !((dashDir.y < -EPS) && (Math.Abs(dashDir.x) < EPS)) )
{ shadowDashAngle = -shadowDashAngle; }
HeroControllerR.dashBurst.transform.localEulerAngles = new Vector3(0f, 0f, dashAngle);
//if (shadowDashAngle.y < EPS) { shadowDashAngle += 360f; }
//if (HeroControllerR.cState.shadowDashing)
//{
// HeroControllerR.dashEffect.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
//}
if (HeroControllerR.cState.shadowDashing)
{
HeroControllerR.dashEffect.transform.localEulerAngles = new Vector3(0f, 0f, shadowDashAngle);
HeroControllerR.dashEffect.transform.localPosition = new Vector3(particleShadowDashDir.x, particleShadowDashDir.y, 0.01f) + HeroControllerR.rb2d.transform.position;
}

if (dashDir.y > EPS) { HeroControllerR.airDashed = true; }
}
Expand Down

0 comments on commit 98b732f

Please sign in to comment.