public void Destroy() { state = ChopperStates.Exploding; Lives -= 1; Explosion explosion = Scene.AddSprite<Explosion>(); explosion.Scale = 3; explosion.BackgroundLayer = BackgroundLayer; explosion.StartExploding(Position, 1, false); fire1.Hide(); fire2.Hide(); Hide(); Wait(1, GoToBaseOrEnd); }
void GoToBaseOrEnd() { if (Lives > 0) { state = ChopperStates.Alive; Health = 100; XSpeed = 0; X = playScene.helipad.X; YSpeed = 0; Y = playScene.GroundY; playScene.PrisonersDead += playScene.PrisonersInChopper; playScene.PrisonersInChopper = 0; Show(); } else { state = ChopperStates.Dead; //todo - game over } }
public override void Load() { YCenter = VerticalAlignments.Bottom; AddSound("Helicopter sounds/heli"); ChopperLeft = AddCostume("Chopper/ChopperMove1") .AddFrame("Chopper/ChopperMove2") .AddFrame("Chopper/ChopperMove3") .StartAnimation(); ChopperRight = AddCostume(ChopperLeft.Copy().FlipX()) .StartAnimation(); ; ChopperFront = AddCostume("Chopper/ChopperForward") .AddFrame("Chopper/ChopperForward2") .AddFrame("Chopper/ChopperForward3") .StartAnimation(); AnimationSpeed = .25f; SpriteColor = Color.Red; Layer = 1.7f; Lives = 3; Scale = 0.5f; X = 50; Y = -50; state = ChopperStates.Alive; fire1 = Scene.AddSprite<Fire>(); fire2 = Scene.AddSprite<Fire>(); fire1.Hide(); fire2.Hide(); if (playScene != null) { fire2.BackgroundLayer = playScene.GroundLayer; fire1.BackgroundLayer = playScene.GroundLayer; } if (Scene is PlayScene) { PlaySound("Helicopter sounds/heli", true); } }