public override void Start() { base.Start(); GameRef.BGColor = Color.Red; //GUI _entitiestext = new Text(this, "entitestext", GameRef.Game.Content.Load<SpriteFont>(@"font"), "none", new Vector2(5, 5)); AddEntity(_entitiestext); _fpscounter = new FramesPerSecondCounter(this, "FPSCounter", GameRef.Game.Content.Load<SpriteFont>(@"font"), new Vector2(400, 400)); _fpscounter.Body.Position = new Vector2(GameRef.Viewport.Width - _fpscounter.TextRender.DrawRect.Width, GameRef.Viewport.Height - _fpscounter.TextRender.DrawRect.Height); AddEntity(_fpscounter); }
public override void Start() { base.Start(); var menuparser = new XmlParser(@"States/Menu/menu.xml"); _bgimage = new Image(this, "BGImage"); _bgimage.ParseXml(menuparser, "Menu->BGImage"); AddEntity(_bgimage); _starttext = new Text(this, "StartText"); _starttext.ParseXml(menuparser, "Menu->StartText"); float x = GameRef.Viewport.Width / 2 - _starttext.TextRender.DrawRect.Width / 2; _starttext.Body.Position = new Vector2(x, 500); AddEntity(_starttext); _startkey = new DoubleInput(null, "StartKey", Keys.Enter, Buttons.Start, PlayerIndex.One); }
public override void Start() { if (!_alreadystarted) { base.Start(); _alreadystarted = true; XmlParser xp = new XmlParser(@"States/Game/Game.xml"); _bgimage = new Image(this, "BGImage"); _bgimage.ParseXml(xp, Name + "->" + _bgimage.Name); AddEntity(_bgimage); _town = new Town(this, xp); AddEntity(_town); _scoretext = new Text(this, "ScoreText"); _scoretext.ParseXml(xp, Name + "->" + _scoretext.Name); _scoretext.Body.Position = new Vector2( GameRef.Viewport.Width / 2 - _scoretext.TextRender.DrawRect.Width / 2, 10); AddEntity(_scoretext); _healthtext = new Text(this, "HealthText"); _healthtext.ParseXml(xp, Name + "->" + _healthtext.Name); _healthtext.Body.Position = new Vector2( GameRef.Viewport.Width / 2 - _healthtext.TextRender.DrawRect.Width / 2, 50); AddEntity(_healthtext); _difficultytext = new Text(this, "DifficultyText"); _difficultytext.ParseXml(xp, Name + "->" + _difficultytext.Name); _difficultytext.Body.Position = new Vector2( GameRef.Viewport.Width / 2 - _difficultytext.TextRender.DrawRect.Width / 2, 90); AddEntity(_difficultytext); _es = new EnemySpawner(this, xp); EntityRemoved += _es.RemoveEnemy; _es.Targets.Add(_town); AddEntity(_es); _town.Targets.List = _es.Enemies; } }