public void InitializeGameObjectValues() { //Initializing this.bomberman_is_dead = false; this.level_finished = false; this.end_time = false; this.actual_time = 180; this.level_finished = false; actualStage = new Stage(); Level actualLevel = XmlMngr.GetInstance().levels[actual_stage]; //Loading Blocks Data foreach (string[] block in actualLevel.blocks) { Cell newBlock = new Cell(Cell.BLOCK, Cell.NONE); int x = int.Parse(block[0]); int y = int.Parse(block[1]); actualStage.addItem(newBlock, x, y); } //Loading PowerUps Data foreach (string[] powerUp in actualLevel.powerUps) { Cell newPowerUp = new Cell(Cell.POWERUP, powerUp[0]); int x = int.Parse(powerUp[1]); int y = int.Parse(powerUp[2]); actualStage.addItem(newPowerUp, x, y); } //Loading Enemies Data foreach (string[] enemy in actualLevel.enemies) { int x = int.Parse(enemy[1]); int y = int.Parse(enemy[2]); Enemy newEnemy = new Enemy(enemy[0], x, y); actualStage.addEnemy(newEnemy); } }
public void LoadStage(Stage stage) { for (int i = 0; i < stage.matrix.Length; i++) { for (int j = 0; j < stage.matrix[i].Length; j++) { if (stage.matrix[i][j] != null && stage.matrix[i][j].type == Cell.BLOCK) { int image = CreateBlock((i * Constants.BLOCK_FACTOR), (j * Constants.BLOCK_FACTOR * (-1f))); stage.matrix[i][j].image = image; } } } }