Exemplo n.º 1
0
 public Player2(Texture2D statique, Texture2D animation, Vector2 positionInitiale)
 {
     this.statique = statique;
     this.animation = animation;
     this.positionGlobale = positionInitiale;
     this.animate = new Animate(animation, 1, 12);
 }
Exemplo n.º 2
0
        public Ennemi(Animate textureAnime, Vector2 position, Hero hero, Map map)
        {
            this.textureAnime = Ressources.GetPerso(Perso.Choisi).ennemiTextureAnime;
            this.texture = Ressources.GetPerso(Perso.Choisi).ennemiTexture;
            this.personnageAnime = Ressources.GetPerso(Perso.Choisi).ennemiAnime;
            this.positionGlobale = position;
            this.positionInitiale = position;
            this.vitesse = hero.vitesse;
            this.vitesseInitiale = hero.vitesse;
            this.container = new Rectangle((int)position.X, (int)position.Y, (int)(textureAnime.Texture.Width / textureAnime.Columns), textureAnime.Texture.Height);
            this.type = TypePerso.Ennemi;
            this.poids = new Vector2(0, hero.poids.Y);
            this.force = Vector2.Zero;
            this.reaction = Vector2.Zero;
            this.map = map;
            this.currentObjet = new Objet();
            this.hero = hero;

            ACDC = new Rectangle(0, 0, texture.Width, texture.Height);

            animate = true;
            dead = false;

            font = Ressources.GetPerso(Perso.Choisi).font;

            #region moteur à particules
            particleComponent = new ParticleComponent(Ressources.Game);
            Ressources.Game.Components.Add(particleComponent);
            Emitter fireEmitter = new Emitter();
            fireEmitter.Active = false;
            fireEmitter.TextureList.Add(Ressources.GetPerso(Perso.Choisi).obstacle);
            fireEmitter.RandomEmissionInterval = new RandomMinMax(50);
            fireEmitter.ParticleLifeTime = 9000;
            fireEmitter.ParticleDirection = new RandomMinMax(270, 300);
            fireEmitter.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            fireEmitter.ParticleRotation = new RandomMinMax(0, 180);
            fireEmitter.RotationSpeed = new RandomMinMax(0.04f);
            fireEmitter.ParticleFader = new ParticleFader(false, true, 30);
            fireEmitter.ParticleScaler = new ParticleScaler(0.2f, 0.18f, 0, 100);
            fireEmitter.Position = new Vector2(400, 650);
            //******piece*********
            Emitter desinté_piece = new Emitter();
            desinté_piece.Active = false;
            desinté_piece.TextureList.Add(Ressources.GetPerso(Perso.Choisi).piece);
            desinté_piece.RandomEmissionInterval = new RandomMinMax(50);
            desinté_piece.ParticleLifeTime = 9000;
            desinté_piece.ParticleDirection = new RandomMinMax(270, 300);
            desinté_piece.ParticleSpeed = new RandomMinMax(10, 20); // g modifié le moteur a particule;
            desinté_piece.ParticleRotation = new RandomMinMax(0, 180);
            desinté_piece.RotationSpeed = new RandomMinMax(0.04f);
            desinté_piece.ParticleFader = new ParticleFader(false, true, 30);
            desinté_piece.ParticleScaler = new ParticleScaler(1.2f, 0.18f, 0, 100);
            desinté_piece.Position = new Vector2(400, 650);
            particleComponent.particleEmitterList.Add(fireEmitter);
            particleComponent.particleEmitterList.Add(desinté_piece);
            #endregion
        }
Exemplo n.º 3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(Ressources.GetPerso(Perso.Choisi).bg, new Rectangle(0, 0, 1280, 800), Color.White);

            foreach (Objet objet in map.Objets)
            {
                spriteBatch.Draw(objet.texture, new Rectangle((int)(objet.position.X - position.X), (int)(objet.position.Y), 45, 45), Color.White);
                if (objet.type == TypeCase.Piece)
                {
                    Animate piece = new Animate(Ressources.GetPerso(Perso.Choisi).piece, 8, 8);
                    piece.Update(0.3f);
                    piece.Draw(spriteBatch, new Vector2(objet.position.X - position.X, objet.position.Y), 3);
                }
            }

            hero.Draw(spriteBatch, position);
            ennemi.Draw(spriteBatch, position);
        }
