I may have fixed some collision issues (badly)

This commit is contained in:
Fraser Graham 2013-11-05 23:21:41 -08:00
parent 1498414357
commit c8913c563e

View File

@ -145,9 +145,10 @@ func (p *player) Tick(g *game) {
hit_player.Robot.Speed = (hit_player.Robot.Speed * 0.1) hit_player.Robot.Speed = (hit_player.Robot.Speed * 0.1)
hit_player.Robot.Heading = p.Robot.Heading hit_player.Robot.Heading = p.Robot.Heading
} }
move_by := intersection_point.Sub(p.Robot.Position).Scale(0.9) move_by := intersection_point.Sub(p.Robot.Position)
move_dist := move_by.Scale(float32(math.Floor(float64(move_by.Mag()-3.0))) / move_by.Mag())
p.Robot.Position = p.Robot.Position.Add(move_by) p.Robot.Position = p.Robot.Position.Add(move_dist)
p.Robot.Health -= int(p.Robot.Speed / 10.0) p.Robot.Health -= int(p.Robot.Speed / 10.0)
p.Robot.MoveTo = &p.Robot.Position p.Robot.MoveTo = &p.Robot.Position
p.Robot.Speed = (p.Robot.Speed * 0.1) p.Robot.Speed = (p.Robot.Speed * 0.1)