add nod during stretch

GitOrigin-RevId: 54f82b43a8c7c7aca419cb98a572e899213f4002
This commit is contained in:
Colin McMillen 2019-12-08 14:45:13 -05:00
parent 576ac65eb7
commit 7f4ce7e854

View File

@ -86,17 +86,18 @@ namespace Jumpy {
} }
private Point spritePosition(Pose pose, GameTime time) { private Point spritePosition(Pose pose, GameTime time) {
switch (pose) {
case Pose.Walking:
int frameNum = (time.TotalGameTime.Milliseconds / 125) % 4; int frameNum = (time.TotalGameTime.Milliseconds / 125) % 4;
if (frameNum == 3) { if (frameNum == 3) {
frameNum = 1; frameNum = 1;
} }
switch (pose) {
case Pose.Walking:
return new Point(spriteSize * frameNum + spriteSize * 6, 0); return new Point(spriteSize * frameNum + spriteSize * 6, 0);
case Pose.Crouching: case Pose.Crouching:
return new Point(spriteSize * 7, spriteSize * 2); return new Point(spriteSize * 7, spriteSize * 2);
case Pose.Stretching: case Pose.Stretching:
return new Point(spriteSize * 1, spriteSize * 2); return new Point(spriteSize * frameNum, spriteSize * 2);
case Pose.Jumping: case Pose.Jumping:
if (jumpTime > 0.25) { if (jumpTime > 0.25) {
return new Point(spriteSize * 6, spriteSize); return new Point(spriteSize * 6, spriteSize);