53 lines
1.2 KiB
Go
53 lines
1.2 KiB
Go
package main
|
|
|
|
type weapon struct {
|
|
Strength float64 `json:"strength"`
|
|
Radius float64 `json:"radius"`
|
|
}
|
|
|
|
// 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
|
|
// }
|