/// <summary> /// Ship has been hit /// </summary> void ShipDie() { Lives -= 1; Mode = PlayScreenModes.Finished; ship.Explode(); if (Lives == 0 && SpaceInvaders.NumberOfPlayers == 1) { // 1 Player game over Wait(1, () => ShowScene("GameOver")); } else if (Lives == 0 && OtherPlayerScreen.Lives == 0) { // 2 Player game over Wait(1, () => ShowScene("GameOver")); } else { // One player only - or other player already dead if (SpaceInvaders.NumberOfPlayers == 1 || OtherPlayerScreen.Lives == 0) { Wait(1.5, ShowPlayerNumber); } else { Wait(1.5, ShowOtherPlayerScreen); } } }
Text DebugText; Text Player1ScoreText; Text Player2ScoreText; Text LevelText; Text LivesText; Text HighScoreText; Text PlayerNumberText; /// <summary> /// Load the screen /// </summary> public override void Load() { BackgroundColor = Color.Black;
public void ShowPlayerNumber() { Mode = PlayScreenModes.ShowingPlayerNumber; PlayerNumberText.Value = "Player " + ActivePlayer.ToString(); PlayerNumberText.Visible = true; RaiseShip(); Wait(0.3, PlayerNumberText.Hide); Wait(0.6, PlayerNumberText.Show); Wait(0.9, PlayerNumberText.Hide); Wait(1.2, PlayerNumberText.Show); Wait(1.5, PlayerNumberText.Hide); Wait(2.0, StartPlayer); }
BackgroundColor = Color.Black; FontName = "QuartzMS"; AddSound("shoot");
}); PlayerNumberText = AddText(new Text { Alignment = HorizontalAlignments.Center, VerticalAlign = VerticalAlignments.Center, Scale = 1f, Position = new Vector2(0, 0), Color = Color.Lime, Visible = false }); LevelText = AddText(new Text { Alignment = HorizontalAlignments.Right, VerticalAlign = VerticalAlignments.Bottom, Scale = .4f, Position = new Vector2(100f, -100f), Color = Color.White });
public void StartPlayer() { Mode = PlayScreenModes.Playing; Wait(MoveWaitSeconds, Move); ScheduleAlienShoot(); }