Inheritance: SpriteSheet, IUpdateable
Esempio n. 1
0
        /// <summary>
        ///     Initializes a new Player class.
        /// </summary>
        /// <param name="texture">The Texture.</param>
        /// <param name="texture2">The ErasedTexture.</param>
        public Player(Texture2D texture, Texture2D texture2)
        {
            _erased = texture2;
            Bounds = new Polygon(new Vector2(1, 6), new Vector2(5, 4), new Vector2(11, 0), new Vector2(22, 0), new Vector2(28, 6),
                new Vector2(28, 11), new Vector2(31, 15), new Vector2(28, 21), new Vector2(19, 21), new Vector2(18, 23),
                new Vector2(9, 23), new Vector2(0, 13), new Vector2(1, 7));
            _pen = new Pen(Color.White, 1);
            _spriteSheet = new AnimatedSpriteSheet(texture) {AutoUpdate = true};
            _spriteSheet.Add(new Keyframe(new Rectangle(0, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(32, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(64, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(96, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(128, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(160, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(192, 0, 32, 24), 100));

            _spriteSheet.Add(new Keyframe(new Rectangle(224, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(256, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(288, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(320, 0, 32, 24), 100));
            _spriteSheet.Add(new Keyframe(new Rectangle(352, 0, 32, 24), 100));

            Position = new Vector2(300, 230);
            Velocity = new Vector2(0, 0);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new Player class.
        /// </summary>
        /// <param name="playerTexture">The PlayerTexture.</param>
        public Player(Texture2D playerTexture)
        {
            Sprite = new AnimatedSpriteSheet(playerTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(115, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(230, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(345, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(460, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(575, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(690, 0, 115, 69), 50));
            Sprite.Add(new Keyframe(new Rectangle(805, 0, 115, 69), 50));

            Position = new Vector2(0, 190);
            Health = 100;
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new Enemy class.
        /// </summary>
        /// <param name="enemyTexture">The EnemyTexture.</param>
        public Enemy(Texture2D enemyTexture)
        {
            Sprite = new AnimatedSpriteSheet(enemyTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(47, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(94, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(141, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(188, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(235, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(282, 0, 47, 61), 30));
            Sprite.Add(new Keyframe(new Rectangle(329, 0, 47, 61), 30));

            Position = new Vector2(0, 0);
            Health = 100;
            MaximumHealth = Health;
            Velocity = 0.1f;
            _isVisible = true;
            EnableHPBar = true;
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new Explosion class.
        /// </summary>
        /// <param name="explosionTexture">The ExplosionTexture.</param>
        public Explosion(Texture2D explosionTexture)
        {
            Sprite = new AnimatedSpriteSheet(explosionTexture) {AutoUpdate = true};

            Sprite.Add(new Keyframe(new Rectangle(0, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(133.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(267, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(400.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(534, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(667.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(801, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(934.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1068, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1201.5f, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1335, 0, 133.5f, 134), 20));
            Sprite.Add(new Keyframe(new Rectangle(1468.5f, 0, 133.5f, 134), 20));

            Position = new Vector2(0, 0);
            _isVisible = true;
            RemainingLifeTime = 300;
        }