Skip to content

Commit

Permalink
Use better running animation (thanks Slipsy)
Browse files Browse the repository at this point in the history
  • Loading branch information
swoolcock committed May 29, 2020
1 parent 6954938 commit 217ab63
Show file tree
Hide file tree
Showing 22 changed files with 20 additions and 22 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 20 additions & 22 deletions osu.Game.Rulesets.Rush/UI/RushPlayerSprite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,26 +63,19 @@ public RushPlayerSprite(float groundY, float airY)
this.groundY = groundY;
this.airY = airY;

// temporarily hide the player until we can get a decent sprite
Alpha = 0;

InternalChildren = new Drawable[]
{
runningAnimation = new TextureAnimation
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
// FillMode = FillMode.Fit,
// RelativeSizeAxes = Axes.Both,
DefaultFrameLength = 30,
Scale = new Vector2(0.5f)
DefaultFrameLength = 50,
Scale = new Vector2(1)
},
fallingAnimation = new TextureAnimation
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
// FillMode = FillMode.Fit,
// RelativeSizeAxes = Axes.Both,
DefaultFrameLength = 50,
Alpha = 0f,
Scale = new Vector2(0.5f)
Expand All @@ -91,8 +84,6 @@ public RushPlayerSprite(float groundY, float airY)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
// FillMode = FillMode.Fit,
// RelativeSizeAxes = Axes.Both,
DefaultFrameLength = 50,
Alpha = 0f,
Scale = new Vector2(0.5f)
Expand All @@ -101,8 +92,6 @@ public RushPlayerSprite(float groundY, float airY)
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
// FillMode = FillMode.Fit,
// RelativeSizeAxes = Axes.Both,
DefaultFrameLength = 50,
Alpha = 0f,
Scale = new Vector2(0.5f)
Expand All @@ -113,17 +102,17 @@ public RushPlayerSprite(float groundY, float airY)
[BackgroundDependencyLoader]
private void load(TextureStore store)
{
runningAnimation.AddFrames(Enumerable.Range(0, 13).Select(i => store.Get($"Player/skeleton-03_run_{i:D2}")));
fallingAnimation.AddFrames(Enumerable.Range(0, 11).Select(i => store.Get($"Player/skeleton-05_fall_{i:D2}")));
attackAnimations[0].AddFrames(Enumerable.Range(0, 16).Select(i => store.Get($"Player/skeleton-09_attack_{i:D2}")));
attackAnimations[1].AddFrames(Enumerable.Range(0, 16).Select(i => store.Get($"Player/skeleton-10_attack_2_{i:D2}")));
runningAnimation.AddFrames(Enumerable.Range(1, 8).Select(i => store.Get($"Player/run_{i}")));
// fallingAnimation.AddFrames(Enumerable.Range(0, 11).Select(i => store.Get($"Player/skeleton-05_fall_{i:D2}")));
// attackAnimations[0].AddFrames(Enumerable.Range(0, 16).Select(i => store.Get($"Player/skeleton-09_attack_{i:D2}")));
// attackAnimations[1].AddFrames(Enumerable.Range(0, 16).Select(i => store.Get($"Player/skeleton-10_attack_2_{i:D2}")));

runningAnimation.IsPlaying = true;
fallingAnimation.IsPlaying = false;
attackAnimations[0].IsPlaying = false;
attackAnimations[1].IsPlaying = false;
attackAnimations[0].Loop = false;
attackAnimations[1].Loop = false;
// fallingAnimation.IsPlaying = false;
// attackAnimations[0].IsPlaying = false;
// attackAnimations[1].IsPlaying = false;
// attackAnimations[0].Loop = false;
// attackAnimations[1].Loop = false;
}

public void StopAll() => InternalChildren.OfType<TextureAnimation>().ForEach(a =>
Expand All @@ -141,13 +130,19 @@ public void PlayRunning()

public void PlayFalling()
{
if (fallingAnimation.FrameCount == 0)
return;

StopAll();
fallingAnimation.Show();
fallingAnimation.Play();
}

public void PlayAttackOnLane(LanedHitLane lane)
{
if (attackAnimations[attackIndex].FrameCount == 0)
return;

if (holdingAir && lane == LanedHitLane.Ground)
; // TODO: ghost punch the ground
else if (holdingGround && lane == LanedHitLane.Air)
Expand All @@ -167,6 +162,9 @@ public void PlayAttackOnLane(LanedHitLane lane)

private void updateHold()
{
if (runningAnimation.IsPlaying)
return;

if (holdingAir && holdingGround)
this.MoveToY(0, travel_time, Easing.OutBack);
else if (holdingAir)
Expand Down

0 comments on commit 217ab63

Please sign in to comment.