public bool Update_MenuSparkle() { timer += Constants.kFrameRate; mapPosition.x += velocity.x; mapPosition.y += velocity.y; rotation += 0.05f; if (rotation >= (Constants.PI_ * 2)) { rotation -= (Constants.PI_ * 2); } scale = 0 + (Utilities.GetCosInterpolationP1P2(timer + 0.65f, 0, 3) * 0.7f); alpha = 0.7f - (Utilities.GetCosInterpolationP1P2(timer + 0.3f, 0, 2.65f) * 0.7f); screenPosition = mapPosition; if (!(Globals.g_world.game).IsOnScreen(screenPosition)) { return(true); } if (alpha <= 0.01f) { return(true); } return(false); }
public void UpdateGreenAntScreen() { Particle.ParticleInfo info = new Particle.ParticleInfo(); info.startPosition = Utilities.CGPointMake(160, 140); info.velocity = Utilities.CGPointMake(0, 1); timer += Constants.kFrameRate; const float kSpinTime = 2.0f; if (timer >= kSpinTime) { timer -= kSpinTime; } float radians = Utilities.GetRatioP1P2(timer, 0, kSpinTime) * Constants.TWO_PI * 4.0f; float wx = 3.0f; info.velocity = Utilities.CGPointMake((float)(Math.Cos(radians) * wx), (float)(Math.Sin(radians) * wx)); const float kSideSideTime = 10.0f; timer2 += Constants.kFrameRate; if (timer2 >= kSideSideTime) { timer2 = 0.0f; } info.startPosition.x = 50.0f + (220.0f * Utilities.GetCosInterpolationP1P2(timer2, 0, kSideSideTime)); for (int i = 0; i < 2; i++) { Particle particle; bool isAdditive = false; if (Utilities.GetRand(9) == 0) { particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AdditiveInFrontOfPlayer, "rainbowstars"); isAdditive = true; } else { particle = (ParticleSystemRoss.Instance()).GetNextFreeParticleP1(ParticleList.t_AfterEverything, "rainbowstars"); } if (particle != null) { if (i == 1) { info.startPosition.x = 320.0f - info.startPosition.x; info.velocity.x = -info.velocity.x; } particle.Launch_GreenAntScreen(info); particle.SetIsAdditive(isAdditive); } } if (timer >= 2) { } timer += 0.02f; }
public void SetYUndulation(float raceTime) { int framesSinceStart = (int)((raceTime - myFlock.headStartTime) / Constants.kFrameRate); int undulationPosition = (undulationStartFrame + framesSinceStart) % framesForUndulationCycle; yUndulationTimer = (float)undulationPosition * Constants.kFrameRate; yUndulation = undulationDistance * Utilities.GetCosInterpolationP1P2(yUndulationTimer, 0.0f, yUndulationTime); }
bool UpdateWaterSparkle() { animTimer += Constants.kFrameRate; mapPosition.x += 0.3f; screenPosition = (Globals.g_world.game).GetScreenPosition(mapPosition); alpha = alphaStart * Utilities.GetCosInterpolationP1P2(animTimer, 0.0f, alphaSpeed); return(animTimer >= alphaSpeed); }
public void UpdateYUndulation() { yUndulationTimer += Constants.kFrameRate; if (yUndulationTimer >= yUndulationTime) { yUndulationTimer -= yUndulationTime; } yUndulation = 40.0f * Utilities.GetCosInterpolationP1P2(yUndulationTimer, 0.0f, yUndulationTime); }
bool UpdatePondBlob() { const float kMaxAlpha = 0.35f; const float kBlobTime = 3.0f; animTimer += Constants.kFrameRate; screenPosition = (Globals.g_world.game).GetScreenPosition(mapPosition); alpha = kMaxAlpha * Utilities.GetCosInterpolationP1P2(animTimer, 0.0f, kBlobTime); scale += 0.0075f; return(animTimer >= kBlobTime); }
public void UpdateShadow(CGPoint realPosition) { const float kJogDistance = 5.0f; float animPosition = (((float)animateIndex) * 20.0f) + animateRoll; float shadowDistance; if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Elephant) { shadowDistance = Utilities.GetCosInterpolationP1P2(animPosition, 0.0f, 80.0f); shadowMapObject.SetPosition(Utilities.CGPointMake(realPosition.x + shadowOffset.x + (kJogDistance * shadowDistance), realPosition.y + shadowOffset.y + ( kJogDistance * 0.7f * shadowDistance))); } }
bool Update_RainbowStarTrail() { timer += Constants.kFrameRate; mapPosition.x += velocity.x; mapPosition.y += velocity.y; alpha -= 0.04f; velocity.x *= 0.85f; velocity.y *= 0.85f; const int kNumFrames = 6; animTimer += Constants.kFrameRate; if (animTimer >= 0.05f) { currentAnim++; if (currentAnim == kNumFrames) { currentAnim = 0; } texture = animFrame[currentAnim]; animTimer = 0; } scale = 2.0f * (0.0f + (Utilities.GetCosInterpolationP1P2(timer + 0.3f, 0.0f, 0.85f) * 1.2f)); if (isAdditive) { scale *= 1.35f; } screenPosition = (Globals.g_world.game).GetScreenPosition(mapPosition); if (!(Globals.g_world.game).IsOnScreen(screenPosition)) { return(true); } if ((scale <= 0.1f) || (alpha < 0.1f)) { return(true); } return(false); }
public float UpdateRotation() { if (wobbleSize > 0.0f) { currentWobble += Constants.kFrameRate; wobbleSize -= wobbleDecline; if (currentWobble >= wobbleTime) { currentWobble -= wobbleTime; } } else { wobbleSize = 0.0f; } currentRotation = -0.5f + Utilities.GetCosInterpolationP1P2(currentWobble, 0.0f, wobbleTime); currentRotation *= wobbleSize; currentRotation += baseAngleOffset; this.UpdateOffset(currentRotation); return(currentRotation); }
public void UpdateBumping() { if (bumpTimer > 0.0f) { if (bumpTimer > (kCTBumpTime * 0.5f)) { bumpTimer -= Constants.kFrameRate; } else { bumpTimer -= (Constants.kFrameRate / 3.0f); } if (bumpTimer <= 0.0f) { bumpOffset = Utilities.CGPointMake(0.0f, 0.0f); return; } float bumpDistance = bumpMaxDistance * Utilities.GetCosInterpolationP1P2(bumpTimer, 0.0f, kCTBumpTime); bumpOffset = Utilities.CGPointMake(bumpDistance * bumpDirection.x, bumpDistance * bumpDirection.y); } }