Remove special case wall collisions, replace with generated objects

This commit is contained in:
Fraser Graham
2016-07-13 12:16:10 -06:00
parent 78b1711cd9
commit ef33a17b6a
2 changed files with 27 additions and 31 deletions
+1 -22
View File
@@ -195,29 +195,8 @@ func (r *Robot) checkCollisions(g *Game, probe v.Vector2d) (bool, *v.Point2d, *R
botSize := 5.0
botPolygon := v.OrientedSquare(r.Position, r.Heading, botSize)
bounds := []Obstacle{
Obstacle{
Bounds: v.AABB2d{A: v.Point2d{0, 0}, B: v.Point2d{0, g.width}},
Hp: 0,
},
Obstacle{
Bounds: v.AABB2d{A: v.Point2d{0, 0}, B: v.Point2d{0, g.height}},
Hp: 0,
},
Obstacle{
Bounds: v.AABB2d{A: v.Point2d{g.width, g.height}, B: v.Point2d{0, g.height}},
Hp: 0,
},
Obstacle{
Bounds: v.AABB2d{A: v.Point2d{g.width, g.height}, B: v.Point2d{g.width, 0}},
Hp: 0,
},
}
obstacles := append(g.obstacles, bounds...)
// Check Obstacles
for _, obj := range obstacles {
for _, obj := range g.obstacles {
// collision due to motion:
collision, move_collision, translation := v.PolyPolyIntersection(
botPolygon, probe, obj.Bounds.ToPolygon())