cycle through different attack animations
GitOrigin-RevId: e40102b81be56d59948fbfd92d2536262f521c8a
This commit is contained in:
parent
0e363de306
commit
f78bff249c
@ -36,6 +36,8 @@ namespace SemiColinGames {
|
|||||||
private Facing facing = Facing.Right;
|
private Facing facing = Facing.Right;
|
||||||
private Pose pose = Pose.Jumping;
|
private Pose pose = Pose.Jumping;
|
||||||
private double swordSwingTime = 0;
|
private double swordSwingTime = 0;
|
||||||
|
private int swordSwingNum = 0;
|
||||||
|
private int swordSwingMax = 6;
|
||||||
private float ySpeed = 0;
|
private float ySpeed = 0;
|
||||||
|
|
||||||
public Player(Texture2D texture) {
|
public Player(Texture2D texture) {
|
||||||
@ -157,6 +159,7 @@ namespace SemiColinGames {
|
|||||||
|
|
||||||
if (input[0].Attack && !input[1].Attack && swordSwingTime <= 0) {
|
if (input[0].Attack && !input[1].Attack && swordSwingTime <= 0) {
|
||||||
swordSwingTime = 0.3;
|
swordSwingTime = 0.3;
|
||||||
|
swordSwingNum = (swordSwingNum + 1) % swordSwingMax;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.Y = ySpeed * modelTime;
|
result.Y = ySpeed * modelTime;
|
||||||
@ -176,14 +179,14 @@ namespace SemiColinGames {
|
|||||||
case Pose.Jumping:
|
case Pose.Jumping:
|
||||||
return 35 + frameNum;
|
return 35 + frameNum;
|
||||||
case Pose.Stretching:
|
case Pose.Stretching:
|
||||||
return 22 + (int) Clock.ModelTime.TotalMilliseconds / 125 % 2;
|
return (int) Clock.ModelTime.TotalMilliseconds / 125 % 2;
|
||||||
case Pose.SwordSwing:
|
case Pose.SwordSwing:
|
||||||
if (swordSwingTime > 0.2) {
|
if (swordSwingTime > 0.2) {
|
||||||
return 15;
|
return 0 + swordSwingNum * 3;
|
||||||
} else if (swordSwingTime > 0.1) {
|
} else if (swordSwingTime > 0.1) {
|
||||||
return 16;
|
return 1 + swordSwingNum * 3;
|
||||||
} else {
|
} else {
|
||||||
return 17;
|
return 2 + swordSwingNum * 3;
|
||||||
}
|
}
|
||||||
case Pose.Crouching:
|
case Pose.Crouching:
|
||||||
return 26;
|
return 26;
|
||||||
|
Loading…
Reference in New Issue
Block a user