Exemplo n.º 4
0
        public Hero(Animate textureAnime, Vector2 position, Vector2 vitesse, float poids, Map map)
        {
            this.texture = Ressources.GetPerso(Perso.Choisi).heroTexture;
            this.textureAnime = Ressources.GetPerso(Perso.Choisi).heroTextureAnime;
            this.textureDown = Ressources.GetPerso(Perso.Choisi).heroTextureDown;
            this.personnageAnime = Ressources.GetPerso(Perso.Choisi).heroAnime;
            this.positionGlobale = position;
            this.positionInitiale = position;
            this.vitesse = vitesse;
            this.vitesseInitiale = vitesse;
            this.type = TypePerso.Hero;
            this.poids = new Vector2(0, poids);
            this.force = Vector2.Zero;
            this.reaction = Vector2.Zero;
            this.map = map;
            containerDown = new Rectangle((int)positionGlobale.X, (int)positionGlobale.Y + texture.Height - textureDown.Height, textureDown.Width, textureDown.Height);
            containerUp = new Rectangle((int)positionGlobale.X, (int)positionGlobale.Y, texture.Width, texture.Height);
            this.container = containerUp;
            down = false;
            acdcTexture = Ressources.Content.Load<Texture2D>("ACDC");
            containerACDC = new Rectangle((int)positionGlobale.X - acdcTexture.Width, (int)positionGlobale.Y, acdcTexture.Width, acdcTexture.Height);
            acdc = false;
            currentObjet = new Objet();
            animate = true;
            random = new Random();
            bonusVitesse = false;
            dead = false;
            win = false;
            superman = Ressources.Content.Load<Texture2D>("superman");
            font = Ressources.GetPerso(Perso.Choisi).font;
            //moteur à particule pour la bombe
            #region Moteur a particules
            Emitter.statut = true;
            particleComponent = new ParticleComponent(Ressources.Game);
            Ressources.Game.Components.Add(particleComponent);
            bombe.Active = false;
            bombe.TextureList.Add(Ressources.Content.Load<Texture2D>("fire"));
            bombe.RandomEmissionInterval = new RandomMinMax(2.0d);
            bombe.ParticleLifeTime = 2000;
            bombe.ParticleDirection = new RandomMinMax(0, 359);
            bombe.ParticleSpeed = new RandomMinMax(0.1f, 1.0f);
            bombe.ParticleRotation = new RandomMinMax(0, 100);
            bombe.RotationSpeed = new RandomMinMax(0.015f);
            bombe.ParticleFader = new ParticleFader(false, true, 1350);
            bombe.ParticleScaler = new ParticleScaler(false, 0.3f);
            bombe.Position = new Vector2(400, 400);
            particleComponent.particleEmitterList.Add(bombe);
            //***************fumée**************************
            smokeEmitter.Active = false;
            smokeEmitter.TextureList.Add(Ressources.Content.Load<Texture2D>("smoke"));
            smokeEmitter.RandomEmissionInterval = new RandomMinMax(100);
            smokeEmitter.ParticleLifeTime = 9000;
            smokeEmitter.ParticleDirection = new RandomMinMax(-5, 5);
            smokeEmitter.ParticleSpeed = new RandomMinMax(0.6f);
            smokeEmitter.ParticleRotation = new RandomMinMax(0);
            smokeEmitter.RotationSpeed = new RandomMinMax(-0.008f, 0.008f);
            smokeEmitter.ParticleFader = new ParticleFader(true, true);
            smokeEmitter.ParticleScaler = new ParticleScaler(0.15f, 0.7f, 400, smokeEmitter.ParticleLifeTime);
            smokeEmitter.Position = new Vector2(0, 0);
            particleComponent.particleEmitterList.Add(smokeEmitter);
            //*********************************************
            //*******************************************

            // **** neige*****************
            testEmitter2.Active = false;
            testEmitter2.TextureList.Add(Ressources.Content.Load<Texture2D>("raindrop"));
            testEmitter2.RandomEmissionInterval = new RandomMinMax(9.0d);
            testEmitter2.ParticleLifeTime = 1000;
            testEmitter2.ParticleDirection = new RandomMinMax(170);
            testEmitter2.ParticleSpeed = new RandomMinMax(5.0f);
            testEmitter2.ParticleRotation = new RandomMinMax(0);
            testEmitter2.RotationSpeed = new RandomMinMax(0f);
            testEmitter2.ParticleFader = new ParticleFader(false, true, 800);
            testEmitter2.ParticleScaler = new ParticleScaler(false, 1.0f);
            testEmitter2.Opacity = 255;
            particleComponent.particleEmitterList.Add(testEmitter2);
            //**************************
            #endregion
        }