Add support for fixed object geometry
also updated config file
This commit is contained in:
+12
-1
@@ -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"))
|
||||
|
||||
Reference in New Issue
Block a user