Add support for fixed object geometry

also updated config file
This commit is contained in:
sm
2014-05-11 21:49:06 -07:00
parent 961cf5d7da
commit c9dfa27320
5 changed files with 54 additions and 10 deletions
+12 -1
View File
@@ -177,11 +177,22 @@ func (c *Controller) AddPlayer(ws *websocket.Conn) {
gid.Id,
float64(c.Conf.Width),
float64(c.Conf.Height),
c.Conf.ObstacleCount,
c.Conf.Tick,
c.Conf.MaxPoints,
"",
)
game.defaultObstacles = c.Conf.Obstacles
game.obstacleCount = c.Conf.ObstacleCount
log.Printf("%t", len(game.defaultObstacles) == 0)
if len(game.defaultObstacles) == 0 {
game.obstacles = GenerateObstacles(
game.obstacleCount,
game.width,
game.height,
)
} else {
game.obstacles = c.Conf.Obstacles
}
if err != nil {
log.Printf("problem creating game: %s", gid.Id)
websocket.JSON.Send(ws, NewFailure("game creation error"))