server/robot.go

48 lines
1.1 KiB
Go
Raw Normal View History

2013-08-19 20:43:26 -07:00
package main
2013-09-03 23:26:40 -07:00
// XXX: this needs to go into game somehow
// func (p *bot.Projectile) nudge() {
// newPos := move(p.Position, p.MoveTo, float64(p.Speed), delta)
//
// hit_player := false
// for player := range p.game.players {
// if player.Robot.Id == p.Id {
// continue
// }
// dist := distance(player.Robot.Position, p.Position)
// if dist < 5.0 {
// hit_player = true
// }
// }
//
// if distance(p.Position, p.MoveTo) < 5 || hit_player {
// delete(p.game.projectiles, p)
//
// // Spawn a splosion
// splo := &splosion{
// Id: p.Id,
// Position: p.Position,
// Radius: p.Radius,
// MaxDamage: 10,
// MinDamage: 5,
// Lifespan: 8,
// }
// p.game.splosions[splo] = true
//
// for player := range p.game.players {
// dist := distance(player.Robot.Position, p.Position)
// if dist < float64(p.Radius) {
//
// // TODO map damage Max to Min based on distance from explosion
// if player.Robot.Health > 0 {
// player.Robot.Health -= p.Damage
// if player.Robot.Health <= 0 {
// }
// }
// }
// }
// }
// p.Position.X = newPos.X
// p.Position.Y = newPos.Y
// }