//TBorderLayer border; public THeartToken(bool isBroken) { this.isBroken = isBroken; if (isBroken) { sprite = new FSprite("brokenHeart.psd"); } else { sprite = new FSprite("heart.psd"); } sprite.scale = 0.6f; sprite.color = new Color(1.0f, Random.Range(0.3f, 0.6f), Random.Range(0.3f, 0.6f), 1.0f); sprite.rotation = -10f; float duration = Random.Range(0.15f, 0.45f); Tween rotOut = new Tween(sprite, duration, new TweenConfig().floatProp("rotation", 10f)); Tween rotIn = new Tween(sprite, duration, new TweenConfig().floatProp("rotation", -10f)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(rotOut).append(rotIn); Go.addTween(chain); chain.play(); }
// sets up the tweens so the flashingColor will actually flash bright/dark private void InitFlashingColorForCompletedLines() { Tween colorDown = new Tween(this, 0.2f, new TweenConfig().floatProp("flashingColorPercentage", 0.5f)); Tween colorUp = new Tween(this, 0.2f, new TweenConfig().floatProp("flashingColorPercentage", 1.0f)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(colorDown).append(colorUp); Go.addTween(chain); chain.play(); }
//TBorderLayer border; public TWalkingCharacter(string headImage) { FAtlasManager am = Futile.atlasManager; frameElements = new FAtlasElement[8]; crouchFrameElements = new FAtlasElement[8]; frameElements[0] = am.GetElementWithName("walkAnim/walk0.png"); frameElements[1] = am.GetElementWithName("walkAnim/walk1.png"); frameElements[2] = am.GetElementWithName("walkAnim/walk2.png"); frameElements[3] = am.GetElementWithName("walkAnim/walk3.png"); frameElements[4] = am.GetElementWithName("walkAnim/walk4.png"); frameElements[5] = am.GetElementWithName("walkAnim/walk1.png"); frameElements[6] = am.GetElementWithName("walkAnim/walk2.png"); frameElements[7] = am.GetElementWithName("walkAnim/walk3.png"); crouchFrameElements[0] = am.GetElementWithName("squashedWalkAnim/squashedWalk0.png"); crouchFrameElements[1] = am.GetElementWithName("squashedWalkAnim/squashedWalk1.png"); crouchFrameElements[2] = am.GetElementWithName("squashedWalkAnim/squashedWalk2.png"); crouchFrameElements[3] = am.GetElementWithName("squashedWalkAnim/squashedWalk3.png"); crouchFrameElements[4] = am.GetElementWithName("squashedWalkAnim/squashedWalk4.png"); crouchFrameElements[5] = am.GetElementWithName("squashedWalkAnim/squashedWalk1.png"); crouchFrameElements[6] = am.GetElementWithName("squashedWalkAnim/squashedWalk2.png"); crouchFrameElements[7] = am.GetElementWithName("squashedWalkAnim/squashedWalk3.png"); bodySprite = new FSprite("walkAnim/walk0.png"); bodySprite.scale = 0.5f; bodySprite.anchorY = 0; bodySprite.y = -200f; AddChild(bodySprite); headSprite = new FSprite(headImage); headSprite.y = 25f; headSprite.x -= 5f; headSprite.scale = 0.5f; headSprite.anchorY = 0; headSprite.rotation = -3f; AddChild(headSprite); Tween rotateOut = new Tween(headSprite, 0.3f, new TweenConfig().floatProp("rotation", 3f)); Tween rotateIn = new Tween(headSprite, 0.3f, new TweenConfig().floatProp("rotation", -3f)); chain = new TweenChain(); chain.setIterations(-1); chain.append(rotateOut).append(rotateIn); Go.addTween(chain); }
public WTBlahGame() : base("") { nursesPass = new FSprite("nursesPass.psd"); nursesPass.x = Futile.screen.halfWidth; nursesPass.y = Futile.screen.halfHeight; nursesPass.scale = 0.5f; AddChild(nursesPass); Go.defaultEaseType = EaseType.SineInOut; Tween tweenUp = new Tween(nursesPass, 0.3f, new TweenConfig() .floatProp("scale", 0.6f)); Tween tweenDown = new Tween(nursesPass, 0.3f, new TweenConfig() .floatProp("scale", 0.5f)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tweenUp).append(tweenDown); Go.addTween(chain); chain.play(); }
public void OnWinLabelDoneAppearing(AbstractTween tween) { gameFullyOver = true; FLabel label = (tween as Tween).target as FLabel; Tween up = new Tween(label, 0.3f, new TweenConfig() .floatProp("scale", 1.1f) .setEaseType(EaseType.SineInOut)); Tween down = new Tween(label, 0.3f, new TweenConfig() .floatProp("scale", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain upDownChain = new TweenChain(); upDownChain.setIterations(-1); upDownChain.append(up); upDownChain.append(down); Go.addTween(upDownChain); upDownChain.play(); }
public void UpdateGoal() { if (totalDistance < goalDistance - 1000f || initiatedSceneSwitch) return; if (goalType == GoalType.GoalOne) { if (faceCoin == null) { faceCoin = new FSprite("danaHappy.png"); faceCoin.x = Futile.screen.width + 100f; faceCoin.y = 250f; everythingContainer.AddChild(faceCoin); everythingContainer.AddChild(whit); // move him to top Tween tween1 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } faceCoin.x += Time.fixedDeltaTime * universalVelocity; if (faceCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneOne); } } else if (goalType == GoalType.GoalTwo) { if (bigHeartCoin == null) { bigHeartCoin = new FSprite("heart.psd"); bigHeartCoin.scale = 2.0f; bigHeartCoin.x = Futile.screen.width + 100f; bigHeartCoin.color = new Color(1.0f, 0.2f, 0.2f, 1.0f); bigHeartCoin.y = 250f; everythingContainer.AddChild(bigHeartCoin); everythingContainer.AddChild(whit); // move to top Tween tween1 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } bigHeartCoin.x += Time.fixedDeltaTime * universalVelocity; if (bigHeartCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneTwo); } } else if (goalType == GoalType.GoalThree) { if (dana == null) { dana = new TWalkingCharacter("danaHead.png"); dana.x = Futile.screen.width + 100f; dana.y = 250f; everythingContainer.AddChild(dana); dana.StartWalking(); } dana.x += Time.fixedDeltaTime * universalVelocity * 0.25f; if (dana.x < 350f) { start.isVisible = goal.isVisible = false; FSoundManager.PlayMusic("yay"); foundEachother = true; dana.TurnAround(); dana.StopWalking(); whit.StopWalking(); parallaxScene.StopUpdating(); whit.StopCrouching(); StartHeartShower(); } } }
public void UpdateSolidifyingTrebellaLetters() { timeSinceLastSolidifiedLetter += Time.deltaTime; if (timeSinceLastSolidifiedLetter > 0.5f) { timeSinceLastSolidifiedLetter -= 0.5f; FLabel nextLetterToChange = null; switch (numLettersSolidified) { case 0: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "T") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 1: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "R") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 2: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "E") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 3: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "B") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 4: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "E") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 5: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "L") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 6: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "L") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 7: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "A") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; } FSoundManager.PlaySound("bomb", 2.0f); FLabel solidifiedLetter = trebellaLetters[numLettersSolidified]; solidifiedLetter.x = nextLetterToChange.x; solidifiedLetter.y = nextLetterToChange.y; nextLetterToChange.RemoveFromContainer(); float duration = 0.2f; float distance = 5f; Tween bounce = new Tween(solidifiedLetter, duration, new TweenConfig() .setEaseType(EaseType.SineInOut) .floatProp("y", distance, true)); Tween bounceBack = new Tween(solidifiedLetter, duration, new TweenConfig() .setEaseType(EaseType.SineInOut) .floatProp("y", -distance, true)); TweenChain chain = new TweenChain(); chain.setIterations(-1, LoopType.RestartFromBeginning); chain.append(bounce); chain.append(bounceBack); Go.addTween(chain); chain.play(); numLettersSolidified++; if (numLettersSolidified >= 8) trebellaLettersDoneSolidifying = true; } }
public void UpdateGoal() { if (totalDistance < goalDistance - 1000f || initiatedSceneSwitch) { return; } if (goalType == GoalType.GoalOne) { if (faceCoin == null) { faceCoin = new FSprite("danaHappy.png"); faceCoin.x = Futile.screen.width + 100f; faceCoin.y = 250f; everythingContainer.AddChild(faceCoin); everythingContainer.AddChild(whit); // move him to top Tween tween1 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(faceCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } faceCoin.x += Time.fixedDeltaTime * universalVelocity; if (faceCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneOne); } } else if (goalType == GoalType.GoalTwo) { if (bigHeartCoin == null) { bigHeartCoin = new FSprite("heart.psd"); bigHeartCoin.scale = 2.0f; bigHeartCoin.x = Futile.screen.width + 100f; bigHeartCoin.color = new Color(1.0f, 0.2f, 0.2f, 1.0f); bigHeartCoin.y = 250f; everythingContainer.AddChild(bigHeartCoin); everythingContainer.AddChild(whit); // move to top Tween tween1 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", -1.0f) .setEaseType(EaseType.SineInOut)); Tween tween2 = new Tween(bigHeartCoin, 0.5f, new TweenConfig() .floatProp("scaleX", 1.0f) .setEaseType(EaseType.SineInOut)); TweenChain chain = new TweenChain(); chain.setIterations(-1); chain.append(tween1); chain.append(tween2); Go.addTween(chain); chain.play(); } bigHeartCoin.x += Time.fixedDeltaTime * universalVelocity; if (bigHeartCoin.x < 100f) { initiatedSceneSwitch = true; FSoundManager.StopMusic(); FSoundManager.PlaySound("success"); TMain.SwitchToScene(TMain.SceneType.DreamSceneTwo); } } else if (goalType == GoalType.GoalThree) { if (dana == null) { dana = new TWalkingCharacter("danaHead.png"); dana.x = Futile.screen.width + 100f; dana.y = 250f; everythingContainer.AddChild(dana); dana.StartWalking(); } dana.x += Time.fixedDeltaTime * universalVelocity * 0.25f; if (dana.x < 350f) { start.isVisible = goal.isVisible = false; FSoundManager.PlayMusic("yay"); foundEachother = true; dana.TurnAround(); dana.StopWalking(); whit.StopWalking(); parallaxScene.StopUpdating(); whit.StopCrouching(); StartHeartShower(); } } }
public void UpdateSolidifyingTrebellaLetters() { timeSinceLastSolidifiedLetter += Time.deltaTime; if (timeSinceLastSolidifiedLetter > 0.5f) { timeSinceLastSolidifiedLetter -= 0.5f; FLabel nextLetterToChange = null; switch (numLettersSolidified) { case 0: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "T") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 1: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "R") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 2: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "E") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 3: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "B") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 4: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "E") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 5: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "L") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 6: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "L") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; case 7: foreach (FLabel letter in unsolidifiedTrebellaLetters) { if (letter.text == "A") { nextLetterToChange = letter; unsolidifiedTrebellaLetters.Remove(letter); break; } } break; } FSoundManager.PlaySound("bomb", 2.0f); FLabel solidifiedLetter = trebellaLetters[numLettersSolidified]; solidifiedLetter.x = nextLetterToChange.x; solidifiedLetter.y = nextLetterToChange.y; nextLetterToChange.RemoveFromContainer(); float duration = 0.2f; float distance = 5f; Tween bounce = new Tween(solidifiedLetter, duration, new TweenConfig() .setEaseType(EaseType.SineInOut) .floatProp("y", distance, true)); Tween bounceBack = new Tween(solidifiedLetter, duration, new TweenConfig() .setEaseType(EaseType.SineInOut) .floatProp("y", -distance, true)); TweenChain chain = new TweenChain(); chain.setIterations(-1, LoopType.RestartFromBeginning); chain.append(bounce); chain.append(bounceBack); Go.addTween(chain); chain.play(); numLettersSolidified++; if (numLettersSolidified >= 8) { trebellaLettersDoneSolidifying = true; } } }