protected void InitAnimator() { FrameAnimator a = new FrameAnimator(25, 25); AnimationSequence seq = new AnimationSequence("rotating", 0, 8); seq.Mode = AnimationSequence.AnimationMode.LOOP; a.AddAnimation(seq); a.CurrentAnimationName = "rotating"; this.Animator = a; }
protected void InitAnimator() { FrameAnimator animator = new FrameAnimator(55, 55); AnimationSequence seq = new AnimationSequence(NORMAL, 1, 1); seq.Mode = AnimationSequence.AnimationMode.LOOP; AnimationSequence starring = new AnimationSequence(STARRING, 2, 5); starring.Mode = AnimationSequence.AnimationMode.STOP_AT_END; AnimationSequence electro = new AnimationSequence(ELECTRO, 11, 14); electro.Mode = AnimationSequence.AnimationMode.LOOP; AnimationSequence killed = new AnimationSequence(KILLED, 15, 20); killed.Mode = AnimationSequence.AnimationMode.LOOP; animator.AddAnimation(seq); animator.AddAnimation(starring); animator.AddAnimation(electro); animator.AddAnimation(killed); animator.CurrentAnimationName = "starring"; this.Animator = animator; this.AnimationNotifier = OnAnimationComplete; }
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; }
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; }
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); }