protected override void InitBadPixels() { base.InitBadPixels(); BadPixel bp = BadPixel.Create(); // Cloaky(); bp.PositionAndTarget = new Vector2(5f, 34f); //bp.TargetSpeed = 18.0f; // TODO Add(bp); bp = BadPixel.Create(); bp.PositionAndTarget = new Vector2(37f, 48f); Add(bp); bp = BadPixel.Create(); bp.PositionAndTarget = new Vector2(65f, 101f); Add(bp); bp = BadPixel.Create(); bp.PositionAndTarget = new Vector2(121f, 13f); Add(bp); bp = BadPixel.Create(); bp.PositionAndTarget = new Vector2(77f, 5f); Add(bp); }
protected override void OnUpdate(ref UpdateParams p) { base.OnUpdate(ref p); // adapt scroll speed to how fast pixie goes Background.TargetSpeed = SCREEN_MOTION_SPEED * pixie.Velocity; // create new pixels falling timerNewBaddie += p.Dt; if (timerNewBaddie >= nextBaddieInterval && SimTime >= 4.0f) { timerNewBaddie = 0f; nextBaddieInterval = RandomMath.RandomBetween(MinPauseBetweenBaddies, MaxPauseBetweenBaddies); BadPixel b = BadPixel.Create((int)Math.Round(RandomMath.RandomBetween(-0.49f, 23.49f))); float x = RandomMath.RandomBetween(-40f, 40f); float y = RandomMath.RandomBetween(-50f, -40f); b.PositionAndTarget = new Vector2(x + pixie.Target.X, y + LevelBackground.ViewPos.Y); AddNextUpdate(b); } if (pixie.Score > 0) { tObjCount.Text = "Tree-score: " + pixie.Score; tObjCount.Visible = true; } // scroll background if (SimTime >= SCROLLING_START_TIME) { Background.Target.Y = BG_STARTING_POS.Y - SCROLL_SPEED_PIXELS_PER_SEC * (SimTime - SCROLLING_START_TIME); } //Level.Current.Background.Motion.ZoomCenterTarget = Level.Current.pixie.Motion; // resolution scale changing //if (SimTime>= SCROLLING_START_TIME && Background.Target.Y < 700f && numberOfZoomOuts == 0) // ScreenBorderHit(); //if (Background.Target.Y < 710f && numberOfZoomOuts == 1) ScreenBorderHit(); //if (Background.Target.Y < 700f && numberOfZoomOuts == 2) ScreenBorderHit(); // test position on screen - if pixie beneath lower border much, lose if (SimTime >= SCROLLING_START_TIME && !hasLost && (pixie.Motion.PositionAbsZoomedPixels.Y > Screen.HeightPixels + 100f)) { hasLost = true; } if (hasLost) { Music.Fade(-0.1f * p.Dt); this.Background.DrawInfo.DrawColor = Color.White * Music.Volume; if (Music.Volume == 0) { PixieGame.Instance.Exit(); } } }
protected override void InitBadPixels() { base.InitBadPixels(); BadPixel bp = BadPixel.Create(); // CreateCloaky(); bp.PositionAndTarget = PIXIE_STARTING_POS + new Vector2(5f, -6f); //bp.TargetSpeed = 18.0f; // TODO Add(bp); bp = BadPixel.Create(); bp.PositionAndTarget = PIXIE_STARTING_POS + new Vector2(0f, -3f); Add(bp); }