예제 #1
0
		public Game1()
		{
			graphics = new GraphicsDeviceManager(this);
			Content.RootDirectory = "Content";
			_inputState = new InputState();

		}
예제 #2
0
		public bool HandleInput(InputState inputState, IMap map)
		{
			if (inputState.IsLeft(PlayerIndex.One))
			{
				int tempX = X - 1;
				if (map.IsWalkable(tempX, Y))
				{
					X = tempX;
					return true;
				}
			}
			else if (inputState.IsRight(PlayerIndex.One))
			{
				int tempX = X + 1;
				if (map.IsWalkable(tempX, Y))
				{
					X = tempX;
					return true;
				}
			}
			else if (inputState.IsUp(PlayerIndex.One))
			{
				int tempY = Y - 1;
				if (map.IsWalkable(X, tempY))
				{
					Y = tempY;
					return true;
				}
			}
			else if (inputState.IsDown(PlayerIndex.One))
			{
				int tempY = Y + 1;
				if (map.IsWalkable(X, tempY))
				{
					Y = tempY;
					return true;
				}
			}
			return false;
		}