Exemple #1
0
 public void animationEnded(AnimationSequence seq)
 {
     if (animationNotifier != null)
     {
         animationNotifier(animator, AnimationSequence.AnimationStatus.STOP);
     }
 }
Exemple #2
0
        private GameObj createGiftSubObj()
        {
            GameObj g = new GiftObj();
            g.SpriteName = "gift";

            g.TouchNotifier = giftTouched;
            g.Scale = 1;
            FrameAnimator a = new FrameAnimator(45, 60);
            AnimationSequence flyingAnse = new AnimationSequence("dropping", 0, 6);
            flyingAnse.Mode = AnimationSequence.AnimationMode.LOOP;

            AnimationSequence burstingAnse = new AnimationSequence("bursting", 7, 9);
            burstingAnse.Mode = AnimationSequence.AnimationMode.STOP_AT_END;

            a.AddAnimation(flyingAnse);
            a.AddAnimation(burstingAnse);

            g.Animator = a;
            g.AnimationNotifier = giftAnimationEnded;
            g.Animator.CurrentAnimationName = "dropping";
            g.UpdateSpriteReference(game.SprManager);
            g.W = 50;

            return g;
        }
Exemple #3
0
        private BalloonObj makeBalloon(BalloonObj.BalloonType type, BalloonObj.BalloonColor color)
        {
            BalloonObj balloon = new BalloonObj();
            balloon.SpriteName = formBalloonName(type, color);
            balloon.Scale = 2;
            balloon.TouchNotifier = balloonTouched;
            balloon.Type = type;
            balloon.Color = color;

            FrameAnimator a = new FrameAnimator(196 / 4, BalloonObj.BalloonType.GIFT == type || BalloonObj.BalloonType.BOMB == type ? 80 : 60);
            AnimationSequence flyingAnse = new AnimationSequence("flying", 0, 3);
            flyingAnse.Mode = AnimationSequence.AnimationMode.LOOP;

            AnimationSequence burstingAnse = new AnimationSequence("bursting", 4, 7);
            burstingAnse.Mode = AnimationSequence.AnimationMode.STOP_AT_END;

            a.AddAnimation(flyingAnse);
            a.AddAnimation(burstingAnse);

            balloon.Animator = a;
            balloon.AnimationNotifier = balloonBurstAnimationEnded;
            balloon.Animator.CurrentAnimationName = "flying";

            balloon.UpdateSpriteReference(game.SprManager);
            balloon.W = balloon.Type == BalloonObj.BalloonType.BOMB ? 50 : 75;
            balloon.UpdatePosition(10 + random.Next(game.Graphics.PreferredBackBufferWidth - 100), game.Graphics.PreferredBackBufferHeight + 20);
            screenHeight = game.Graphics.PreferredBackBufferHeight;

            balloon.BalloonOutNotifier = balloonOutEvent;
            balloon.TouchNotifier = balloonTouched;
            balloon.TouchesRequiredToBust = 1;

            if (BalloonObj.BalloonType.BOMB == type)
            {
                balloon.updateSpeed(0, -2.25f - ((float) random.NextDouble())*BombSpeedVar);
            }
            else if (BalloonObj.BalloonType.GIFT == type)
            {
                balloon.updateSpeed(0, -3.0f - ((float)random.NextDouble())*GiftSpeedVar);
            }
            else
            {
                balloon.updateSpeed(0, MinBalloonSpeed - ((float)random.NextDouble())*SpeedVar);
            }

            return balloon;
        }
Exemple #4
0
        private void addExplosion(bool afterEffect, Vector2 pos)
        {
            GameObj obj = new GameObj();

            obj.SpriteName = "explosive";

            FrameAnimator a = new FrameAnimator(200, 200);
            AnimationSequence bombing = new AnimationSequence("exploding", 0, 9);
            bombing.Mode = AnimationSequence.AnimationMode.STOP_AT_END;

            AnimationSequence bombing2 = new AnimationSequence("exploding2", 2, 9);

            a.AddAnimation(bombing);
            a.AddAnimation(bombing2);

            obj.Animator = a;
            obj.AnimationNotifier = explodeAnimationEnded;

            obj.Animator.CurrentAnimationName = afterEffect ? "exploding2" : "exploding";

            obj.UpdateSpriteReference(game.SprManager);
            obj.UpdatePosition((int) pos.X - 100 + random.Next(150), (int) pos.Y - 100 + random.Next(150));

            addAfterInit(obj);
        }