Ejemplo n.º 1
0
 public SpriteManager(Texture2D texture, Vector2 position, Vector2 screen, Game1 aGame, Asis anAsis, Laser aLaser, Enemy aEnemy, SoundEffect aLaserSoundEffect, SoundEffect aBackwardsLaserSoundEffect)
     : base(texture, position)
 {
     myPosition = position;
     myScreenSize = screen;
     myGame = aGame;
     Asis = anAsis;
     Laser = aLaser;
     redEnemy = aEnemy;
     LaserSoundEffect = aLaserSoundEffect;
     BackwardsLaserSoundEffect = aBackwardsLaserSoundEffect;
     myState = new IdleState(this);
     TimeStack = new Stack();
     SetUpInput();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Asis Asis = new Asis(Content.Load<Texture2D>("Asis"), new Vector2(0, 0),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));

            Laser Laser = new Laser(Content.Load<Texture2D>("Laser"), new Vector2(0, 0),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));

            Enemy redEnemy = new Enemy(Content.Load<Texture2D>("enemy-red"), new Vector2(0, 0),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));

            SpriteManager SpriteManager = new SpriteManager(Content.Load<Texture2D>("Laser"), new Vector2(-1000, -1000),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this, Asis, Laser, redEnemy, Content.Load<SoundEffect>("LaserSoundEffect"), Content.Load<SoundEffect>("LaserSoundEffectBackwards"));

            mySprites.Add(Asis);
            mySprites.Add(Laser);
            mySprites.Add(redEnemy);
            mySprites.Add(SpriteManager);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if (levelNum < myLevels.Count)
            {
                myLevels[levelNum].Update(gameTime);
                if (myLevels[levelNum].myLevelManager.getIsFinished())
                {
                    playerScore.Add(myLevels[levelNum].myLevelManager.finishingTime);

                    // This effectively resets to the first level but game
                    // finished screen with all the times doesn't get displayed

                    if (levelNum == myLevels.Count() - 1)
                    {
                        levelNum = 1;
                        // LoadContent();

                        mySpriteBatch = new SpriteBatch(GraphicsDevice);

                        Asis myAsis2 = new Asis(Content.Load<Texture2D>("Asis"), new Vector2(0, 0),
                            new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this);

                        camera = new Camera(GraphicsDevice.Viewport, myAsis2);

                        Tutorial TutorialContent = new Tutorial(this, graphics, myAsis2, mySpriteBatch);
                        Ceres firstLevelContent = new Ceres(this, graphics, myAsis2, mySpriteBatch);
                        //level = new Tutorial(this, graphics, myAsis, mySpriteBatch);
                        Vulkanis secondLevelContent = new Vulkanis(this, graphics, myAsis2, mySpriteBatch);
                        Sycia thirdLevelContent = new Sycia(this, graphics, myAsis2, mySpriteBatch);
                        myLevels.Clear();
                        myLevels.Add(TutorialContent);
                        myLevels.Add(firstLevelContent);
                        myLevels.Add(secondLevelContent);
                        myLevels.Add(thirdLevelContent);
                        //add another screen for the finishing times!!!
                        FinishTimes = new Screen(Content.Load<Texture2D>("FinalTimes"), new Vector2(0, 0), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
                        timesFont = Content.Load<SpriteFont>("FinishTimesFont");

                    }else

                    levelNum++;
                }
            }
            else
            {
                if (GamePad.GetState(PlayerIndex.One).IsButtonDown(Buttons.Start))
                {
                    levelNum = 0;
                    playerScore = new List<double>();
                }
            }

            camera.Update(gameTime);
            base.Update(gameTime);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            mySpriteBatch = new SpriteBatch(GraphicsDevice);

            Asis myAsis = new Asis(Content.Load<Texture2D>("Asis"), new Vector2(0,0),
                new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight), this);

            camera = new Camera(GraphicsDevice.Viewport, myAsis);

            Tutorial TutorialContent = new Tutorial(this, graphics, myAsis, mySpriteBatch);
            Ceres firstLevelContent = new Ceres(this, graphics, myAsis, mySpriteBatch);
            //level = new Tutorial(this, graphics, myAsis, mySpriteBatch);
            Vulkanis secondLevelContent = new Vulkanis(this, graphics, myAsis, mySpriteBatch);
            Sycia thirdLevelContent = new Sycia(this, graphics, myAsis, mySpriteBatch);
            myLevels.Add(TutorialContent);
            myLevels.Add(firstLevelContent);
            myLevels.Add(secondLevelContent);
            myLevels.Add(thirdLevelContent);
            //add another screen for the finishing times!!!
            FinishTimes = new Screen(Content.Load<Texture2D>("FinalTimes"), new Vector2(0, 0), new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
            timesFont = Content.Load<SpriteFont>("FinishTimesFont");
        }