Esempio n. 1
0
        // update the projectile
        public override void update(GameTime gameTime)
        {
            // translate the projectile's position
            m_position.X += (float)(m_velocity.X * (gameTime.ElapsedGameTime.TotalSeconds / (1.0 / 60.0)));
            m_position.Y += (float)(m_velocity.Y * (gameTime.ElapsedGameTime.TotalSeconds / (1.0 / 60.0)));

            // update the projectile animation
            if (m_projectile != null)
            {
                m_projectile.update(gameTime);
            }
        }
Esempio n. 2
0
        // update the explosion
        public override void update(GameTime gameTime)
        {
            // decay the speed of the explosion
            m_velocity *= 0.97f;

            // move the explosion in the same direction as its source
            m_position.X += (float)(m_velocity.X * (gameTime.ElapsedGameTime.TotalSeconds / (1.0 / 60.0)));
            m_position.Y += (float)(m_velocity.Y * (gameTime.ElapsedGameTime.TotalSeconds / (1.0 / 60.0)));

            // update the explosion animation
            m_explosion.update(gameTime);
        }