diff --git a/Shared/Player.cs b/Shared/Player.cs index d0c21bb..6a045cd 100644 --- a/Shared/Player.cs +++ b/Shared/Player.cs @@ -37,6 +37,8 @@ namespace SemiColinGames { // For passing into Line.Rasterize() during movement updates. private List movePoints = new List(100); + // Possible hitboxes for player <-> obstacles. + private List candidates = new List(10); public Player(Vector2 position, int facing) { this.position = position; @@ -68,8 +70,7 @@ namespace SemiColinGames { residual = new Vector2(movement.X - (int) movement.X, movement.Y - (int) movement.Y); // Broad test: remove all collision targets nowhere near the player. - // TODO: don't allocate a list here. - var candidates = new List(); + candidates.Clear(); // Expand the box in the direction of movement. The center is the midpoint of the line // between the player's current position and their desired movement. The width increases by // the magnitude of the movement in each direction. We add 1 to each dimension just to be