From f78bff249c5f78f989e06c0ab52b27167d0eee19 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 30 Jan 2020 16:53:13 -0500 Subject: [PATCH] cycle through different attack animations GitOrigin-RevId: e40102b81be56d59948fbfd92d2536262f521c8a --- Shared/Player.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Shared/Player.cs b/Shared/Player.cs index 70d7b6e..2aa8d5a 100644 --- a/Shared/Player.cs +++ b/Shared/Player.cs @@ -36,6 +36,8 @@ namespace SemiColinGames { private Facing facing = Facing.Right; private Pose pose = Pose.Jumping; private double swordSwingTime = 0; + private int swordSwingNum = 0; + private int swordSwingMax = 6; private float ySpeed = 0; public Player(Texture2D texture) { @@ -157,6 +159,7 @@ namespace SemiColinGames { if (input[0].Attack && !input[1].Attack && swordSwingTime <= 0) { swordSwingTime = 0.3; + swordSwingNum = (swordSwingNum + 1) % swordSwingMax; } result.Y = ySpeed * modelTime; @@ -176,14 +179,14 @@ namespace SemiColinGames { case Pose.Jumping: return 35 + frameNum; case Pose.Stretching: - return 22 + (int) Clock.ModelTime.TotalMilliseconds / 125 % 2; + return (int) Clock.ModelTime.TotalMilliseconds / 125 % 2; case Pose.SwordSwing: if (swordSwingTime > 0.2) { - return 15; + return 0 + swordSwingNum * 3; } else if (swordSwingTime > 0.1) { - return 16; + return 1 + swordSwingNum * 3; } else { - return 17; + return 2 + swordSwingNum * 3; } case Pose.Crouching: return 26;