cycle through different attack animations

GitOrigin-RevId: e40102b81be56d59948fbfd92d2536262f521c8a
This commit is contained in:
Colin McMillen 2020-01-30 16:53:13 -05:00
parent 0e363de306
commit f78bff249c

View File

@ -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;