public void kill(Player player) { //kill player, restart level alive = false; //remove enemy from playfield though bottom of screen and direction of hitting if (player.getPosx() < this.getPosx()) { var intlist = new int[] { 3, 3, 2, 2, 1, 1 }; foreach (var integ in intlist) this.x.Add(integ); } else if (player.getPosx() > this.getPosx() - player.getWidth() / 2) { var intlist = new int[] { -3, -3, -2, -2, -1, -1 }; foreach (var integ in intlist) this.x.Add(integ); } var intliste = new int[] { 20, 15, 4, 3, 2, 1, 0, 0, -1, -1, -2, -2, -3, -4, -5, -6, -7 ,-8,-9,-10,-999}; this.y.AddRange(intliste); //reset player //this.posx = startposx; //this.posy = startposy; }
/// <summary> /// LoadContent wird einmal pro Spiel aufgerufen und ist der Platz, wo /// Ihr gesamter Content geladen wird. /// </summary> protected override void LoadContent() { this.gameState = GameState.Load; //TRIAL MODE? Guide.SimulateTrialMode = true; level = new Level(this, GraphicsDevice); level.LoadMap(@"Leveltry"); level.scrollypos(300); // Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann. spriteBatchMario = new SpriteBatch(GraphicsDevice); spriteBatchTurtleShell = new SpriteBatch(GraphicsDevice); spriteBatchSplash = new SpriteBatch(GraphicsDevice); //Menü menu = new Menu(this.Content, spriteBatchMario, graphics); // TODO: Verwenden Sie this.Content, um Ihren Spiel-Inhalt hier zu laden mario = new Player(); mario.LoadGraphic(1, 3, 60, 35, 8); mario.LoadGraphicRight(Content.Load<Texture2D>(@"marioright")); mario.LoadGraphicLeft(Content.Load<Texture2D>(@"marioleft")); mario.LoadGraphicStanding(Content.Load<Texture2D>(@"mariostanding")); mario.LoadGraphicJumping(Content.Load<Texture2D>(@"mariojump")); mario.startposy = graphics.GraphicsDevice.Viewport.Height - 100; mario.setPosy(mario.startposy); mario.startposx = 20; mario.setPosx(mario.startposx); mario.setGraphics(this.graphics); //shell = new Enemy(graphics.GraphicsDevice.Viewport.Width - 20, graphics.GraphicsDevice.Viewport.Height-50); //shell.LoadGraphic(1, 2, 15, 15, 2); //shell.LoadGraphicLeft(Content.Load<Texture2D>(@"turtleshell")); //shell.LoadGraphicRight(Content.Load<Texture2D>(@"turtleshell")); //shell.startDirection(false); //shell.setGraphics(this.graphics); }