Browse Source

allow player to look up/down

GitOrigin-RevId: 00041d6736
master
Colin McMillen 4 years ago
parent
commit
4758ce519b
  1. 21
      Shared/Player.cs

21
Shared/Player.cs

@ -181,6 +181,12 @@ namespace SemiColinGames {
float visionRange = 150;
float visionRangeSq = visionRange * visionRange;
Vector2 ray = new Vector2(visionRange * (int) facing, 0);
if (pose == Pose.Stretching) {
ray = Rotate(ray, FMath.DegToRad(-30));
}
if (pose == Pose.Crouching) {
ray = Rotate(ray, FMath.DegToRad(30));
}
Vector2 coneBottom = Rotate(ray, fov);
Vector2 coneTop = Rotate(ray, -fov);
@ -259,16 +265,11 @@ namespace SemiColinGames {
private int SpriteIndex(Pose pose) {
int frameNum = (int) Clock.ModelTime.TotalMilliseconds / 125 % 4;
if (frameNum == 3 && pose == Pose.Standing) {
frameNum = 1;
}
switch (pose) {
case Pose.Walking:
return 35 + frameNum;
case Pose.Jumping:
return 35 + frameNum;
case Pose.Stretching:
return (int) Clock.ModelTime.TotalMilliseconds / 125 % 2;
case Pose.SwordSwing:
if (swordSwingTime > 0.2) {
return 0 + swordSwingNum * 3;
@ -278,10 +279,14 @@ namespace SemiColinGames {
return 2 + swordSwingNum * 3;
}
case Pose.Crouching:
return 26;
case Pose.Stretching:
case Pose.Standing:
default:
return 29 + frameNum;
default: {
if (frameNum == 3) {
frameNum = 1;
}
return 29 + frameNum;
}
}
}

Loading…
Cancel
Save