You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

42 lines
784 B

package main
import (
"log"
)
type deathmatch struct {
}
func (g *deathmatch) setup(gg *game) {
}
func (g *deathmatch) gameOver(gg *game) (bool, *GameOver) {
over := false
var stats *GameOver
if gg.players_remaining <= 1 && len(gg.players) > 1 {
gg.obstacles = GenerateObstacles(gg.obstacle_count, gg.width, gg.height)
log.Printf("game %s: game over", gg.id)
stats = NewGameOver()
for p := range gg.players {
for _, r := range p.Robots {
if r.Health > 0 {
log.Printf("Robot %v Survived", r.Id)
gg.winners.Lock()
gg.winners.m[r.Id] += 1
gg.winners.Unlock()
stats.Winners = append(stats.Winners, r.Id)
}
r.reset(gg)
}
}
over = true
}
return over, stats
}
func (g *deathmatch) tick(gg *game, payload *Boardstate) {
}