Ejemplo n.º 1
0
        public void loadContent(ContentManager content)
        {
            //Added November 26, 2013
            m_Animate.loadContent("Unicorn", content);
            // m_Animate.addAnimation(new Animation(16, new int[] { 0 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 0 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 0 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 0, 1 }));
            m_Animate.addAnimation(new Animation(16, new int[] { 0, 1 }));
            m_Animate.addAnimation(new Animation(8, new int[] { 0, 1, 2, 3 }));
            m_Animate.addAnimation(new Animation(8, new int[] { 0, 1, 2, 3 }));
            //Add in animations

            m_Cross = content.Load <Texture2D>("cross");

            m_LaserManager.loadContent(content);

            m_LevelBounds = new Rectangle(0, 0, Level.getWidthOfArray() * 32, Level.getHeightOfArray() * 32);

            //Added November 27, 2013
            m_Particles.loadContent(content);
        }
Ejemplo n.º 2
0
 public LavaWave()
 {
     m_LevelBounds = new Rectangle(0, 0, Level.getWidthOfArray() * 32, Level.getHeightOfArray() * 32);
 }
Ejemplo n.º 3
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);

            //stuff to change screen size / fullscreen
            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            //graphics.IsFullScreen = true;
            graphics.ApplyChanges();

            Sounds.loadContent(Content);
            BackgroundMusic.loadContent(Content);
            IsMouseVisible = true;

            hud = new Hud();
            hud.LoadContent(Content);

            screenManager = new ScreenManager();
            screenManager.LoadContent(Content, graphics);

            gateManager    = new GateManager();
            m_EnemyManager = new EnemyManager();
            pickupManager  = new PickUpManager();
            tiles          = new Level(new Rectangle(0, 0, 32, 32), new Rectangle(0, 0, 32, 32));
            tiles.loadContent(Content, "EnchantedForestTileSetUpdated", "Content/Level0.txt");

            EnemyManager.loadContent(Content);
            PickUpManager.loadContent(Content);
            GateManager.loadContent(Content);
            player = new Player(new Vector2(200, 1000), new Rectangle(0, 0, 128, 64), new Rectangle(0, 0, 128, 64));
            player.loadContent(Content);



            camera        = new Camera(GraphicsDevice.Viewport);
            camera.Limits = new Rectangle(0, 0, Level.getWidthOfArray() * tiles.Destination.Width, Level.getHeightOfArray() * tiles.Destination.Height);

            background1 = new Background(camera);
            Background.loadContent(Content, Level.levelCount, 1);
            background1.setParallaxes();

            backgroundManager = new BackgroundManager();
            backgroundManager.addBackground(background1);

            boss = new Boss();
            boss.loadContent(Content);
            // TODO: use this.Content to load your game content here
        }
