Esempio n. 1
0
        public void Draw(GameTime gametime, SpriteBatch spritebatch)
        {
            for (int i = 0; i < Missiles.Count; i++)
            {
                Missiles[i].Draw(gametime, spritebatch);
            }
            ConducteurAP.Draw(gametime, spritebatch, Position, SpriteEffects.None);
            TireurAP.Draw(gametime, spritebatch, Position + DecalageMotoTireur, SpriteEffects.None);

            base.Draw(spritebatch);

            if (StaticInfo.DebugTextureActif)
            {
                spritebatch.Draw(Ressource.TestingTexture, RecCollision, Color.Yellow);
            }
        }
Esempio n. 2
0
        public void Update(ref Monkey SingeJoueur)
        {
            ConducteurAP.PlayAnimation(ConducteurA);
            TireurAP.PlayAnimation(TireurA);

            if (CptAvancementX < AvancementX)
            {
                Position.X     -= StaticInfo.SpeedMoto;
                CptAvancementX += StaticInfo.SpeedMoto;
            }

            RandomY    += 0.15f;
            Position.Y += (float)Math.Sin(RandomY) * 2;

            for (int i = 0; i < SingeJoueur.ListBananes.Count; i++)
            {
                if (SingeJoueur.ListBananes[i].RecCollision.Intersects(RecCollision))
                {
                    SingeJoueur.ListBananes[i].Delete = true;
                    CptDegat++;
                    ApplyDamage(1);
                }
            }

            CptTimerMissiles += StaticInfo.SpeedTimerMissile;
            if (CptTimerMissiles > 1)
            {
                Missiles.Add(new Missile(Position));
                CptTimerMissiles = 0;
            }

            for (int i = 0; i < Missiles.Count; i++)
            {
                Missiles[i].Update();

                for (int j = 0; j < SingeJoueur.ListBananes.Count; j++)
                {
                    if (SingeJoueur.ListBananes[j].RecCollision.Intersects(Missiles[i].RecCollision))
                    {
                        Missiles[i].Delete = true;
                        SingeJoueur.ListBananes[j].Delete = true;
                    }
                }

                if (Missiles[i].RecCollision.Intersects(SingeJoueur.RecCollision))
                {
                    SingeJoueur.ApplyDamage(StaticInfo.DamageMissile);
                    Missiles[i].Delete = true;
                }

                if (Missiles[i].Delete)
                {
                    Missiles.RemoveAt(i);
                    i--;
                }
            }

            if (CptDegat > 3)
            {
                Delete = true;
            }

            base.Udpate(RecCollision);
            RecCollision.X = (int)Position.X;
            RecCollision.Y = (int)(Position.Y - RecCollision.Height * 1.5f);
        }