示例#1
0
 static void UpdateVectorOther(xnainput.KeyboardState newstate)
 {
     int horizontal = 0;
     if (newstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.L)) horizontal++;
     if (newstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.J)) horizontal--;
     int vertical = 0;
     if (newstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.I)) vertical++;
     if (newstate.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.K)) vertical--;
     V_other.X = (float)horizontal;
     V_other.Y = (float)-vertical;//2DでY軸が下向きのためそれの補正
     if (V_other.LengthSquared() != 0)
         V_other = Vector2.Normalize(V_other);
 }