Exemplo n.º 1
0
        public override void update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            if (m_State == PixieState.ALIVE)
            {
                move(gameTime);

                if (Destination.Intersects(Player.collisionRectangle()) == true)
                {
                }
                else
                {
                    animationRow(gameTime);
                }

                if (CollisionCheck.collisionCheck(Destination, Player.collisionRectangle()))
                {
                    Player.takeDamage();
                }
            }
            else
            {
                m_Timer += elapsedTime;
                m_Animate.changAnimation((int)PixieAnimations.POOF);
                if (m_PixieDeathPlayed == false)
                {
                    Sounds.playSound("PixieDeath", 0.50f);
                    m_PixieDeathPlayed = true;
                }
            }

            base.update(gameTime);
        }
Exemplo n.º 2
0
        public override void update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            if (m_State == ImpState.ALIVE)
            {
                move(gameTime);
                animationRow(gameTime);

                if (CollisionCheck.collisionCheck(Destination, Player.collisionRectangle()))
                {
                    Player.takeDamage();
                }
            }
            else
            {
                m_Timer += elapsedTime;
                m_Animate.changAnimation((int)ImpAnimations.IDLEDYING);
                if (m_ImpDeathSoundPlayed == false)
                {
                    Sounds.playSound("ImpDeath", 0.5f);
                    m_ImpDeathSoundPlayed = true;
                }
            }

            base.update(gameTime);
        }
Exemplo n.º 3
0
 private void collisionCheck()
 {
     if (CollisionCheck.collisionCheck(m_Animate.DestinationRectangle, Player.collisionRectangle()))
     {
         Player.takeDamage();
     }
 }
Exemplo n.º 4
0
        private void collisionCheck()
        {
            if (CollisionCheck.collisionCheck(m_DestinationRect, Player.collisionRectangle()))
            {
                Player.takeDamage();
            }

            if (CollisionCheck.collisionCheck(m_DestinationRect, m_LevelBounds) != true)
            {
                m_IsActive = false;
            }
        }
Exemplo n.º 5
0
        public override void update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            //determine if the player is in range and the spider is in an aggroeable state
            if (Math.Abs(m_Position.X - Player.collisionRectangle().Center.X) <= m_AggroRange)
            {
                if (m_AggroState == SpiderAggroState.NONE)
                {
                    m_AggroState = SpiderAggroState.AGGROED;
                }
            }

            //move spider
            if (m_AggroState == SpiderAggroState.AGGROED || m_State == SpiderState.DYING)
            {
                m_Position.Y += m_Speed * elapsedTime;
            }
            else if (m_AggroState == SpiderAggroState.RETREATING)
            {
                m_Position.Y -= m_Speed * elapsedTime;
            }


            if (CollisionCheck.collisionCheck(Destination, m_UnAggroedRectangle))
            {
                m_AggroState = SpiderAggroState.NONE;
            }

            m_Animate.updatePosition(m_Position);

            CollisionType[,] temp = Level.backgroundCollisionCheck(Destination);

            for (int i = 0; i < temp.GetLength(0); i++)
            {
                for (int j = 0; j < temp.GetLength(1); j++)
                {
                    if (temp[i, j].m_WasThereACollision == true)
                    {
                        m_AggroState = SpiderAggroState.RETREATING;
                    }
                }
            }

            if (CollisionCheck.collisionCheck(Destination, Player.collisionRectangle()))
            {
                Player.takeDamage();
            }


            base.update(gameTime);
        }
Exemplo n.º 6
0
 private void collisionCheck()
 {
     if (m_IsActive == true)
     {
         for (int i = 0; i < m_CollisionRects.Length; i++)
         {
             if (CollisionCheck.collisionCheck(m_CollisionRects[i], Player.collisionRectangle()))
             {
                 Player.takeDamage();
             }
         }
     }
 }
Exemplo n.º 7
0
        public override void update(GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            float aggroRange = 300.0f;

            Vector2 m_distanceFromPlayer     = new Vector2(m_Position.X - Player.collisionRectangle().Center.X, m_Position.Y - Player.collisionRectangle().Center.Y);
            Vector2 m_distanceFromResetPoint = new Vector2(m_Position.X - m_ResetPoint.X, m_Position.Y - m_ResetPoint.Y);

            if (m_distanceFromPlayer.Length() <= aggroRange)
            {
                m_distanceFromPlayer.Normalize();
                m_Position.Y -= m_distanceFromPlayer.Y * m_Speed * elapsedTime;
                m_Position.X -= m_distanceFromPlayer.X * m_Speed * elapsedTime;
                if (m_SoundPlayed == false)
                {
                    Sounds.playSound("BeeAggro", 0.25f);
                    m_SoundPlayed = true;
                }
            }
            else
            {
                if (m_distanceFromResetPoint.Length() != 0.0f)
                {
                    m_distanceFromResetPoint.Normalize();
                    m_Position.Y -= m_distanceFromResetPoint.Y * m_Speed * elapsedTime;
                    m_Position.X -= m_distanceFromResetPoint.X * m_Speed * elapsedTime;
                    m_SoundPlayed = false;
                }
            }

            if (CollisionCheck.collisionCheck(Destination, Player.collisionRectangle()))
            {
                Player.takeDamage();
            }


            base.update(gameTime);
        }
Exemplo n.º 8
0
        public override void update(Microsoft.Xna.Framework.GameTime gameTime)
        {
            float elapsedTime = (float)gameTime.ElapsedGameTime.Milliseconds / 1000;

            if (m_State == UndeadUnicornState.ALIVE)
            {
                move(gameTime);
                animationRow(gameTime);

                if (CollisionCheck.collisionCheck(Destination, Player.collisionRectangle()))
                {
                    Player.takeDamage();
                }
            }
            else
            {
                m_Timer += elapsedTime;
                m_Animate.changAnimation((int)UndeadUnicornAnimations.DYINGRIGHT);
            }

            base.update(gameTime);
        }