override public void update() { base.update(); if (instruction.visible) { if (tween.hasEnded) { FlxG.play("Lemonade/sfx/cw_sound09", 0.75f, false); } } tween.Update(FlxG.elapsedAsGameTime); instruction.y = tween.Position; if (((follower.y > int.MaxValue && follower.x == 0) || (FlxG.keys.justPressed(Keys.X) && follower.y > 100) || (FlxG.gamepads.isNewButtonPress(Buttons.A) && follower.y > 100) || (FlxControl.ACTIONJUSTPRESSED && follower.y > 100)) && (FlxG.transition.members[0] as FlxSprite).scale < 0.001f) { FlxG.transition.startFadeOut(0.15f, -90, 150); follower.x = 1; } if (FlxG.transition.complete) { #if __ANDROID__ FlxG.state = new IntroState(); #endif #if !__ANDROID__ FlxG.state = new IntroState(); #endif return; } }
override public void update() { if (FlxControl.ACTIONJUSTPRESSED || FlxG.mouse.pressed()) { if (elapsedInState > 0.15f) { FlxG.play("putt/sfx/blip"); toStart = true; elapsedInState = 0; } } if (toStart) { text.color = FlxColor.randomColor(); if (elapsedInState > 0.25f) { FlxG.stopMp3(); Globals.canSkip = false; Globals.hole = 1; FlxG.state = new MenuState(); } } base.update(); }
override public void overlapped(FlxObject obj) { base.overlapped(obj); string overlappedWith = obj.GetType().ToString(); if ((overlappedWith == "Lemonade.Army" || overlappedWith == "Lemonade.Inspector" || overlappedWith == "Lemonade.Chef" || overlappedWith == "Lemonade.Worker") && !flickering()) { if (obj.dead == false && control == Controls.player) { //if (dead == false) FlxG.play("Lemonade/sfx/deathSFX", 0.8f, false); //flicker(2); //kill(); } } else if (overlappedWith == "Lemonade.Liselot") { if (piggyBacking == false && dead == false && flickering() == false) { FlxG.play("Lemonade/sfx/cw_sound34", 0.8f, false); control = Controls.player; piggyBacking = true; ((Liselot)(obj)).piggyBacking = true; ((Liselot)(obj)).parent = this; ((Liselot)(obj)).control = Controls.none; } } else if (overlappedWith == "Lemonade.FilingCabinet") { originalPosition.X = obj.x + 30; originalPosition.Y = obj.y; } else if (overlappedWith == "Lemonade.LargeCrate") { //Console.WriteLine("crate overlapp"); ((LargeCrate)(obj)).canExplode = true; //if (dashTimer > dashMaxLimit) //{ // obj.kill(); // obj.x = -1000; // obj.y = -1000; //} } //else if (overlappedWith == "Lemonade.Spike") //{ // //Console.WriteLine("Spike overlapp"); // hurt(1); //} }
public void everyAction() { activator.visible = false; //Bring this back. if (!Globals.playThroughAutomatically) { FlxG.play("putt/sfx/blip"); } actionButton.scale = 1.5f; }
public override void overlapped(FlxObject obj) { base.overlapped(obj); if (obj.GetType().ToString() == "Lemonade.Liselot" || obj.GetType().ToString() == "Lemonade.Andre") { if (canClose > 4) { FlxG.play("Lemonade/sfx/cw_sound03", 0.8f, false); play("closed", true); canClose = 0; } } }
protected bool ballInHole(object Sender, FlxSpriteCollisionEvent e) { Console.WriteLine("Ball speed at time of sinking x {0} y {1} -- ball x/y {2} {3} hole x/y {4} {5} ", ball.velocity.X, ball.velocity.Y, ball.x, ball.y, hole.x, hole.y); if (ball.rise == true) { return(false); } else if (ball.velocity.Y < -35) { // Voice -- "A little too much juice on that one. Next time try a softer approach. // too fast to sink playSound("alittletoomuchjuice"); FlxG.play("putt/sfx/ballinhole"); if (ball.x > hole.x - 1) { ball.velocity.X = 56; } else if (ball.x < hole.x - 3) { ball.velocity.X = -56; } } else { //went in the hole. if (ball.visible) { FlxG.play("putt/sfx/GolfBallInHole"); Globals.ballInHole = true; if (FlxG.debug) { FlxU.saveToDevice(string.Format("Hole Aim (x) Power Force: ,{0},{1},{2},{3},{4}", Globals.hole, aim.x, aim.health, selectedClub, selectedForce), "hole" + Globals.hole + ".txt"); } } state = GameState.BallEnded; ball.visible = false; resetSelections(); } return(true); }
public override void overlapped(FlxObject obj) { base.overlapped(obj); if (obj.GetType().ToString() == "Lemonade.Trampoline" && !dead) { velocity.Y = -1000; trampolineTimer = 0.0f; } //else if (obj.GetType().ToString() == "Lemonade.Ramp") //{ // float delta = x % 20; // //FlxU.solveXCollision(obj, null); //} else if (obj.GetType().ToString() == "Lemonade.Coin") { obj.kill(); Lemonade_Globals.coins++; Lemonade_Globals.coinsThisLevel++; FlxG.play("Lemonade/sfx/cw_sound39"); //FlxG.flash.start(Color.White); FlxG.quake.start(0.008f, 0.155f); } else if (obj.GetType().ToString() == "Lemonade.Spike") { //Console.WriteLine("Spike overlapp"); if (dead == false && onScreen()) { FlxG.play("Lemonade/sfx/cw_sound44", 0.8f, false); } hurt(1); } }
/// <summary> /// The main update function. /// </summary> override public void update() { if (FlxG.debug && FlxG.keys.justPressed(Keys.D2)) { Globals.canSkip = true; } if (FlxG.debug && FlxG.keys.justPressed(Keys.D4)) { Globals.hole = 19; for (int i = 0; i < 18; i++) { Globals.scoreCard.Add(0); } } if (FlxG.keys.justPressed(Keys.B)) { FlxG.showBounds = !FlxG.showBounds; } lee.soundState = sound.getState(); //------------------------------------------------------------------ //Console.WriteLine(sound.getName()); if (state == GameState.Introduction) { } if (Globals.ACTIONJUSTPRESSED) { activator.visible = false; } if (sound.getState() == SoundState.Stopped || Globals.hole > 1 || Globals.canSkip) { if (Globals.ACTIONJUSTPRESSED) { everyAction(); } if (FlxControl.LEFTJUSTPRESSED) { FlxG.play("putt/sfx/blip"); selected--; if (selected < 0) { selected = 0; } } if (FlxControl.RIGHTJUSTPRESSED || (FlxG.mouse.justPressed() && FlxG.mouse.x < (FlxG.width / 4) * 3)) { FlxG.play("putt/sfx/blip"); selected++; } framesElapsed++; if (state == GameState.Introduction) { chooseIntroduction(); } else if (state == GameState.ChooseClub) { chooseClub(); } else if (state == GameState.ChooseForce) { chooseForce(); } else if (state == GameState.Swing) { chooseSwing(); } else if (state == GameState.Power) { choosePower(); } else if (state == GameState.BallInPlay) { ballInPlay(); } else if (state == GameState.BallEnded) { ballEnded(); } else if (state == GameState.PlayAgain) { choosePlayAgain(); } else if (state == GameState.Reset) { chooseReset(); } } else { } //Console.WriteLine(rollTiles.getTile((int)(ball.x / 8),(int)(ball.y / 8)).ToString() ); int tile = rollTiles.getTile((int)(ball.x / 8), (int)(ball.y / 8)); if (tile != -1) { ball.adjustSpeedForTile(tile); } base.update(); }
override public void update() { coinCounter.text = Lemonade_Globals.coins.ToString(); tween.Update(FlxG.elapsedAsGameTime); coin.update(); coinCounter.update(); toastySprite.update(); coin.y = tween.Position; //coinCounter.y = tween.Position; int count = 1; foreach (FlxSprite item in powerBar.members) { if (count > Lemonade_Globals.totalTimeAvailable) { item.visible = false; } if (count > time) { if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1 && count < 4) { FlxG.play("Lemonade/sfx/cw_sound09"); } else if (item.color == Lemonade_Globals.GAMEBOY_COLOR_1) { //Console.WriteLine("Coins per minute {0}", coinsPerMinute); if (coinsPerMinute > 2.5f) { toastySprite.velocity.Y = -200; Lemonade_Globals.coinsThisLevel = 0; FlxG.play("Lemonade/sfx/cw_sound12", 0.25f, false); FlxG.play("Lemonade/sfx/cw_sound15", 0.44f, false); FlxG.quake.start(0.005f, 0.5f); } } item.color = Lemonade_Globals.GAMEBOY_COLOR_4; } else { item.color = Lemonade_Globals.GAMEBOY_COLOR_1; } item.update(); count++; } if (time <= 0.5f) { if (FlxU.random() < 0.1f) { FlxG.play("Lemonade/sfx/cw_sound09"); } } if (toastySprite.y < FlxG.height - 180) { toastySprite.velocity.Y *= -1; } base.update(); if (canStart) { int mult = 1; if (FlxG.keys.F5) { mult = 10; } time -= FlxG.elapsed * mult; totalTime += FlxG.elapsed; } coinsPerMinute = Lemonade_Globals.coinsThisLevel / totalTime; }
override public void update() { if (FlxG.keys.justPressed(Keys.Q)) { FlxG.bloom.Visible = !FlxG.bloom.Visible; FlxG.bloom.usePresets = true; follower.velocity.Y += 1450; } if (FlxG.keys.ONE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[1]; } if (FlxG.keys.TWO) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[2]; } if (FlxG.keys.THREE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[3]; } if (FlxG.keys.FOUR) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[4]; } if (FlxG.keys.FIVE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[5]; } if (FlxG.keys.SIX) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[6]; } if (FlxG.keys.SEVEN) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[7]; } foreach (FlxSprite item in rain.members) { if (item.y > 2000) { splashes.at(item); splashes.start(true, 0.0f, 10); item.y = 1200; } } base.update(); if (instruction.visible) { if (tween.hasEnded) { FlxG.play("Lemonade/sfx/cw_sound09", 0.75f, false); } } tween.Update(FlxG.elapsedAsGameTime); instruction.y = tween.Position; if (follower.y > 2100) { credits.visible = true; } if (follower.y > 2300) { instruction.visible = true; } if (((follower.y > int.MaxValue && follower.x == 0) || (FlxG.keys.justPressed(Keys.X) && follower.y > 100) || (FlxG.gamepads.isNewButtonPress(Buttons.A) && follower.y > 100) || (FlxControl.ACTIONJUSTPRESSED && follower.y > 100)) && (FlxG.transition.members[0] as FlxSprite).scale < 0.001f) { if (Lemonade_Globals.coins == Lemonade_Globals.totalCoins) { #if !__ANDROID__ FlxU.openURL("http://initials.itch.io/slf2/download/Y9wdBOHe7a92Qpo9t5UJdz05HhZR5p10F0L6wfdP"); #endif } follower.velocity.X = -250; } if (follower.x < 0) { FlxG.transition.startFadeOut(0.15f, -90, 150); follower.x = 1; follower.velocity.X = 1; } if (FlxG.transition.complete) { FlxG.state = new IntroState(); FlxG.transition.resetAndStop(); return; } }
override public void update() { if (FlxG.keys.justPressed(Keys.Q)) { FlxG.bloom.Visible = !FlxG.bloom.Visible; FlxG.bloom.usePresets = true; follower.velocity.Y += 1450; } if (FlxG.keys.ONE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[1]; } if (FlxG.keys.TWO) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[2]; } if (FlxG.keys.THREE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[3]; } if (FlxG.keys.FOUR) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[4]; } if (FlxG.keys.FIVE) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[5]; } if (FlxG.keys.SIX) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[6]; } if (FlxG.keys.SEVEN) { FlxG.bloom.Settings = BloomPostprocess.BloomSettings.PresetSettings[7]; } foreach (FlxSprite item in rain.members) { int rainOffset = 0; #if __ANDROID__ rainOffset = 50; #endif if (item.y > 2000 - rainOffset) { splashes.at(item); splashes.start(true, 0.0f, 10); item.y = 1200; } } base.update(); if (instruction.visible) { if (tween.hasEnded) { FlxG.play("Lemonade/sfx/cw_sound09", 0.75f, false); } } tween.Update(FlxG.elapsedAsGameTime); instruction.y = tween.Position; if (follower.y > 2100) { credits.visible = true; } if (follower.y > 2300) { credits.text = "Pixel Art by\nMiguelito"; } if (follower.y > 2500) { credits.text = "Dithering Expert\nAndrio"; } if (follower.y > 2700) { credits.text = "Super"; } if (follower.y > 2900) { credits.text = "Lemonade"; } if (follower.y > 3000) { credits.text = "Factory"; } if (follower.y > 3100) { credits.scale = 5; credits.text = "1989"; } if (follower.y > 3200) { credits.scale = 2; #if __ANDROID__ credits.scale = 4; #endif credits.text = "Super Lemonade\nFactory 1989"; } if (follower.y > 3300) { instruction.visible = true; } if (((follower.y > int.MaxValue && follower.x == 0) || (FlxG.keys.justPressed(Keys.X) && follower.y > 100) || (FlxG.gamepads.isNewButtonPress(Buttons.A) && follower.y > 100) || (FlxControl.ACTIONJUSTPRESSED && follower.y > 100)) && (FlxG.transition.members[0] as FlxSprite).scale < 0.001f) { FlxG.transition.startFadeOut(0.15f, -90, 150); follower.x = 1; } if (FlxG.transition.complete) { FlxG.level = 1; Lemonade_Globals.stateSaver = new Dictionary <string, Dictionary <string, Vector2> > { { "newyork", new Dictionary <string, Vector2>() }, { "sydney", new Dictionary <string, Vector2>() }, { "military", new Dictionary <string, Vector2>() }, { "warehouse", new Dictionary <string, Vector2>() }, { "factory", new Dictionary <string, Vector2>() }, { "management", new Dictionary <string, Vector2>() }, }; foreach (var item in Lemonade_Globals.stateSaver) { Lemonade_Globals.thisTurnProgress[item.Key] = 0; } Lemonade_Globals.levelChanges = 0; Lemonade_Globals.coins = 0; Lemonade_Globals.timeLeft = Lemonade_Globals.totalTimeAvailable = 30.1f; FlxG.state = new LevelChooserState(); return; } }
override public void update() { timer -= FlxG.elapsed; block.frameNumber = (int)FlxG.elapsedTotal; block.loadTiles(FlxG.Content.Load <Texture2D>("Lemonade/fade"), 20, 20, 0); if (FlxControl.LEFTJUSTPRESSED) { FlxG.play("Lemonade/sfx/cw_sound01"); selected--; tweeners[selected + 1].Reset(); tweeners[selected + 1].Pause(); if (selected < 0) { selected = 5; } tweeners[selected].Play(); } if (FlxControl.RIGHTJUSTPRESSED) { FlxG.play("Lemonade/sfx/cw_sound01"); selected++; tweeners[selected - 1].Reset(); tweeners[selected - 1].Pause(); if (selected >= 6) { selected = 0; } tweeners[selected].Play(); } int count = 0; foreach (FlxSprite item in icons.members) { item.x = tweeners[count].Position.X; item.y = tweeners[count].Position.Y; item.scale = tweeners[count].Position.Z; tweeners[count].Update(FlxG.elapsedAsGameTime); count++; } switch (selected) { case 0: Lemonade_Globals.location = "warehouse"; break; case 1: Lemonade_Globals.location = "military"; break; case 2: Lemonade_Globals.location = "newyork"; break; case 3: Lemonade_Globals.location = "sydney"; break; case 4: Lemonade_Globals.location = "management"; break; case 5: Lemonade_Globals.location = "factory"; break; default: break; } t1.text = Lemonade_Globals.niceLocationNames[Lemonade_Globals.location].ToString(); if (Lemonade_Globals.thisTurnProgress[Lemonade_Globals.location] == 1) { t1.text += " Complete!"; } //t2.text = String.Format("{0:#,###.#}", timer); if (FlxControl.ACTIONJUSTPRESSED && FlxG.elapsedTotal > 0.4f) { if (Lemonade_Globals.thisTurnProgress[Lemonade_Globals.location] == 1) { //t1.text += " Complete!"; } else { Lemonade_Globals.restartMusic = true; FlxG.state = new PlayState(); return; } } base.update(); }
override public void update() { if (Globals.hole < 3) { speed = 1; } else if (Globals.hole < 12) { speed = 2; } else if (Globals.hole < 19) { speed = 3; } if (Globals.hole < 6) { hspeed = 1; } else if (Globals.hole < 14) { hspeed = 1.5f; } else if (Globals.hole < 19) { hspeed = 2; } if (startAim) { visible = true; if (direction) { x += speed; } else { x -= speed; } if (x < 0) { FlxG.play("putt/sfx/select"); x = 1; direction = !direction; } if (x > FlxG.width) { FlxG.play("putt/sfx/select"); x = FlxG.width - 2; direction = !direction; } } else { visible = false; } if (startHealth) { if (hdirection) { health += hspeed; } else { health -= hspeed; } if (health < 0) { FlxG.play("putt/sfx/select"); health = 1; hdirection = !hdirection; } if (health > 50) { FlxG.play("putt/sfx/select"); health = 50 - 1; hdirection = !hdirection; } } List <Vector2> l = new List <Vector2>(); if (this.x + (width / 2) < ballPosition.X) { //Console.WriteLine("Less Than"); l = ExtendPoints(new Vector2(this.x + (width / 2), this.y + (height / 2)), ballPosition, 10); } else { //Console.WriteLine("More Than"); l = ExtendPoints2(new Vector2(this.x + (width / 2), this.y + (height / 2)), new Vector2(ballPosition.X, ballPosition.Y), 10); } int i = 0; //Console.WriteLine("This item {0}, X {1} Y {2} L Count = {3}, ", i, this.x, this.y, l.Count); //foreach (var item in l) //{ // points.members[i].x = item.X; // points.members[i].y = item.Y; // i++; //} Vector2 mp = getMidpoint(ballPosition); ((FlxSprite)(points.members[0])).x = mp.X; ((FlxSprite)(points.members[0])).y = mp.Y; Vector2 mp2 = getMidpoint(mp); ((FlxSprite)(points.members[1])).x = mp2.X; ((FlxSprite)(points.members[1])).y = mp2.Y; // Get midpoint between ball and mp Vector2 mp3 = FlxU.getMidpoint(mp, ballPosition); ((FlxSprite)(points.members[2])).x = mp3.X; ((FlxSprite)(points.members[2])).y = mp3.Y; foreach (var item in points.members) { item.update(); } base.update(); }
override public void update() { #region cheats if (FlxG.debug == true && elapsedInState > 0.2f) { } #endregion #region pirateVersion if (Lemonade_Globals.PAID_VERSION == Lemonade_Globals.PIRATE_MODE) { if (elapsedInState > 3.0 && FlxG.level > 2) { foreach (var item in actors.members) { ((FlxPlatformActor)(item)).maxVelocity.X += 2.5f; } foreach (var mov in movingPlatforms.members) { mov.pathSpeed += 0.25f; } } } #endregion //FlxG.color(Color.MediumPurple); //FlxU.collideRamp(actors, ramps); //if (FlxG.keys.justPressed(Keys.F11)) if (FlxG.gamepads.isButtonDown(Buttons.LeftTrigger) && FlxG.debug) { if (coins.getFirstAlive() != null) { ((FlxSprite)(actors.members[0])).at(coins.getFirstAlive()); } } currentCharHud.canStart = !levelIntro.block.visible; if (currentCharHud.canStart) { ((FlxPlatformActor)(actors.members[0])).control = FlxPlatformActor.Controls.player; } else if (!currentCharHud.canStart) { ((FlxPlatformActor)(actors.members[0])).control = FlxPlatformActor.Controls.none; } if (currentCharHud.time < -0.5f) { if (Lemonade_Globals.totalTimeAvailable < -0.5f) { FlxG.state = new BaseInformationState(); } else { goToNextScheduledLevel(); } } if (Lemonade_Globals.game_version == 2) { FlxU.collide(collidableTilemap, actors); FlxU.collide(crateParticle, collidableTilemap); FlxU.collide(levelItems, collidableTilemap); FlxU.collide(smallCrates, collidableTilemap); } else { FlxU.collide(collidableTileblocks, actors); FlxU.collide(crateParticle, collidableTileblocks); FlxU.collide(levelItems, collidableTileblocks); FlxU.collide(smallCrates, collidableTileblocks); } FlxU.overlap(actors, actors, genericOverlap); FlxU.overlap(actors, trampolines, trampolinesOverlap); FlxU.overlap(actors, levelItems, genericOverlap); FlxU.overlap(actors, hazards, genericOverlap); FlxU.overlap(actors, coins, genericOverlap); FlxU.overlap(actors, smallCrates, genericOverlap); FlxU.overlap(smallCrates, trampolines, trampolinesOverlap); FlxU.collide(actors, movingPlatforms); FlxU.collide(smallCrates, levelItems); FlxU.collideOnY(smallCrates, andre); FlxU.collideOnY(smallCrates, liselot); bool andreExit = FlxU.overlap(andre, exit, exitOverlap); bool liselotExit = FlxU.overlap(liselot, exit, exitOverlap); if (andreExit && liselotExit) { levelComplete = true; } FlxU.collide(actors, levelItems); foreach (FlxObject crate in levelItems.members) { if (crate.GetType().ToString() == "Lemonade.LargeCrate") { if (((LargeCrate)(crate)).canExplode && !crate.dead) { crateParticle.at(crate); crateParticle.start(true, 0.0f, 50); crate.kill(); FlxG.play("Lemonade/sfx/cw_sound35", 0.5f, false); } } } base.update(); #if __ANDROID__ if (FlxG.pauseAction == "Exit") { #if __ANDROID__ FlxG.state = new IntroState(); #endif #if !__ANDROID__ FlxG.state = new EasyMenuState(); #endif } #endif if (FlxG.keys.justPressed(Keys.Escape) || FlxG.gamepads.isButtonDown(Buttons.Back)) { #if __ANDROID__ FlxG.state = new IntroState(); #endif #if !__ANDROID__ FlxG.state = new BaseInformationState(); #endif } if (levelComplete == true) { //andre.alpha -= 0.1f; //liselot.alpha -= 0.1f; } if (levelComplete == true && !FlxG.transition.hasStarted) { if (transitionPause == 0.0f) { FlxG.play("initials/initials_empire_tagtone4", 0.8f, false); } FlxG.pauseMp3(); andre.control = FlxPlatformActor.Controls.none; liselot.control = FlxPlatformActor.Controls.none; andre.visible = false; liselot.visible = false; transitionPause += FlxG.elapsed; if (transitionPause > 0.85f) { FlxG.transition.startFadeOut(0.05f, -90, 150); } } if (FlxG.transition.complete) { if (FlxG.level != 12) { //FlxG.level++; goToNextScheduledLevel(); Lemonade_Globals.restartMusic = false; if (Lemonade_Globals.PAID_VERSION == Lemonade_Globals.DEMO_MODE && FlxG.level >= 3) { #if __ANDROID__ FlxG.state = new IntroState(); #endif #if !__ANDROID__ FlxG.state = new BaseInformationState(); #endif FlxG.transition.resetAndStop(); return; } else { Lemonade_Globals.timeLeft = currentCharHud.time; FlxG.transition.resetAndStop(); goToNextScheduledLevel(); return; } } if (FlxG.level == 12 && Lemonade_Globals.game_version == 2) { FlxG.state = new BaseInformationState(); FlxG.transition.resetAndStop(); return; } else if (FlxG.level == 12 && Lemonade_Globals.game_version == 1) { #if __ANDROID__ FlxG.state = new IntroState(); #endif #if !__ANDROID__ FlxG.state = new BaseInformationState(); #endif FlxG.transition.resetAndStop(); return; } } if (coins.countLiving() == 0 && !FlxG.transition.hasStarted) { if (Lemonade_Globals.coins == Lemonade_Globals.totalCoins) { FlxG.state = new BaseInformationState(); return; } else { Lemonade_Globals.thisTurnProgress[Lemonade_Globals.location] = 1; foreach (var item in Lemonade_Globals.thisTurnProgress) { Console.WriteLine("This Location: {0} -- K {1} V {2}", Lemonade_Globals.location, item.Key, item.Value); } FlxG.transition.startFadeOut(0.05f, -90, 150); } } }
override public void update() { if (elapsedInState > 1.0f) { if (elapsedInState > 1.25f) { elapsedInState = 0.16f; if (toPlay == false) { //FlxG.playMp3("putt/music/GreenlandIsAlive", 1.0f); toPlay = true; } menu.color = Color.White; } } //if (FlxControl.CANCELJUSTPRESSED) //{ // FlxG.state = new LoadRomState(); //} if (FlxControl.ACTIONJUSTPRESSED || FlxG.mouse.pressed()) { if (elapsedInState > 0.15f) { FlxG.play("putt/sfx/blip"); toStart = true; elapsedInState = 0; } } if (toStart) { menu.color = FlxColor.randomColor(); if (elapsedInState > 0.25f) { Globals.hasPlayedHoleAgain = false; FlxG.stopMp3(); Globals.canSkip = false; Globals.hole = 1; FlxG.state = new PuttState(); } } /* CHEAT CODES * okgo - Play through automatically. * hole# // hole## go straight to hole ## * bonestorm - play Lee Carvallo's Putting Challenge * rob - play Roberto Selavino's Putting Championship */ if (FlxGlobal.cheatString.StartsWith("okgo")) { Globals.playThroughAutomatically = true; } if (FlxGlobal.cheatString.StartsWith("hole")) { Globals.hasPlayedHoleAgain = false; Globals.hole = Convert.ToInt32(FlxGlobal.cheatString.Substring(4, FlxGlobal.cheatString.Length - 4)); FlxG.stopMp3(); Globals.canSkip = false; FlxG.state = new PuttState(); return; } if (FlxGlobal.cheatString.StartsWith("bonestorm")) { Globals.ContentFolder = "putt"; } if (FlxGlobal.cheatString.StartsWith("rob")) { Globals.ContentFolder = "putt_r"; } base.update(); }
/// <summary> /// Hits the ball at the end. /// </summary> public void choosePower() { if (framesElapsed == 3) { log("Now enter the power of your swing."); } power.visible = true; power.setValue(aim.health); bool cheat = false; if (FlxG.keys.justPressed(Keys.D5) || Globals.playThroughAutomatically) { cheat = true; string solution = FlxU.loadFromDevice("data/Finals.txt"); string[] sp = solution.Split('\n'); string[] split = sp[Globals.hole - 1].Split(','); Console.WriteLine("Executing solution for this hole: Aim:{0}, Power:{1}", split[2], split[3]); if (split[0].StartsWith("x")) { aim.x = hole.x; aim.health = 50; selectedClub = 0; selectedForce = 0; } else { aim.x = Convert.ToInt32(split[2]); aim.health = Convert.ToInt32(split[3]); selectedClub = Convert.ToInt32(split[4]); selectedForce = Convert.ToInt32(split[5]); } } if (lee.canHit) { float an = FlxU.getAngle(new Vector2(ball.x + (ball.width / 2), ball.y + (ball.height / 2)), new Vector2(aim.x + (aim.width / 2), aim.y + (aim.height / 2))); float an2 = FlxU.getAngle(new Vector2(ball.x, ball.y), new Vector2(aim.x, aim.y)); float an3 = FlxU.getAngle(new Vector2(ball.x + (ball.width / 1), ball.y + (ball.height / 1)), new Vector2(aim.x + (aim.width / 1), aim.y + (aim.height / 1))); //Console.WriteLine("Angle to shoot is {0} , {1} , {2}", an, an2, an3); ball.angle = an + 90; float multiplier = 1; if (selectedClub != 0) { ball.rise = true; selectedForce = 2; aim.health = 50; } // 0: Feather Touch. switch (selectedForce) { // 1: Firm Putt. case 1: multiplier += 0.35f; break; // 2: Power Drive case 2: multiplier *= 5.0f; break; default: break; } int initialPower = 5; ball.setVelocityFromAngle(initialPower + (aim.health * multiplier)); Vector2 v2 = ball.getNormalizedVelocityFromAngle(); Console.WriteLine("X {0} Y {1} ", v2.X.ToString(), v2.Y.ToString()); ball.normalizedDrags = new Vector2(Math.Abs(v2.X), Math.Abs(v2.Y)); ball.maxVelocity.X = initialPower + (aim.health * multiplier); ball.maxVelocity.Y = initialPower + (aim.health * multiplier); ball.angle = 0; aim.startAim = false; aim.startHealth = false; FlxG.play("putt/sfx/putt", 1.0f, false); rollTiles.color = new Color(1, 1, 1, 0.4f); resetSelections(); FlxG.score++; state = GameState.BallInPlay; return; } if (Globals.ACTIONJUSTPRESSED || cheat) { lee.debugName = "swing"; aim.startHealth = false; } }
override public void create() { base.create(); #if __ANDROID__ FlxG.BUILD_TYPE = FlxG.BUILD_TYPE_OUYA; #endif FlxTilemap bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); bgMap = new FlxTilemap(); bgMap.auto = FlxTilemap.STRING; bgMap.indexOffset = -1; bgMap.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "bg2", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap.boundingBoxOverride = false; bgMap.setScrollFactors(1, 1); add(bgMap); FlxTilemap bgMap3 = new FlxTilemap(); bgMap3.auto = FlxTilemap.STRING; bgMap3.indexOffset = -1; bgMap3.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "stars", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap3.boundingBoxOverride = false; bgMap3.setScrollFactors(0.5f, 0.5f); add(bgMap3); FlxTilemap bgMap4 = new FlxTilemap(); bgMap4.auto = FlxTilemap.STRING; bgMap4.indexOffset = -1; bgMap4.loadTMXMap("Lemonade/levels/slf2/newyork/newyork_intro.tmx", "map", "city", FlxXMLReader.TILES, FlxG.Content.Load <Texture2D>("Lemonade/bgtiles_newyork"), 20, 20); bgMap4.boundingBoxOverride = false; bgMap4.setScrollFactors(1, 1); add(bgMap4); follower = new FlxSprite(0, -100); follower.visible = false; add(follower); follower.velocity.Y = 1450; follower.drag.Y = 10; FlxG.follow(follower, 20.0f); FlxG.followBounds(0, 0, int.MaxValue, 2000); FlxText text1 = new FlxText(0, FlxG.height / 2 - 50, FlxG.width, "GAME OVER"); text1.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); text1.setScrollFactors(1.5f, 1.5f); add(text1); string howWellDidYouGo = "Collected " + Lemonade_Globals.coins.ToString() + " from " + Lemonade_Globals.totalCoins.ToString() + " Coins "; credits = new FlxText(0, FlxG.height / 2 - 100, FlxG.width, ""); credits.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); credits.setScrollFactors(0, 0); credits.visible = true; add(credits); string ins = "Press X to Continue"; #if __ANDROID__ ins = "Press O to Continue"; #endif instruction = new FlxText(0, FlxG.height / 1.3f, FlxG.width, ins); instruction.setFormat(FlxG.Content.Load <SpriteFont>("Lemonade/SMALL_PIXEL"), 2, Lemonade_Globals.GAMEBOY_COLOR_4, FlxJustification.Center, Lemonade_Globals.GAMEBOY_COLOR_1); instruction.setScrollFactors(0, 0); instruction.visible = true; add(instruction); //rgb(237, 0, 142) tween = new Tweener(FlxG.height / 1.3f, FlxG.height / 1.2f, TimeSpan.FromSeconds(1.0f), XNATweener.Cubic.EaseInOut); tween.PingPong = true; tween.Start(); // play some music FlxG.playMp3("Lemonade/music/Lemonade1989Theme", 0.75f); FlxG.play("Lemonade/sfx/cw_sound15", 0.5f, false); }
public override void overlapped(FlxObject obj) { base.overlapped(obj); if (Math.Abs(velocity.X) > 1 || Math.Abs(velocity.Y) > 1) { if (obj.GetType().ToString() == "Lemonade.Worker" && obj.dead == false) { //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledWorker = true; obj.kill(); play("explode"); velocity.X = 0; FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false); } else if (obj.GetType().ToString() == "Lemonade.Army" && obj.dead == false) { //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledArmy = true; obj.kill(); play("explode"); velocity.X = 0; FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false); } else if (obj.GetType().ToString() == "Lemonade.Chef" && obj.dead == false) { //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledChef = true; obj.kill(); play("explode"); velocity.X = 0; FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false); } else if (obj.GetType().ToString() == "Lemonade.Inspector" && obj.dead == false) { //Lemonade_Globals.gameProgress[Lemonade_Globals.location + "_" + FlxG.level.ToString()].KilledInspector = true; obj.kill(); play("explode"); velocity.X = 0; FlxG.play("Lemonade/sfx/cw_sound38", 0.5f, false); } } if (obj.GetType().ToString() == "Lemonade.Liselot" || obj.GetType().ToString() == "Lemonade.Andre") { if (((FlxPlatformActor)(obj)).control == FlxPlatformActor.Controls.player && parent == null) { FlxG.showHud(); //Console.WriteLine("Small crate is at {0} {1} collider is {2} {3} Zoom {4} ", x, y, this.getScreenXY().X, this.getScreenXY().Y, FlxG.zoom); if (FlxG.BUILD_TYPE == FlxG.BUILD_TYPE_PC) { if (FlxG.lastControlTypeUsed == FlxG.CONTROL_TYPE_KEYBOARD) { FlxG._game.hud.setHudGamepadButton( FlxHud.TYPE_KEYBOARD_DIRECTION, FlxHud.Keyboard_Arrow_Down, (this.getScreenXY().X *FlxG.zoom) - 80, (this.getScreenXY().Y *FlxG.zoom) - 120); FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_KEYBOARD, FlxHud.Keyboard_C, (this.getScreenXY().X *FlxG.zoom) + 20, (this.getScreenXY().Y *FlxG.zoom) - 120); } else if (FlxG.lastControlTypeUsed == FlxG.CONTROL_TYPE_GAMEPAD) { FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_XBOX_DIRECTION, FlxHud.xboxDPadDown, (this.getScreenXY().X *FlxG.zoom) - 80, (this.getScreenXY().Y *FlxG.zoom) - 120); FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_XBOX, FlxHud.xboxButtonX, (this.getScreenXY().X *FlxG.zoom) + 20, (this.getScreenXY().Y *FlxG.zoom) - 120); } } if (FlxG.BUILD_TYPE == FlxG.BUILD_TYPE_OUYA) { FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_OUYA_DIRECTION, FlxHud.ouyaDPadDown, (this.getScreenXY().X *FlxG.zoom) - 80, (this.getScreenXY().Y *FlxG.zoom) - 120); FlxG._game.hud.setHudGamepadButton(FlxHud.TYPE_OUYA, FlxHud.ouyaButtonU, (this.getScreenXY().X *FlxG.zoom) + 20, (this.getScreenXY().Y *FlxG.zoom) - 120); } FlxG._game.hud.resetTime(); FlxG._game.hud.timeToShowButton = 0.05f; throwTimer = 0; if (canParent) { parent = obj; Console.WriteLine("can parent == True);"); } canParent = false; } } else { canParent = false; } if (obj.GetType().ToString() == "Lemonade.Trampoline") { trampolineTimer = 0; velocity.Y = -1000; } if (obj.GetType().ToString() == "Lemonade.Spike") { play("explode"); } }