void GameStateUpdater::spawnObstacle(unsigned int obstacleGid, Coordinates coords, unsigned int spawnerId) { Obstacle *obstacle = Obstacle::getInstanceByGid(obstacleGid); obstacle->setId(coords.y*_state->getWidth() + coords.x); obstacle->setPosition(coords.x*TILE_WIDTH, coords.y*TILE_HEIGHT); obstacle->setSize(TILE_WIDTH, TILE_HEIGHT); _state->getObstacleLayer()->addObject(obstacle); _state->getObstacleLayer()->updateGrid(); this->logObstacleSpawn(obstacleGid, obstacle, spawnerId); }