Example #1
0
        /// <summary>
        /// Begins or continues playback of an animation.
        /// </summary>
        public void PlayAnimation(Animation animation)
        {
            // If this animation is already running, do not restart it.
            if (Animation == animation)
                return;

            // Start the new animation.
            this.animation = animation;
            this.frameIndex = 0;
            this.time = 0.0f;
        }
Example #2
0
        public void LoadContent(ContentManager Content)
        {
            font = Content.Load<SpriteFont>("Menu/menufont");

            aIdle = new Animation(Content.Load<Texture2D>("Auction/Auctioneer"), 0.2f, true, 54);
            //aGoing = new Animation(...);
            //aSold = new Animation(...);

            tSpeechBubble = Content.Load<Texture2D>("Auction/Speech_Bubble");

            sprite.PlayAnimation(aIdle);
        }
Example #3
0
        public BowlerHatInstance(BoxingPlayer player, Dictionary<string, Animation> animations, int id, float speedFactor)
            : base(player, false, id)
        {
            direction = player.direction;
            moveDirection = player.direction;
            damage = 1;

            speed *= speedFactor;
            Debug.WriteLine("Speed = " + speed);

            scale = BoxingPlayer.Scale;
            hatOffset *= scale;
            leftHatOffset *= scale;
            if (direction == -1)
            {
                speed *= -1;
                position = Vector2.Add(player.position, leftHatOffset);
            }
            else
            {
                position = Vector2.Add(player.position, hatOffset);
            }

            hitbox = new Rectangle((int)position.X, (int)position.Y, (int) (width * scale), (int) (height * scale));

            anim = animations["bowlerHat"];
            sprite.PlayAnimation(anim);
        }