allow the control interface to specify game type
This commit is contained in:
@@ -75,7 +75,7 @@ type GameMode interface {
|
||||
gameOver(gg *game) (bool, *GameOver)
|
||||
}
|
||||
|
||||
func NewGame(id string, width, height float32, obstacles, tick, maxPoints int) *game {
|
||||
func NewGame(id string, width, height float32, obstacles, tick, maxPoints int, mode string) *game {
|
||||
g := &game{
|
||||
id: id,
|
||||
register: make(chan *player),
|
||||
@@ -98,7 +98,12 @@ func NewGame(id string, width, height float32, obstacles, tick, maxPoints int) *
|
||||
tick_duration: tick,
|
||||
players_remaining: 2,
|
||||
winners: WinnerMap{m: make(map[string]int)},
|
||||
mode: &melee{respawn: make(map[*Robot]float64)},
|
||||
}
|
||||
|
||||
if mode == "melee" {
|
||||
g.mode = &melee{respawn: make(map[*Robot]float64)}
|
||||
} else {
|
||||
g.mode = &deathmatch{}
|
||||
}
|
||||
|
||||
g.mode.setup(g)
|
||||
|
||||
Reference in New Issue
Block a user