Ejemplo n.º 4
0
        public void update(GameTime gameTime)
        {
            if (IsActive == true)
            {
                if (m_BossState != BossState.DYING && m_BossState != BossState.DEAD)
                {
                    float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

                    if (m_BossState == BossState.IDLE)
                    {
                        Vector2 temp;
                        Vector2.Subtract(ref m_Position, ref m_StartPos, out temp);
                        if (temp.Length() > (m_IdleMoveDist - (m_IdleMoveDist * m_LerpDist)))
                        {
                            do
                            {
                                m_TargetPos = new Vector2(m_Random.Next(100) - 50, m_Random.Next(100) - 50);
                            } while (m_TargetPos.X == 0 && m_TargetPos.Y == 0);
                            m_TargetPos.Normalize();
                            m_TargetPos.X = m_TargetPos.X * m_IdleMoveDist;
                            m_TargetPos.Y = m_TargetPos.Y * m_IdleMoveDist;
                        }
                        m_Position = Vector2.Lerp(m_Position, m_StartPos + m_TargetPos, m_LerpAmount);
                        Position   = m_Position;

                        m_StateChangeTimer += elapsedTime;

                        if (m_StateChangeTimer > m_StateDelay)
                        {
                            m_StateChangeTimer = 0.0f;
                            do
                            {
                                m_BossState = (BossState)(m_Random.Next((int)BossState.COUNT));
                                //m_BossState = BossState.CHARGING;
                            } while (m_BossState == BossState.LAVA_WAVE && m_LavaWave.IsActive == true);
                        }
                        m_Animate.changAnimation(1);
                    }
                    else if (m_BossState == BossState.CHARGING)
                    {
                        //boss is charging here ------------------------------------------------------------------------------------------------

                        for (int i = 0; i < m_Particles.Length; i++)
                        {
                            Vector2 temp;
                            temp = new Vector2(m_Random.Next(100) - 50, m_Random.Next(100) - 50);
                            temp.Normalize();
                            temp.X = temp.X * m_ChargeDist;
                            temp.Y = temp.Y * m_ChargeDist;

                            m_Particles[i].SpawnPoint        = new Vector2(m_Animate.DestinationRectangle.X, m_Animate.DestinationRectangle.Y) + temp;
                            m_Particles[i].DominantDirection = new Vector2(m_Animate.DestinationRectangle.X, m_Animate.DestinationRectangle.Y) - m_Particles[i].SpawnPoint;

                            m_Particles[i].Stop = false;

                            m_BossLaserPlayed = false;
                            if (m_BossChargingSoundPlayer == false)
                            {
                                Sounds.playSound("BossCharging", 1.0f);
                                m_BossChargingSoundPlayer = true;
                            }
                        }

                        m_StateChangeTimer += elapsedTime;

                        if (m_StateChangeTimer > m_StateDelay)
                        {
                            m_StateChangeTimer = 0.0f;

                            m_BossState = BossState.FIRING;

                            for (int i = 0; i < m_Particles.Length; i++)
                            {
                                m_Particles[i].Stop = true;
                            }

                            m_PlayerPos = new Vector2(Player.collisionRectangle().Center.X, Player.collisionRectangle().Center.Y);
                            if (m_Animate.DestinationRectangle.Y < m_PlayerPos.Y)
                            {
                                m_Direction = MovementValue.DOWN;
                            }
                            else
                            {
                                m_Direction = MovementValue.UP;
                            }
                        }
                    }
                    else if (m_BossState == BossState.FIRING)
                    {
                        m_Position.Y += m_Speed * elapsedTime * (int)m_Direction;
                        Position      = m_Position;

                        m_BossChargingSoundPlayer = false;

                        if (m_Direction == MovementValue.DOWN && m_Animate.DestinationRectangle.Y > m_PlayerPos.Y || m_Direction == MovementValue.UP && m_Animate.DestinationRectangle.Y < m_PlayerPos.Y)
                        {
                            //boss shoots here ---------------------------------------------------------------------------
                            if (m_BossLaserPlayed == false)
                            {
                                Sounds.playSound("BossLaser", 1.0f);
                                m_BossLaserPlayed = true;
                            }

                            m_BeamManager.addBeam(new Vector2(m_Animate.DestinationRectangle.X, m_Animate.DestinationRectangle.Y), m_PlayerPos);

                            m_BossState = BossState.IDLE;
                            m_Direction = MovementValue.NONE;
                        }
                    }
                    else if (m_BossState == BossState.LAVA_WAVE)
                    {
                        if (m_Position.X < m_StartPos.X + m_RetreatPos.X)
                        {
                            m_Position.X += m_Speed * elapsedTime;
                        }
                        else if ((m_Position.Y - m_Animate.DestinationRectangle.Height / 2 > m_StartPos.Y + m_RetreatPos.Y) && m_Drop == false)
                        {
                            m_Position.Y -= m_Speed * elapsedTime;


                            if (m_Position.Y - m_Animate.DestinationRectangle.Height / 2 < m_StartPos.Y + m_RetreatPos.Y)
                            {
                                m_Drop = true;
                            }
                        }
                        else if (m_Position.Y < m_StartPos.Y && m_Drop == true)
                        {
                            m_Position.Y += m_Speed * elapsedTime;
                            if (m_BossWavePlayed == false)
                            {
                                Sounds.playSound("Wave", 1.0f);
                                m_BossWavePlayed = true;
                            }

                            if (m_Position.Y > m_StartPos.Y)
                            {
                                m_LavaWave.SpawnTheWave(new Vector2(m_Position.X, Level.getHeightOfArray() * 32 - 2));
                                m_Drop           = false;
                                m_BossState      = BossState.IDLE;
                                m_BossWavePlayed = false;
                            }
                        }
                        Position = m_Position;
                    }
                    else if (m_BossState == BossState.NARWHAL)
                    {
                        if (Vector2.Subtract(m_Position, m_StartPos + m_RainPos).Length() > m_RainJumpDist)
                        {
                            Vector2 temp = new Vector2(m_StartPos.X + m_RainPos.X - m_Position.X, m_StartPos.Y + m_RainPos.Y - m_Position.Y);
                            temp.Normalize();
                            m_Position += temp * m_Speed / 4.0f * elapsedTime;
                        }
                        else
                        {
                            if (m_BossRoarPlayed == false)
                            {
                                Sounds.playSound("BossRoar", 1.0f);
                                m_BossRoarPlayed = true;
                            }
                            m_StateChangeTimer += elapsedTime;

                            Vector2 temp;
                            do
                            {
                                temp = new Vector2(m_Random.Next(100) - 50, m_Random.Next(100) - 50);
                            } while (temp.X == 0 && temp.Y == 0);

                            temp.Normalize();
                            temp.X *= m_RainJumpDist;
                            temp.Y *= m_RainJumpDist;

                            m_Position = m_StartPos + m_RainPos + temp;

                            m_NarwhalGun.NARWHAL(new Vector2(m_Position.X + m_GunPos.X, m_Position.Y + m_GunPos.Y));

                            //spitting narwhals here------------------------------------------------------------------------



                            if (m_StateChangeTimer > RAIN_LENGTH)
                            {
                                m_StateChangeTimer = 0.0f;
                                m_BossState        = BossState.IDLE;
                                m_BossRoarPlayed   = false;
                            }
                        }
                        Position = m_Position;
                    }
                }
                else if (m_BossState == BossState.DYING)
                {
                    m_Position = Vector2.Lerp(m_Position, m_StartPos + m_Hidden, m_LerpAmount);

                    //boss is dead here------------------------------------------------------------------------------------------
                    if (m_BossDeathPlayed == false)
                    {
                        Sounds.playSound("BossDeath", 1.0f);
                        m_BossDeathPlayed = true;
                    }

                    Vector2 temp;
                    do
                    {
                        temp = new Vector2(m_Random.Next(100) - 50, m_Random.Next(100) - 50);
                    } while (temp.X == 0 && temp.Y == 0);

                    temp.Normalize();
                    temp.X *= m_RainJumpDist / 2;
                    temp.Y *= m_RainJumpDist / 2;

                    m_Position += temp;
                    Position    = m_Position;

                    if (m_Position.Y > m_StartPos.Y + m_Hidden.Y)
                    {
                        m_BossState = BossState.DEAD;
                    }
                }
                else
                {
                    if (m_Position.Y < m_StartPos.Y + m_Hidden.Y + m_MoreHidden.Y)
                    {
                        m_Position.Y++;
                        Position = m_Position;
                        Vector2 tempy = m_Lava.Pos;
                        tempy.Y++;
                        m_Lava.Pos = tempy;
                    }
                }

                collisioncheck();

                m_NarwhalGun.update(gameTime);
                m_BeamManager.update(gameTime);
                m_LavaWave.update(gameTime);
                m_Animate.update(gameTime);

                m_Lava.update(gameTime);

                for (int i = 0; i < m_Particles.Length; i++)
                {
                    m_Particles[i].update(gameTime);
                }
            }
        }
Ejemplo n.º 5
0
        public Boss()
        {
            IsActive = false;

            Position = m_StartPos + m_Hidden;

            for (int i = 0; i < m_Particles.Length; i++)
            {
                m_Particles[i]      = new Particles(new Vector2(), Color.Red, 20, 5, 0.0f, new Vector2(), 3.0f, true, 70, 5, 2, true);
                m_Particles[i].Stop = true;
            }

            m_BeamManager = new BeamManager(new Rectangle(0, 0, Level.getWidthOfArray() * 32, Level.getHeightOfArray() * 32), Color.DarkRed, Color.OrangeRed);
        }