// Move horizontally public new void HorizontalMovement(float targetSpeed) { Physics physics = GetComponent <Physics>(); physics.Velocity.X = GameMath.Approach(physics.Velocity.X, targetSpeed, physics.Grounded ? .25f : .15f); GetComponent <Sprite>().FlipSprite = targetSpeed < 0; }
// Move horizontally public void HorizontalMovement(float targetSpeed) { physics.Velocity.X = GameMath.Approach(physics.Velocity.X, targetSpeed, physics.Grounded ? accelerationSpeed : airAccelerationSpeed); if (SpriteManager.GetCurrentSprite() != spriteWalking) { SpriteManager.ChangeSprite("spriteWalking"); spriteWalking.ImageIndex = 0; } SpriteManager.ChangeFlipOnAllSprites(targetSpeed < 0); }
// Stop this lmao public void StopMoving() { physics.Velocity.X = GameMath.Approach(physics.Velocity.X, 0, physics.Grounded ? slowDownSpeed : airSlowDownSpeed); SpriteManager.ChangeSprite("spriteIdle"); }
//Stop this lmao public new void StopMoving() { Physics physics = GetComponent <Physics>(); physics.Velocity.X = GameMath.Approach(physics.Velocity.X, 0, physics.Grounded ? .15f : .1f); }