private void bounceFruit(HitCircleFruits f, bool highPower) { Vector2 v = new Vector2(f.CatchOffset.X * 4, highPower ? -400 : -120); foreach (pSprite p in f.SpriteCollection) { p.AlwaysDraw = false; p.FadeOut(2000); GameBase.PhysicsManager.Add(p, v); } }
/// <summary> /// Checks the distance to next fruit. If it is too far to reach, we give a temporary speed bonus. /// </summary> private void checkDistanceToNextFruit(HitCircleFruits currentObject) { if (currentObject.HyperDash) { HitObject nextObject = currentObject.HyperDashTarget; float distanceToNext = Math.Abs(nextObject.Position.X - catcher1.Position.X); // Don't apply 60fps frame buffer if hyperdash lasts less than a frame (catcher will fly backwards) float timeToNext = Math.Max(1f, nextObject.StartTime - AudioEngine.Time - (float)(GameBase.SIXTY_FRAME_TIME)); //time for some ZOOOOOOOM GlowCatcherRed(); specialMovementModifier = distanceToNext / (float)timeToNext; specialMovementDirection = nextObject.Position.X > catcher1.Position.X ? 1 : -1; specialMovementNextFruit = currentObject.HyperDashTarget; } }
internal override void UpdateScoring() { if (Player.Failed) { return; } foreach (HitObject h in hitObjectManager.hitObjectsMinimal) { HitCircleFruits hf = h as HitCircleFruits; if (hf == null) { continue; //should never happen, though. } if (AudioEngine.Time >= hf.StartTime && !hf.IsHit) { if (catcher1.Position.X - catcherWidthHalf + catchMargin < hf.Position.X && catcher1.Position.X + catcherWidthHalf - catchMargin > hf.Position.X) { Player.Instance.LogHitError(hf, (int)(catcher1.Position.X - hf.Position.X)); hf.ValidHit = true; } else { hf.ValidHit = false; } hitObjectManager.Hit(hf); if (hf.ValidHit) { catcher1.TextureArray = hf is HitCircleFruitsSpin || AudioEngine.KiaiEnabled ? catcherKiai : catcherIdle; comboCounterFruits.FlashColour(hf.Colour); //Place the valid fruit on the plate. foreach (pSprite p in hf.SpriteCollection) { p.Transformations.RemoveAll(t => t.Type == TransformationType.Movement || t.Type == TransformationType.Scale); p.Scale *= 0.5f; } hf.CatchOffset.X = hf.Position.X - catcher1.Position.X; hf.CatchOffset.Y = -5; //If there is another fruit, stack it! while (null != caughtFruits.Find(f => Vector2.DistanceSquared(f.CatchOffset, hf.CatchOffset) < 10 * 10)) { hf.CatchOffset.X += RNG.Next(-5, 5); hf.CatchOffset.Y -= RNG.Next(0, 5); } if (hf is HitCircleFruitsTick) { Explode(hf); bounceFruit(hf, false); } else if (hf is HitCircleFruitsTickTiny) { bounceFruit(hf, false); } else { Explode(hf); caughtFruits.Add(hf); foreach (pSprite p in hf.SpriteCollection) { p.AlwaysDraw = true; } } ThrowFruit(true); } else { if (!(hf is HitCircleFruitsSpin)) { catcher1.TextureArray = catcherFail; } //Oops we missed, lets look sad. foreach (pSprite p in hf.SpriteCollection) { p.Transformations.Add(new Transformation(TransformationType.Rotation, 0, 2, AudioEngine.Time, AudioEngine.Time + 500)); } ThrowFruit(false); } } } base.UpdateScoring(); }