diff --git a/obstacle.go b/obstacle.go index 287fc23..0149c11 100644 --- a/obstacle.go +++ b/obstacle.go @@ -7,7 +7,7 @@ import ( ) type Obstacle struct { - Bounds v.Rect2d `json:"bounds"` + Bounds v.AABB2d `json:"bounds"` Hp int `json:"-"` } @@ -45,7 +45,7 @@ func GenerateObstacles(count int, width, height float32) []Obstacle { out = append( out, Obstacle{ - Bounds: v.Rect2d{ + Bounds: v.AABB2d{ A: v.Point2d{X: x, Y: y}, B: v.Point2d{X: 20 + x + w, Y: 20 + y + h}, }, diff --git a/robot.go b/robot.go index 588ff93..d547ddd 100644 --- a/robot.go +++ b/robot.go @@ -169,7 +169,7 @@ func (r *Robot) checkCollisions(g *game, move_vector v.Vector2d) (bool, v.Point2 intersection_point := v.Point2d{X: 0, Y: 0} // Check Walls - r_walls := v.Rect2d{A: v.Point2d{X: 0, Y: 0}, B: v.Point2d{X: g.width, Y: g.height}} + r_walls := v.AABB2d{A: v.Point2d{X: 0, Y: 0}, B: v.Point2d{X: g.width, Y: g.height}} collision, _, pos := v.RectIntersection(r_walls, r.Position, move_vector) if collision { return collision, pos, nil