private void EnsureAnimationSequences() { if (_animationSequences != null) { return; } _animationSequences = new Dictionary(); AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/1.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/2.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/3.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/4.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/5.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/6.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc1/7.png", false), 252 / 2, 116); _animationSequences["Npc1"] = sequence; sequence = new AnimationSequence(); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/1.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/2.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/3.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/4.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/5.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/6.png", false), 252 / 2, 116); sequence.AddSprite(_level.LoadImage("Images/Race/npc2/7.png", false), 252 / 2, 116); _animationSequences["Npc2"] = sequence; }
public Bullet(Vector2D location, int strength, IMotion motion) : base(location, motion) { AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(ShooterLevel.Current.LoadImage((strength == 1)? "images/shooter/meteor/sb.png" : "images/shooter/meteor/b.png", false), 0, 0); AnimationSequences["Default"] = sequence; StartAnimation("Default"); _strength = strength; }
protected override List <AnimationSequence> EnsureSequences(Scene scene) { List <AnimationSequence> sequences = new List <AnimationSequence>(); AnimationSequence sequence = new AnimationSequence(); ImageElement image = scene.LoadImage("Images/Race/obstacles/pole.png", false); sequence.AddSprite(image, 10, 80); sequences.Add(sequence); return(sequences); }
public Bonus(Vector2D location, string bonusType) : base() { Location = new Vector3D(location.X, location.Y, ShooterLevel.BonusZ); _motion = new SineMotion(0, location.Y, 0.03f, 20); AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(ShooterLevel.Current.LoadImage("images/shooter/bonus/" + bonusType + ".png", false), 0, 0); AnimationSequences["Default"] = sequence; StartAnimation("Default"); BonusType = bonusType; }
public BossGun(IMotion motion) : base(motion) { ShooterLevel level = ShooterLevel.Current; AnimationSequence sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun1.png", false), 79, 45); sequence.Delay = 0; AnimationSequences[DefaultAnimation] = sequence; sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun2.png", false), 79, 1); sequence.Delay = 0; AnimationSequences["Gun2"] = sequence; sequence = new AnimationSequence(); sequence.AddSprite(level.LoadImage("images/shooter/boss/gun3.png", false), 100, 21); sequence.Delay = 0; AnimationSequences["Gun3"] = sequence; sequence = new AnimationSequence(); sequence.AddSprites(new ImageElement[] { level.LoadImage("images/shooter/boss/0001.png", false), level.LoadImage("images/shooter/boss/0002.png", false), level.LoadImage("images/shooter/boss/0003.png", false), level.LoadImage("images/shooter/boss/0004.png", false), level.LoadImage("images/shooter/boss/0005.png", false), level.LoadImage("images/shooter/boss/0006.png", false), level.LoadImage("images/shooter/boss/0007.png", false), level.LoadImage("images/shooter/boss/0008.png", false), level.LoadImage("images/shooter/boss/0009.png", false), }, 50, 50); sequence.Delay = 50; sequence.Loop = false; AnimationSequences[ExplosionAnimation] = sequence; StartAnimation(DefaultAnimation); Life = 150; }
public override void Init(Scene level) { _level = (ShooterLevel)level; Ship = new GameObject(); AnimationSequence sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/shooter/meteor/2.png", true), 0, 0); Ship.AnimationSequences["Default"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/shooter/meteor/3.png", true), 0, 0); Ship.AnimationSequences["Up"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/shooter/meteor/1.png", true), 0, 0); Ship.AnimationSequences["Down"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 40; sequence.Loop = false; sequence.AddSprites(new ImageElement[] { _level.LoadImage("Images/shooter/meteor/e1.png", false), _level.LoadImage("Images/shooter/meteor/e5.png", false), _level.LoadImage("Images/shooter/meteor/e9.png", false), _level.LoadImage("Images/shooter/meteor/e13.png", false), _level.LoadImage("Images/shooter/meteor/e17.png", false) }, 0, 0); Ship.AnimationSequences["Crash"] = sequence; Ship.AnimationCompleted += new AnimationCompletedEventHandler(Ship_AnimationCompleted); _speed = 0.15f; Ship.Location = new Vector3D(20, 390, ShooterLevel.MeteorZ); Ship.StartAnimation("Default"); }
protected override List <AnimationSequence> EnsureSequences(Scene scene) { List <AnimationSequence> sequences = new List <AnimationSequence>(); AnimationSequence sequence = new AnimationSequence(); ImageElement image = scene.LoadImage("Images/Race/obstacles/r1.png", false); sequence.AddSprite(image, 47, 78); sequences.Add(sequence); sequence = new AnimationSequence(); image = scene.LoadImage("Images/Race/obstacles/r2.png", false); sequence.AddSprite(image, 47, 78); sequences.Add(sequence); sequence = new AnimationSequence(); image = scene.LoadImage("Images/Race/obstacles/r3.png", false); sequence.AddSprite(image, 39, 77); sequences.Add(sequence); sequence = new AnimationSequence(); image = scene.LoadImage("Images/Race/obstacles/r4.png", false); sequence.AddSprite(image, 50, 79); sequences.Add(sequence); sequence = new AnimationSequence(); image = scene.LoadImage("Images/Race/obstacles/r5.png", false); sequence.AddSprite(image, 46, 74); sequences.Add(sequence); sequence = new AnimationSequence(); image = scene.LoadImage("Images/Race/obstacles/r6.png", false); sequence.AddSprite(image, 47, 84); sequences.Add(sequence); return(sequences); }
public override void Init(Scene level) { _level = (RaceLevel)level; CarObject = new GameObject(); AnimationSequence sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/c1.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c1_2.png", false), 165, 134); CarObject.AnimationSequences["Forward"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c1.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c1_2.png", false), 165, 134); CarObject.AnimationSequences["b-Forward"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/c3.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c3_2.png", false), 165, 134); CarObject.AnimationSequences["Left"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c3.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c3_2.png", false), 165, 134); CarObject.AnimationSequences["b-Left"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/c13.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c13_2.png", false), 165, 134); CarObject.AnimationSequences["Right"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c13.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/b-c13_2.png", false), 165, 134); CarObject.AnimationSequences["b-Right"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 100; sequence.AddSprite(_level.LoadImage("Images/Race/car/c1.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c5.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c6.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c7.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c8.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c9.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c10.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c11.png", false), 165, 134); sequence.Loop = false; CarObject.AnimationSequences["Crash"] = sequence; sequence = new AnimationSequence(); sequence.Delay = 200; sequence.AddSprite(_level.LoadImage("Images/Race/car/c11.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c10.png", false), 165, 134); sequence.AddSprite(_level.LoadImage("Images/Race/car/c9.png", false), 165, 134); sequence.Loop = false; CarObject.AnimationSequences["Skid"] = sequence; CarObject.StartAnimation("Forward"); CarObject.AnimationCompleted += new AnimationCompletedEventHandler(AnimationCompleted); }