Пример #1
0
        private void CargarAnimaciones()
        {
            List <Texture> correrDer = new List <Texture>();

            for (int i = 1; i <= 14; i++)
            {
                correrDer.Add(Engine.GetTexture("Texturas/Derecha/" + i.ToString() + ".png"));
                Engine.Debug("Texturas / Derecha / " + i.ToString() + ".png" + "  Tengo: " + correrDer.Count);
            }

            List <Texture> correrIzq = new List <Texture>();

            for (int i = 1; i <= 14; i++)
            {
                correrIzq.Add(Engine.GetTexture("Texturas/Izquierda/" + i.ToString() + ".png"));
                Engine.Debug("Texturas / Derecha / " + i.ToString() + ".png" + "  Tengo: " + correrDer.Count);
            }

            List <Texture> idleDer = new List <Texture>();

            idleDer.Add(Engine.GetTexture("Texturas/Idle.png"));

            List <Texture> idleIzq = new List <Texture>();

            idleIzq.Add(Engine.GetTexture("Texturas/IdleIzq.png"));

            animCorrerDer = new Animacion(correrDer, false);
            animCorrerIzq = new Animacion(correrIzq, false);
            animIdleDer   = new Animacion(idleDer, false);
            animIdleIzq   = new Animacion(idleIzq, false);
        }
        private void CreateAnimations()
        {
            List <Texture> idleTextures = new List <Texture>();

            for (int i = 1; i < 5; i++)
            {
                Texture frame = Engine.GetTexture($"Png/Enemy/Idle/{i}.png");
                idleTextures.Add(frame);
            }
            idleAnimation = new Animation(idleTextures, 0.1f, true, "Idle");

            List <Texture> destroyTexture = new List <Texture>();

            for (int i = 1; i < 8; i++)
            {
                Texture frame = Engine.GetTexture($"Png/Enemy/Destroy/{i}.png");
                destroyTexture.Add(frame);
            }
            destroyAnimation = new Animation(destroyTexture, 0.05f, false, "Destroy");

            List <Texture> damageTexture = new List <Texture>();

            for (int i = 1; i < 4; i++)
            {
                Texture frame = Engine.GetTexture($"Png/Enemy/Damage/{i}.png");
                damageTexture.Add(frame);
            }
            damageAnimation = new Animation(damageTexture, 0.5f, false, "Idle");
        }
Пример #3
0
        public MonoBehaviour(string texturePath, Vector2 position, float scale, float angle)
        {
            Position = position;

            this.scale   = scale;
            this.angle   = angle;
            this.texture = Engine.GetTexture(texturePath);
        }
Пример #4
0
        public void AnimationParameters()
        {
            List <Texture> countdownFrames = new List <Texture>();

            for (int i = textures; i >= 0; i--)
            {
                countdownFrames.Add(Engine.GetTexture(texturePath + i.ToString() + textExtension));
            }

            animation = new Animation(countdownFrames, 1f, false);
        }
Пример #5
0
        private void CreateAnimations()
        {
            List <Texture> idleTextures = new List <Texture>();

            for (int i = 1; i < 5; i++)
            {
                Texture frame = Engine.GetTexture($"Png/Player/Idle/{i}.png");
                idleTextures.Add(frame);
            }
            idleAnimation = new Animation(idleTextures, 0.18f, true, "Idle");
        }
Пример #6
0
        public Player(string texturePath, Vector2 position, float angle, float scale, float speed, int maxLife) :
            base(texturePath, new Transform(position, new Vector2(scale, scale), angle), new Render(texture, 100, 100), new Collider(), 1, 1)
        {
            //this.lifeController = new LifeController(maxLife);
            texture    = Engine.GetTexture(texturePath);
            this.speed = speed;

            CreateAnimations();
            currentAnimation = idleAnimation;
            poolBullets      = new PoolBullets();
        }
Пример #7
0
        private void PlayBulletAnimation()
        {
            List <Texture> idleTextures = new List <Texture>();

            for (int i = 0; i < 1; i++)
            {
                Texture frame = Engine.GetTexture($"Textures/Bullet/idle/{i}.png");
                idleTextures.Add(frame);
            }
            idleAnimation = new Animation(idleTextures, 0.1f, true, "Idle");
        }
Пример #8
0
        public void PlayBackgroundAnimation()
        {
            // Idle textures
            List <Texture> backgroundTexture = new List <Texture>();

            for (int i = 0; i < 52; i++)
            {
                Texture frame = Engine.GetTexture($"Textures/Background/{i}.png");
                backgroundTexture.Add(frame);
            }

            backgroundAnimation = new Animation(backgroundTexture, 0.04f, true, "Idle");
        }
Пример #9
0
 void loadTextures()
 {
     charTextures = new List <Texture>();
     foreach (char c in charText)
     {
         if (c.Equals(' '))
         {
             charTextures.Add(Engine.GetTexture("Textures/Font/space.png"));
         }
         else if (c.Equals('.'))
         {
             charTextures.Add(Engine.GetTexture("Textures/Font/dot.png"));
         }
         else
         {
             charTextures.Add(Engine.GetTexture("Textures/Font/" + c + ".png"));
         }
     }
 }
Пример #10
0
        private void LoadTextures(string path)
        {
            DirectoryInfo myDir = new DirectoryInfo(path);

            name = myDir.Name;
            if (myDir.GetFiles().Length > 1)
            {
                loop = true;

                foreach (FileInfo file in myDir.GetFiles())
                {
                    frames.Add(Engine.GetTexture(file.FullName));
                }
            }
            else
            {
                frames.Add(Engine.GetTexture(myDir.GetFiles()[0].FullName));
                actualFrame = frames[0];
                loop        = false;
            }
        }
Пример #11
0
        private void PlayEnemyAnimations()
        {
            // Idle textures
            List <Texture> idleTextures = new List <Texture>();

            for (int i = 0; i < 3; i++)
            {
                Texture frame = Engine.GetTexture($"Textures/Enemy/Idle/{i}.png");
                idleTextures.Add(frame);
            }

            idleAnimation = new Animation(idleTextures, 0.1f, true, "Idle");

            // Explosion textures
            List <Texture> explosionTextures = new List <Texture>();

            for (int i = 0; i < 7; i++)
            {
                Texture frame = Engine.GetTexture($"Textures/Enemy/Explosion/{i}.png");
                explosionTextures.Add(frame);
            }

            explosionAnimation = new Animation(explosionTextures, 0.05f, false, "Explosion");
        }