Exemple #1
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);
        }
Exemple #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();
        }
Exemple #3
0
            public Obstacle(Obstacles controller, Texture2D texture, int speed)
            {
                this.controller = controller;
                this.texture = texture;
                this.speed = speed;
                this.offset = controller.ScreenW;

                if (speed < 0)
                {
                    if (IsJumper) this.speed = 450;
                    else if (IsDucker) this.speed = 400;
                    else this.speed = 400;
                }
            }