Time for action – accounting for walls
Add the
checkTileObstacles()
method to the Movement Limitations region of the Player class:private static Vector2 checkTileObstacles( float elapsedTime, Vector2 moveAngle) { Vector2 newHorizontalLocation = BaseSprite.WorldLocation + (new Vector2(moveAngle.X, 0) * (playerSpeed * elapsedTime)); Vector2 newVerticalLocation = BaseSprite.WorldLocation + (new Vector2(0, moveAngle.Y) * (playerSpeed * elapsedTime)); Rectangle newHorizontalRect = new Rectangle( (int)newHorizontalLocation.X, (int)BaseSprite.WorldLocation.Y, BaseSprite.FrameWidth, BaseSprite.FrameHeight); Rectangle newVerticalRect = new Rectangle( (int)BaseSprite.WorldLocation.X, (int)newVerticalLocation.Y, BaseSprite.FrameWidth, BaseSprite.FrameHeight); int horizLeftPixel = 0; int horizRightPixel = 0; int vertTopPixel = 0; int vertBottomPixel = 0; if (moveAngle.X...