public TitleScreenState() { var possibleKeys = new[] { Keyboard.Key.Delete, Keyboard.Key.P, Keyboard.Key.BackSlash, Keyboard.Key.Escape, Keyboard.Key.Tab, Keyboard.Key.Period, Keyboard.Key.F5, Keyboard.Key.D }; startKey = possibleKeys[Content.Random.Next(possibleKeys.Length)]; logo = new SpriteComponent { Sprite = new Sprite(Content.Logo) }; prompt = new TextComponent { Text = new Text("Press " + startKey.ToString().ToUpper(), Content.Font, 16) }; input = new InputComponent(); input.KeyEvents[startKey] = (key, mod, time) => Program.TransitionToState<GameplayState>(); }
public GameplayState() { Map = new MapObject(Content.Level); Player = new Player(Map.Spawn); camera = new CameraComponent("scroll", Map.Map.Height * Map.Map.TileHeight, 160); // could be worse GraphicsSubsystem.Instance.SwitchCamera("scroll"); score = new TextComponent { Text = new Text("", Content.Font, 16) }; meterBack = new SpriteComponent { Sprite = new Sprite(Content.MeterBack) }; meterFront = new SpriteComponent { Sprite = new Sprite(Content.MeterFront) }; Score = 0; Content.Music.PlayingOffset = TimeSpan.Zero; Content.Music.Play(); }
public VictoryState() { text = new TextComponent { Text = new Text(string.Format( "Congratulations!\n" + "Your score: {0:D5}\n\n" + "Press RIGHT SHIFT twice to play again.\n\n\n" + "Brought to you by:\n" + "@TheRobKellett - \"Finally, I can sleep!\"\n" + "@Quantumplation (π) - \"Please do not put my name in this crappy game.\"\n", GameplayState.Score), Content.Font, 16) }; input.KeyEvents[Keyboard.Key.RShift] = (key, mod, time) => { timesPressed++; if (timesPressed >= 2) Program.TransitionToState<GameplayState>(); }; }