override public void update() { //shadow setDrags(normalizedDrags.X * dragMultiplier, normalizedDrags.Y * dragMultiplier); if (rise) { velocity.Y -= 30; heightOffGround += 0.2f; } shadow.at(this); shadow.y += heightOffGround; scale = (float)Convert.ToDouble((y / FlxG.height)); if (scale > 0.75f) { play("size2"); width = 4; height = 2; setOffset(2, 6); } else if (scale > 0.5f) { play("size3"); width = 4; height = 4; setOffset(2, 4); } else if (scale > 0.4f) { play("size4"); width = 2; height = 2; setOffset(3, 3); } else { play("size5"); } //Console.WriteLine(scale); if (y < FlxG.height / 2) { //setDrags(44, 44); dragMultiplier = 44; } else if (y < (FlxG.height / 2) - 40) { //setDrags(144, 144); dragMultiplier = 44; } else { dragMultiplier = 10; //setDrags(10, 10); } scale = 1; if (y < 0) { //setDrags(50000, 50000); dragMultiplier = 100000000000; } base.update(); }
override public void update() { FlxG.setHudText(1, "Flight Height : " + flightHeight.ToString()); if (shadow.debugName == "fly") { flightHeight++; if (flightHeight >= 16) { flightHeight = 16; } } if (shadow.debugName == "onground") { flightHeight--; if (flightHeight <= 0) { flightHeight = 0; } } player.at(shadow); player.y -= flightHeight; //player.x -= flightHeight; if (FlxControl.ACTIONJUSTPRESSED && elapsedInState > 0.6f) { if (shadow.debugName == "onground") { shadow.debugName = "fly"; } else if (shadow.debugName == "fly") { shadow.debugName = "onground"; } } //m.x = ((int)(FlxG.mouse.x / 8) * 8); //m.y = ((int)(FlxG.mouse.y / 8) * 8); if (shadow.debugName == "fly") { if (FlxControl.LEFTJUSTPRESSED) { shadow.x -= 8; } if (FlxControl.RIGHTJUSTPRESSED) { shadow.x += 8; } if (FlxControl.UPJUSTPRESSED) { shadow.y -= 8; } if (FlxControl.DOWNJUSTPRESSED) { shadow.y += 8; } } else if (shadow.debugName == "onground") { if (FlxControl.LEFTJUSTPRESSED) { shadow.x -= 8; if (FlxU.overlap(shadow, waterGrp, null) == true) { shadow.x += 8; } } if (FlxControl.RIGHTJUSTPRESSED) { shadow.x += 8; if (FlxU.overlap(shadow, waterGrp, null) == true) { shadow.x -= 8; } } if (FlxControl.UPJUSTPRESSED) { shadow.y -= 8; if (FlxU.overlap(shadow, waterGrp, null) == true) { shadow.y += 8; } } if (FlxControl.DOWNJUSTPRESSED) { shadow.y += 8; if (FlxU.overlap(shadow, waterGrp, null) == true) { shadow.y -= 8; } } } //if (FlxControl.LEFT) //{ // player.x -= 8; //} //if (FlxControl.RIGHT) //{ // player.x += 8; //} //if (FlxControl.UP) //{ // player.y -= 8; //} //if (FlxControl.DOWN) //{ // player.y += 8; //} //FlxG.setHudText(1, tile FlxU.overlap(pellets, shadow, getPellet); if (FlxG.debug) { if (FlxG.keys.F8) { if (pellets.getFirstAlive() != null) { shadow.at(pellets.getFirstAlive()); } } } if (pellets.getFirstAlive() == null) { FlxG.username = FlxU.randomString(32); FlxOnlineStatCounter.sendStats("theisland", "-", (int)(elapsedInState * 100)); FlxG.state = new WinState(); return; } base.update(); }