/// <summary> /// Inicijalizacija igre /// mora se dodati u prvu scenu prije pozivanja /// </summary> public void Initialize() { OnBegin = delegate { Neprijatelj.Postavljanje(); Stit.Postavljanje(); GlavnaScena scene = Program.Igra.GetScene <GlavnaScena>(); Ufo = new UFO(); Program.Igra.GetScene <GlavnaScena>().Add(Ufo); // Create player and add to scene Igrac = new Igrac(); Add(Igrac); // Gametext for the entire game pretty much #region gameText var background = new Image("Slike/background.png"); background.Alpha = 0.4f; scene.AddGraphic(background); //Setting a default config file for the RichText to use var txtConfig = new RichTextConfig() { TextAlign = TextAlign.Center, CharColor = Color.Green, FontSize = 18, SineAmpX = 1, SineAmpY = 2, SineRateX = 1, Font = new Font("Slike/VCR_OSD_MONO.ttf"), }; // Writing the text graphics and setting position var livesLeftTxtLabel = new RichText("Zivoti", txtConfig); livesLeftTxtLabel.SetPosition(50, 16); scene.PreostaloZivotaText = new RichText(scene.Igrac.ZivotiIgraca.ToString(), txtConfig); scene.PreostaloZivotaText.Name = "livesLeftTxt"; scene.PreostaloZivotaText.SetPosition(70, 32); var curScoreTxtLabel = new RichText("Bodovi", txtConfig); curScoreTxtLabel.SetPosition(650, 15); scene.TrenutniBodoviText = new RichText(scene.Igrac.IznosBodova.ToString(), txtConfig); scene.TrenutniBodoviText.Name = "curScoreTxt"; scene.TrenutniBodoviText.SetPosition(670, 32); // Adds Graphic to Scene scene.AddGraphic(livesLeftTxtLabel); scene.AddGraphic(curScoreTxtLabel); scene.AddGraphic(scene.PreostaloZivotaText); scene.AddGraphic(scene.TrenutniBodoviText); #endregion gameText }; }
//Text Configuration private RichText ScoreSetup(Game game, string scoreText) { var scoreConfig = new RichTextConfig() { CharColor0 = Color.Cyan, CharColor1 = Color.White, FontSize = 24, }; return(new RichText(scoreText, scoreConfig) { X = game.HalfWidth - (scoreText.Length * 5), Y = 10, TextAlign = TextAlign.Center, }); }
// Stuff in the HighScores Scene public HighScoresScene(int bodovi) : base() { OnBegin = delegate { var txtConfig = new RichTextConfig() { TextAlign = TextAlign.Center, CharColor = Color.Green, FontSize = 25, SineAmpX = 1, SineAmpY = 2, SineRateX = 1, Font = new Font("Slike/VCR_OSD_MONO.ttf"), }; var curScoreTxtLabel = new RichText("Cestitamo, osvojili ste " + bodovi + " bodova!", txtConfig); curScoreTxtLabel.SetPosition(150, 255); AddGraphic(curScoreTxtLabel); //Adds Textbox and button and highscore leaderboard (hslb) Program.Igra.MouseVisible = true; }; Program.Igra.AddScene(this); }
/// <summary> /// Called to initialize the game /// Note: must be added to Game.FirstScene before calling /// </summary> public void Initialize() { OnBegin = delegate { Enemy.Initialize(); Barricade.Initialize(); MainScene scene = Program.game.GetScene <MainScene>(); Ufo = new UFO(); Program.game.GetScene <MainScene>().Add(Ufo); // Create player and add to scene player = new Player(); Add(player); // Gametext for the entire game pretty much #region gameText var background = new Image("Assets/background.png"); background.Alpha = 0.4f; scene.AddGraphic(background); //Setting a default config file for the RichText to use var txtConfig = new RichTextConfig() { TextAlign = TextAlign.Center, CharColor = Color.Green, FontSize = 18, SineAmpX = 1, SineAmpY = 2, SineRateX = 1, Font = new Font("Assets/VCR_OSD_MONO.ttf"), }; // Writing the text graphics and setting position var livesLeftTxtLabel = new RichText("Lives", txtConfig); livesLeftTxtLabel.SetPosition(50, 16); scene.livesLeftTxt = new RichText(scene.player.playerLives.ToString(), txtConfig); scene.livesLeftTxt.Name = "livesLeftTxt"; scene.livesLeftTxt.SetPosition(70, 32); var highScoreTxtLabel = new RichText("Highscore", txtConfig); highScoreTxtLabel.SetPosition(350, 15); highScoreTxt = new RichText(ReadXML.MainScreenXML(), txtConfig); highScoreTxt.Name = "highScoreTxt"; highScoreTxt.SetPosition(380, 30); var curScoreTxtLabel = new RichText("Score", txtConfig); curScoreTxtLabel.SetPosition(650, 15); scene.curScoreTxt = new RichText(scene.player.ScoreAmount.ToString(), txtConfig); scene.curScoreTxt.Name = "curScoreTxt"; scene.curScoreTxt.SetPosition(670, 32); // Adds Graphic to Scene scene.AddGraphic(livesLeftTxtLabel); scene.AddGraphic(highScoreTxtLabel); scene.AddGraphic(curScoreTxtLabel); scene.AddGraphic(scene.livesLeftTxt); scene.AddGraphic(scene.highScoreTxt); scene.AddGraphic(scene.curScoreTxt); #endregion gameText }; }