Example #1
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Freigabemodus des Grafikgeräts so einstellen, das es sich beim XNA-Rendering einschaltet
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            // Erstellen Sie einen neuen SpriteBatch, der zum Zeichnen von Texturen verwendet werden kann.
            spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);

            // TODO: Verwenden Sie this.content, um Ihren Spiel-Content hier zu laden

            forms.Add(new Form(new Microsoft.Xna.Framework.Rectangle(0, 0, 300, 342), contentManager.Load<Texture2D>("Dash1")));
            forms.Add(new Form(new Microsoft.Xna.Framework.Rectangle(0, 0, 300, 342), contentManager.Load<Texture2D>("Dash")));
            forms.Add(new Form(new Microsoft.Xna.Framework.Rectangle(0, 0, 300, 341), contentManager.Load<Texture2D>("Dash2")));

            player.pos.Y = 450;

            this.background = new Background(contentManager);

            // Timer starten
            timer.Start();
            this.background.StartMoving();

            base.OnNavigatedTo(e);
        }
Example #2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            sprites = new SpriteManager(Game);
            Game.Components.Add(sprites);

            player = new Player(Game, this);
            Game.Components.Add(player);

            this.background = new Background(Game);
            Game.Components.Add(background);

            this.obstacles = new Obstacles(Game as Game1);
            Game.Components.Add(obstacles);

            AdGameComponent.Initialize(this.Game, "test_client");
            Game.Components.Add(AdGameComponent.Current);

            highscores = new HighscoreDisplay(Game);
            Game.Components.Add(highscores);
            CreateAd();

            spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            this.sound = Game.Services.GetService(typeof(SoundManager)) as SoundManager;

            Enabled = false;
            Visible = true;

            base.Initialize();
        }
Example #3
0
        public void Restart()
        {
            Game.Components.Remove(sprites);
            Game.Components.Remove(player);
            Game.Components.Remove(background);
            Game.Components.Remove(obstacles);
            Game.Components.Remove(highscores);

            highscores = new HighscoreDisplay(Game);
            highscores.Enabled = true;
            Game.Components.Add(highscores);

            sprites = new SpriteManager(Game);
            Game.Components.Add(sprites);

            player = new Player(Game, this);

            player.Restart();

            Game.Components.Add(player);

            this.background = new Background(Game);
            Game.Components.Add(background);

            this.obstacles = new Obstacles(Game as Game1);
            Game.Components.Add(obstacles);
        }