Browse Source

cycle through different attack animations

GitOrigin-RevId: e40102b81b
master
Colin McMillen 4 years ago
parent
commit
f78bff249c
  1. 11
      Shared/Player.cs

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

Loading…
Cancel
Save