renaming rect to AABB
This commit is contained in:
parent
9ca442f10d
commit
b702afeb3a
@ -7,7 +7,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Obstacle struct {
|
type Obstacle struct {
|
||||||
Bounds v.Rect2d `json:"bounds"`
|
Bounds v.AABB2d `json:"bounds"`
|
||||||
Hp int `json:"-"`
|
Hp int `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ func GenerateObstacles(count int, width, height float32) []Obstacle {
|
|||||||
out = append(
|
out = append(
|
||||||
out,
|
out,
|
||||||
Obstacle{
|
Obstacle{
|
||||||
Bounds: v.Rect2d{
|
Bounds: v.AABB2d{
|
||||||
A: v.Point2d{X: x, Y: y},
|
A: v.Point2d{X: x, Y: y},
|
||||||
B: v.Point2d{X: 20 + x + w, Y: 20 + y + h},
|
B: v.Point2d{X: 20 + x + w, Y: 20 + y + h},
|
||||||
},
|
},
|
||||||
|
2
robot.go
2
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}
|
intersection_point := v.Point2d{X: 0, Y: 0}
|
||||||
|
|
||||||
// Check Walls
|
// 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)
|
collision, _, pos := v.RectIntersection(r_walls, r.Position, move_vector)
|
||||||
if collision {
|
if collision {
|
||||||
return collision, pos, nil
|
return collision, pos, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user