|
|
@ -37,6 +37,8 @@ namespace SemiColinGames { |
|
|
|
|
|
|
|
// For passing into Line.Rasterize() during movement updates.
|
|
|
|
private List<Point> movePoints = new List<Point>(100); |
|
|
|
// Possible hitboxes for player <-> obstacles.
|
|
|
|
private List<AABB> candidates = new List<AABB>(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<AABB>(); |
|
|
|
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
|
|
|
|