private TileType type; // huidige type van tile #endregion Fields #region Constructors public Tile(Location init, TileType type, Boolean solid, Image texture, Level level) { //variabelen initalizeren this.level = level; this.solid = solid; this.texture = texture; this.pos = init; this.type = type; this.tilesize = 32; }
public Game(Loop loop) { this.loop = loop; //variablene intializeren keyboard = new Keyboard(); // Level 1 initializeren XDocument level1 = XDocument.Parse(Properties.Resources.Level1); map = new Level(level1, this); }
//properties geven public FloorTile(Location init, Level level) : base(init, TileType.floor, false, Properties.Resources.floor_tile_texture, level) { }
//properties geven public WallTile(Location init, Level level) : base(init, TileType.wall, true, Properties.Resources.Wall, level) { }
// Methode om aan te roepen als je op de finish komt public void nextLevel() { timesWon++; paused = true; // Als aantal keren gewonnen gelijk of groter is dan het aantal levels heb je het spel uitgespeeld if(timesWon >= totalLevels) { var result = MessageBox.Show("Opnieuw spelen?", "You have beaten the game!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { paused = false; this.playAgain(); } else if (result == DialogResult.No) { this.backToMain(); } } // Zo niet, dan krijg je het volgende level else { var result = MessageBox.Show("Next level?", "You won!", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { paused = false; XDocument level = XDocument.Parse(levels[timesWon]); map = new Level(level, this); } else if (result == DialogResult.No) { this.backToMain(); } } }
public void playAgain() { timesWon = 0; XDocument level = XDocument.Parse(levels[timesWon]); map = new Level(level, this); }
public ShrekTile(Location init, Image floor, Level level) : base(init, TileType.shrek, false, Properties.Resources.dank_shrek, level) { this.floor = floor; }
//properties geven public StartTile(Location init, Image floor, Level level) : base(init, TileType.floor, false, Properties.Resources.floor_tile_texture, level) { this.floor = floor; }