public new void Start() { _startkey = new DoubleInput(Keys.Enter, Buttons.Start, PlayerIndex.One); GameRef.BGColor = Color.Red; _bgimage = new Image(this, GameRef.Game.Content.Load<Texture2D>(@"menu/background"), Vector2.Zero) { Render = { Scale = 6f, Layer = 0f } }; AddEntity(_bgimage); _starttext = new Text(this, new Vector2(100, 500), "Press Start or Enter to start", GameRef.Game.Content.Load<SpriteFont>("font")) { Render = { Layer = 1f } }; AddEntity(_starttext); }
public new void Start() { if (_alreadystarted) return; _alreadystarted = true; GameRef.BGColor = Color.BlueViolet; _bgimage = new Image(this, GameRef.Game.Content.Load<Texture2D>(@"game/background"), Vector2.Zero) { Render = {Scale = 6f, Layer = 0f} }; AddEntity(_bgimage); _town = new Town(this); AddEntity(_town); _es = new EnemySpawner(this); EntityRemoved += _es.RemoveEnemy; _es.Targets.Add(_town); AddEntity(_es); _scoretext = new Text(this, Vector2.Zero, Score.ToString(), GameRef.Game.Content.Load<SpriteFont>(@"font")); _scoretext.Body.Position = new Vector2(GameRef.Viewport.Width/2 - _scoretext.Render.DrawRectangle.Width/2, 10); _scoretext.Render.Layer = 1f; AddEntity(_scoretext); _healthtext = new Text(this, Vector2.Zero, _town.Health.HitPoints.ToString(), GameRef.Game.Content.Load<SpriteFont>(@"font")); _healthtext.Body.Position = new Vector2(GameRef.Viewport.Width / 2 - _healthtext.Render.DrawRectangle.Width / 2, 50); _healthtext.Render.Layer = 1f; _healthtext.Render.Color = Color.Red; AddEntity(_healthtext); _gameovertext = new Text(this, Vector2.Zero, "", GameRef.Game.Content.Load<SpriteFont>(@"font")); _gameovertext.Render.Layer = 1f; _gameovertext.Render.Text = "Game Over!\nPress Start or Enter to retry!"; _gameovertext.Render.Color = Color.Black; _town.Collision.NewPartners = _es.Enemies; }