コード例 #1
0
ファイル: EnemyPool.cs プロジェクト: JoeOsborn/Cyclyc
 public List<CycSprite> Collide(CycSprite sprite)
 {
     List<CycSprite> collided = new List<CycSprite>();
     foreach (CycSprite e in enemies)
     {
         if (!e.Alive) { continue; }
         if (e.Collide(sprite))
         {
             collided.Add(e);
         }
     }
     return collided;
 }
コード例 #2
0
ファイル: EnemyPool.cs プロジェクト: JoeOsborn/Cyclyc
 public void EnemyOffScreen(CycSprite e)
 {
 }
コード例 #3
0
ファイル: CycGame.cs プロジェクト: JoeOsborn/Cyclyc
 public void AddSprite(CycSprite cs)
 {
     sprites.Add(cs);
     cs.View = view;
     //sprites added after LoadContent is called won't get their content loaded.  sucks!
 }
コード例 #4
0
ファイル: ShipGame.cs プロジェクト: JoeOsborn/Cyclyc
 public override void Update(GameTime gameTime)
 {
     if (Game.SongIsEnding)
     {
         float r = (float)Game.OutroRatio;
         for (int i = 0; i < backgrounds.Count; i++)
         {
             CycBackground bg = backgrounds[i];
             bg.ScrollSpeed = ParallaxSpeeds[i] * (1 - r);
         }
         if (earth == null)
         {
             earth = new EndingSprite(Game, "earth", new Vector2(-400, 90), 301);
             earth.Initialize();
             earth.LoadContent();
             AddSprite(earth);
         }
         earth.Velocity = new Vector2(EarthSpeed * (1 - r), earth.Velocity.Y);
     }
     CrushBeams.Update(gameTime);
     List<CollisionGroup> crushCollided = enemyBatch.CollidePool(CrushBeams);
     foreach (CollisionGroup crushed in crushCollided)
     {
         CycEnemy deadEnemy = (CycEnemy)crushed.collider;
         if (!deadEnemy.Alive) { continue; }
         bool leftOfCenter = (ship.Position.X >= deadEnemy.Position.X);
         Combo += deadEnemy.Difficulty;
         NextGame.DeliverEnemy(leftOfCenter, deadEnemy.Difficulty);
         deadEnemy.Die();
         foreach (BeamBit beam in crushed.collided)
         {
             beam.Die();
         }
     }
     enemyBatch.Update(gameTime);
     base.Update(gameTime);
     if (!ship.Dying)
     {
         List<CycSprite> shipCollided = enemyBatch.Collide(ship);
         if (shipCollided.Count() != 0)
         {
             KillPlayer();
         }
         List<CycSprite> skimCollided = enemyBatch.Collide(skim);
         if (skimCollided.Count() != 0)
         {
             foreach (CycSprite s in skimCollided)
             {
                 skimParticles.AddParticles(s.Center);
             }
             Skim(skimCollided.Count());
         }
     }
     else
     {
         ship.StartPosition = StartPosition;
     }
     skim.ResizeTo(MinSkimRadius + (DefaultSkimRadius-MinSkimRadius) * (1-ship.PowerRatio), SkimResizeDuration);
 }
コード例 #5
0
ファイル: JetpackGirl.cs プロジェクト: JoeOsborn/Cyclyc
        public override void LoadContent()
        {
            int[] timings = TimingSequence(5, 2);
            animations["default"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["death"] =
                new Animation(FrameSequence(8, 1), TimingSequence(1,1), false);
            animations["run"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["run-attacking"] =
                new Animation(FrameSequence(4, 2), timings, true);
            animations["jet"] =
                new Animation(FrameSequence(2, 2), timings, true);
            animations["jet-attacking"] =
                new Animation(FrameSequence(6, 2), timings, true);
            animations["begin-jet"] =
                new Animation(FrameSequence(2, 2), timings, true);
            animations["begin-jet-attacking"] =
                new Animation(FrameSequence(6, 2), timings, true);
            animations["stop-jet"] =
                new Animation(FrameSequence(2, 2), timings, true);
            animations["stop-jet-attacking"] =
                new Animation(FrameSequence(6, 2), timings, true);
            animations["jump"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["jump-attacking"] =
                new Animation(FrameSequence(4, 2), timings, true);
            animations["fall"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["fall-attacking"] =
                new Animation(FrameSequence(4, 2), timings, true);
            animations["land"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["land-attacking"] =
                new Animation(FrameSequence(4, 2), timings, true);
            animations["run"] =
                new Animation(FrameSequence(0, 2), timings, true);
            animations["run-attacking"] =
                new Animation(FrameSequence(4, 2), timings, true);

            animations["stand-still"] =
                new Animation(FrameSequence(1, 1), TimingSequence(5, 1), false);
            Play("default");

            Wrench = new CycSprite(Game);
            Wrench.Initialize();
            Wrench.AddAnimation("default", new int[] { 0, 1 }, new int[] { 5, 5 }, true);
            Wrench.AddAnimation("super", new int[] { 2, 3 }, new int[] { 5, 5 }, true);
            Wrench.Play("default");
            Wrench.AssetName = "wrench";
            Wrench.Visible = false;
            Wrench.Alive = false;
            Wrench.CollisionStyle = CollisionStyle.Circle;
            Wrench.SpriteWidth = 14;
            Wrench.ScaleFactor = 2.0f;
            Wrench.Radius = 14;
            Wrench.VisualRadius = 14;
            Wrench.LoadContent();

            deathSnd = Game.SoundInstance("rpg-die");
            jetHighSnd = Game.SoundInstance("rpg-jet-high");
            jetMidSnd = Game.SoundInstance("rpg-jet-mid");
            jetLowSnd = Game.SoundInstance("rpg-jet-low");
            jumpSnd = Game.SoundInstance("rpg-jump");
            landSnd = Game.SoundInstance("rpg-land");

            base.LoadContent();
            normalTexture = spriteSheet;
            superTexture = Game.Content.Load<Texture2D>("rockGirlSuper");
        }