Exemplo n.º 1
0
        public static void Initialize(Game1 myGame, String filename)
        {
            game = myGame;

            setNum = 0;

            if (filename.Equals(""))
            {
                filenames[0] = "Mario Level 1-1.csv";
            }
            else
            {
                filenames[0] = filename;
            }
            filenames[1] = "";

            currentFilename = filenames[0];

            LevelManager.ResetLevel();
            LevelManager.Initialize(myGame);

            marioStartLocation = new Vector2(50, screenHeight - 50);

            spriteSet.players = new List <IPlayer>();

            spriteSet = LevelManager.LoadLevel(currentFilename, new Vector2(0, 0), setNum, spriteSet);
            int life = 3;

            camera = GetCamera();
            spriteSet.players[0].SetLives(life);
            spriteSet.players[0].SwitchToSmallMario(false);
            Display.Initalize();
            RemainingLives.Initalize();
            RemainingLives.ResetTimer();
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            if (isInReplayMode)
            {
                if (gR == null)
                {
                    this.gR = new GamerReplayer(this);
                }
                gR.Update();
            }
            else
            {
                foreach (IController controller in controllerList)
                {
                    controller.Update(gameTime);
                }
            }

            if (editingLevel)
            {
                eld.Update(gameTime);
                this.IsMouseVisible = true;
            }
            else
            {
                if (notPaused)
                {
                    WorldManager.Update(gameTime);
                }

                if (isSpawning)
                {
                    EnSp.Update();
                }

                GameOver.Update(gameTime);
                RemainingLives.Update(gameTime);
                base.Update(gameTime);

                if (SoundManager.SoundLock1 == true)
                {
                    //set initial TimeSpan
                    SoundManager.Time       = gameTime.TotalGameTime;
                    SoundManager.SoundLock1 = false;
                }

                if (StarUtility.StarMarioLock == true)
                {
                    StarUtility.Time          = gameTime.TotalGameTime;
                    StarUtility.StarMarioLock = false;
                }
                sm.Update(gameTime);
                su.Update(gameTime);
                this.IsMouseVisible = false;
            }
        }
Exemplo n.º 3
0
 protected override void Initialize()
 {
     WorldManager.Initialize(this, filename);
     if (jumpOnlyMode)
     {
         controllerList = jumpOnlyControllerList;
     }
     else
     {
         controllerList = defaultControllerList;
     }
     GameOver.Initalize();
     RemainingLives.Initalize();
     GameOver.ZeroTimer();
     base.Initialize();
 }
Exemplo n.º 4
0
        public static void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            if (currentFilename == "Underground.csv")
            {
                Game1.graphics.GraphicsDevice.Clear(Color.Black);
            }
            else
            {
                Game1.graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
            }

            Vector2 cameraPosition = camera.GetPosition();

            if (GameOver.GameIsOver())
            {
                GameOver.Blackout();
                GameOver.Draw(spriteBatch);
            }
            else if (RemainingLives.ShowScreen())
            {
                RemainingLives.Blackout();
                RemainingLives.Draw(spriteBatch);
            }
            else
            {
                foreach (IBackgroundObject obj in spriteSet.objects)
                {
                    obj.Draw(spriteBatch, cameraPosition);
                }

                foreach (Goomba goomba in spriteSet.goombas)
                {
                    goomba.Draw(spriteBatch, cameraPosition);
                }

                foreach (Koopa koopa in spriteSet.koopas)
                {
                    koopa.Draw(spriteBatch, cameraPosition);
                }

                foreach (IItem item in spriteSet.items)
                {
                    item.Draw(spriteBatch, cameraPosition);
                }
                foreach (IBlock block in spriteSet.blocks)
                {
                    block.Draw(spriteBatch, cameraPosition);
                }

                foreach (IItem item in spriteSet.items)
                {
                    if (item is Star)
                    {
                        Star star = (Star)item;
                        if (star.isHidden == false)
                        {
                            star.Draw(spriteBatch, cameraPosition);
                        }
                    }
                }

                foreach (Fireball fireball in spriteSet.projectiles)
                {
                    fireball.Draw(spriteBatch, cameraPosition);
                }

                foreach (Mario mario in spriteSet.players)
                {
                    mario.Draw(spriteBatch, cameraPosition);
                }

                foreach (IPipe pipe in spriteSet.pipes)
                {
                    pipe.Draw(spriteBatch, cameraPosition);
                }
            }
            Display.Draw(spriteBatch, cameraPosition);
        }