Browse Source

renaming rect to AABB

master
Fraser Graham 7 years ago
parent
commit
b702afeb3a
2 changed files with 3 additions and 3 deletions
  1. +2
    -2
      obstacle.go
  2. +1
    -1
      robot.go

+ 2
- 2
obstacle.go View File

@ -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},
},

+ 1
- 1
robot.go View File

@ -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

Loading…
Cancel
Save