//Called whenever the player touches the exit public Boolean win(FlxObject Exit, FlxObject Player) { status.text = "Yay, you won!"; score.text = "SCORE: 5000"; Player.kill(); return(true); }
//This is an overlap callback function, triggered by the calls to FlxU.overlap(). protected bool overlapped(FlxObject object1, FlxObject object2) { if ((object1 is EnemyBullet) || (object1 is Bullet)) { object1.kill(); } object2.hurt(1); return(true); }
//Called whenever the player touches a coin public Boolean getCoin(FlxObject Coin, FlxObject Player) { Coin.kill(); score.text = "SCORE: " + (coins.CountDead() * 100); if (coins.CountLiving() == 0) { status.text = "Find the exit."; exit.Exists = true; } 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); } }
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"); } }