/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here //load lound efects _shoot1 = Game.Content.Load <SoundEffect>("Assets\\Sounds\\GunSound1"); _shoot2 = Game.Content.Load <SoundEffect>("Assets\\Sounds\\GunSound2"); _die = Game.Content.Load <SoundEffect>("Assets\\Sounds\\BunnyDying"); _voice = Game.Content.Load <SoundEffect>("Assets\\Sounds\\BunnySound"); //initialize waveText = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._UI[2]; _enemys = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._enemys; _aspEnemy1 = Game.Components.OfType <DrawScripts.AnimSprite>().ToList()[7]; _aspEnemy2 = Game.Components.OfType <DrawScripts.AnimSprite>().ToList()[8]; _player = Game.Components.OfType <Player.Player>().ToList()[0]; _waves = new List <int[]>(); spawnPoints = new List <Vector2>() { }; readFile(); DefineSpawnPoints(); CurrentWave = 0; base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here _aspCharacter = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._player; _bullets = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._bullets; _enemys = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._enemys; _powerUps = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._powerUps; _draw = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]; _powerup = Game.Components.OfType <DrawScripts.AnimSprite>().ToList()[9]; base.Initialize(); }
public CharacterMovement(Game game) : base(game) { // TODO: Construct any child components here _player = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._player; _helthBar = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._UI[1]; _crossHair = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]._UI[0]; _bullet = Game.Components.OfType <Bullet.Bullet>().ToList()[0]; _draw = Game.Components.OfType <DrawScripts.DrawInOrder>().ToList()[0]; _collider = Game.Components.OfType <Colliders.ColliderBulletscs>().ToList()[0]; }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here DrawScripts.AnimSprite _spStartB = new DrawScripts.AnimSprite(this.Game); _spStartB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Start"); _spStartB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 4); _spStartB.animations = new List <Rectangle>(); _spStartB.animations.Add(new Rectangle(0, 0, _spStartB.texture.Width, _spStartB.texture.Height)); _spStartB.center = new Vector2(_spStartB.texture.Width / 2, _spStartB.texture.Height / 2); _spStartB.scale = new Vector2(0.5f, 0.5f); _spStartB.currentAnim = 0; _spStartB.slika = true; this.Game.Components.Add(_spStartB); DrawScripts.AnimSprite _spLeaderBoardB = new DrawScripts.AnimSprite(this.Game); _spLeaderBoardB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Leaderboard"); _spLeaderBoardB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2.7f); _spLeaderBoardB.animations = new List <Rectangle>(); _spLeaderBoardB.animations.Add(new Rectangle(0, 0, _spLeaderBoardB.texture.Width, _spLeaderBoardB.texture.Height)); _spLeaderBoardB.center = new Vector2(_spLeaderBoardB.texture.Width / 2, _spLeaderBoardB.texture.Height / 2); _spLeaderBoardB.scale = new Vector2(0.5f, 0.5f); _spLeaderBoardB.currentAnim = 0; _spLeaderBoardB.slika = true; this.Game.Components.Add(_spLeaderBoardB); DrawScripts.AnimSprite _spExitB = new DrawScripts.AnimSprite(this.Game); _spExitB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Exit"); _spExitB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2); _spExitB.animations = new List <Rectangle>(); _spExitB.animations.Add(new Rectangle(0, 0, _spExitB.texture.Width, _spExitB.texture.Height)); _spExitB.center = new Vector2(_spExitB.texture.Width / 2, _spExitB.texture.Height / 2); _spExitB.scale = new Vector2(0.5f, 0.5f); _spExitB.currentAnim = 0; _spExitB.slika = true; this.Game.Components.Add(_spExitB); _UI = new List <DrawScripts.AnimSprite>(); _UI.Add(_spStartB); _UI.Add(_spLeaderBoardB); _UI.Add(_spExitB); DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI); this.Game.Components.Add(_draw); this.Game.IsMouseVisible = true; base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. this.Game is where it can query for any required services and load this.Game.Content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here //----------------------------------------------------------------------------Dodajanje ozadja DrawScripts.AnimSprite _spBackground = new DrawScripts.AnimSprite(this.Game); _spBackground.texture = this.Game.Content.Load <Texture2D>("Assets\\Background\\BackGround"); _spBackground.position = Vector2.Zero; _spBackground.animations = new List <Rectangle>(); _spBackground.animations.Add(new Rectangle(0, 0, _spBackground.texture.Width, _spBackground.texture.Height)); _spBackground.scale = new Vector2((float)this.Game.GraphicsDevice.Viewport.Width / _spBackground.texture.Width, (float)this.Game.GraphicsDevice.Viewport.Height / _spBackground.texture.Height); _spBackground.center = Vector2.Zero; _spBackground.currentAnim = 0; _spBackground.slika = true; this.Game.Components.Add(_spBackground); //------------------------------------------------------------------------dodajanje trupla glavnem igralcu DrawScripts.AnimSprite _aspCharacter = new DrawScripts.AnimSprite(this.Game); _aspCharacter.texture = this.Game.Content.Load <Texture2D>("Assets\\Character\\Character"); _aspCharacter.animations = new List <Rectangle>(); _aspCharacter.animations.Add(new Rectangle(0, 0, 31, 43)); //desno _aspCharacter.animations.Add(new Rectangle(32, 0, 31, 43)); //gor _aspCharacter.animations.Add(new Rectangle(56, 0, 31, 43)); //dol _aspCharacter.animations.Add(new Rectangle(88, 0, 31, 43)); //levo _aspCharacter.scale = new Vector2(2f, 2f); _aspCharacter.center = Vector2.Zero; this.Game.Components.Add(_aspCharacter); //---------------------------------------------------------------------------dodajanje nog glavnemu igralcu DrawScripts.AnimSprite _aspCharacterLegs = new DrawScripts.AnimSprite(this.Game); _aspCharacterLegs.texture = _aspCharacter.texture; _aspCharacterLegs.animations = new List <Rectangle>(); _aspCharacterLegs.animations.Add(new Rectangle(0, 57, 31, 28)); //desno _aspCharacterLegs.animations.Add(new Rectangle(32, 57, 31, 28)); //gor _aspCharacterLegs.animations.Add(new Rectangle(56, 57, 31, 28)); //dol _aspCharacterLegs.animations.Add(new Rectangle(88, 57, 31, 28)); //levo _aspCharacterLegs.animations.Add(new Rectangle(0, 86, 31, 28)); //stoji desno _aspCharacterLegs.animations.Add(new Rectangle(32, 86, 31, 28)); // stoji gor _aspCharacterLegs.scale = new Vector2(2f, 2f); _aspCharacterLegs.center = Vector2.Zero; this.Game.Components.Add(_aspCharacterLegs); Player.Player _player = new Player.Player(this.Game); _player.body = _aspCharacter; _player.legs = _aspCharacterLegs; _player.position = new Vector2((float)this.Game.GraphicsDevice.Viewport.Width / 2, (float)this.Game.GraphicsDevice.Viewport.Height / 2); _player.speed = 100; _player.shootSpeed = 1f; _player.multipleBoolets = false; _player.helth = 100; _player.shoot1 = this.Game.Content.Load <SoundEffect>("Assets\\Sounds\\GunSound1"); _player.shoot2 = this.Game.Content.Load <SoundEffect>("Assets\\Sounds\\GunSound2"); this.Game.Components.Add(_player); //-------------------------------------------------------------------dodajanje helth bara DrawScripts.AnimSprite _helthBar = new DrawScripts.AnimSprite(this.Game); _helthBar.font = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font");; _helthBar.slika = false; _helthBar.helthBar = true; this.Game.Components.Add(_helthBar); //---------------------------------------------------------------------dodajanje texta za stopnjo DrawScripts.AnimSprite _LevelText = new DrawScripts.AnimSprite(this.Game); _LevelText.font = _helthBar.font; _LevelText.slika = false; _LevelText.helthBar = false; _LevelText.text = "Trenutna stopnja: 1"; _LevelText.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 100, 0); this.Game.Components.Add(_LevelText); //----------------------------------------------------------------------------dodajanje croshaira DrawScripts.AnimSprite _spCrossHair = new DrawScripts.AnimSprite(this.Game); _spCrossHair.texture = this.Game.Content.Load <Texture2D>("Assets\\Character\\CrossHair"); _spCrossHair.position = Vector2.Zero; _spCrossHair.animations = new List <Rectangle>(); _spCrossHair.animations.Add(new Rectangle(0, 0, _spCrossHair.texture.Width, _spCrossHair.texture.Height)); _spCrossHair.scale = new Vector2(1, 1); _spCrossHair.center = new Vector2(_spCrossHair.texture.Width / 2, _spCrossHair.texture.Height / 2); _spCrossHair.currentAnim = 0; _spCrossHair.slika = true; this.Game.Components.Add(_spCrossHair); //----------------------------------------------------------------------------dodajanje metka DrawScripts.AnimSprite _spBullet = new DrawScripts.AnimSprite(this.Game); _spBullet.texture = this.Game.Content.Load <Texture2D>("Assets\\Character\\Bullet"); _spBullet.animations = new List <Rectangle>(); _spBullet.animations.Add(new Rectangle(0, 0, _spBullet.texture.Width, _spBullet.texture.Height)); _spBullet.scale = new Vector2(1, 1); _spBullet.center = new Vector2(_spBullet.texture.Width / 2, _spBullet.texture.Height / 2); _spBullet.currentAnim = 0; this.Game.Components.Add(_spBullet); Bullet.Bullet _bullet = new Bullet.Bullet(this.Game); _bullet.body = _spBullet; this.Game.Components.Add(_bullet); //-------------------------------------------------------------------dodajanje enemijev DrawScripts.AnimSprite _aspEnemy = new DrawScripts.AnimSprite(this.Game); _aspEnemy.texture = this.Game.Content.Load <Texture2D>("Assets\\Enemy\\Enemy"); _aspEnemy.animations = new List <Rectangle>(); _aspEnemy.animations.Add(new Rectangle(3, 7, 43, 19)); _aspEnemy.animations.Add(new Rectangle(56, 3, 43, 22)); _aspEnemy.scale = new Vector2(2f, 2f); _aspEnemy.currentAnim = 0; _aspEnemy.center = new Vector2(21, 11); this.Game.Components.Add(_aspEnemy); DrawScripts.AnimSprite _aspEnemy2 = new DrawScripts.AnimSprite(this.Game); _aspEnemy2.texture = _aspEnemy.texture; _aspEnemy2.animations = new List <Rectangle>(); _aspEnemy2.animations.Add(new Rectangle(1, 36, 43, 20)); _aspEnemy2.animations.Add(new Rectangle(56, 29, 43, 22)); _aspEnemy2.scale = new Vector2(2f, 2f); _aspEnemy2.currentAnim = 1; _aspEnemy2.center = new Vector2(21, 11); this.Game.Components.Add(_aspEnemy2); //------------------------------------------------------------------------------dodajanje powe upov DrawScripts.AnimSprite _powerUps = new DrawScripts.AnimSprite(this.Game); _powerUps.texture = this.Game.Content.Load <Texture2D>("Assets\\Character\\PowerUps"); this.Game.Components.Add(_powerUps); //------------------------------------------------------------------------------izrisevanje vseh objektov s skripto DrawInOrder List <DrawScripts.AnimSprite> _background = new List <DrawScripts.AnimSprite>(); _background.Add(_spBackground); List <Enemy.enemy> _enemys = new List <Enemy.enemy>(); List <DrawScripts.AnimSprite> _UI = new List <DrawScripts.AnimSprite>(); _UI.Add(_spCrossHair); _UI.Add(_helthBar); _UI.Add(_LevelText); DrawScripts.DrawInOrder _draw = new DrawScripts.DrawInOrder(this.Game, _background, _enemys, _player, _UI, new List <DrawScripts.AnimSprite>()); this.Game.Components.Add(_draw); //--------------------------------------------------------------------------------------------------- konec dodajanja elementov v izrisevanje //------------------------------------------------------------------------------------motor za metke Colliders.ColliderBulletscs collider = new Colliders.ColliderBulletscs(this.Game); this.Game.Components.Add(collider); //-------------------------------------------------------------------- motro za enemije Motors.EnemyMovement _enemyMove = new Motors.EnemyMovement(this.Game); this.Game.Components.Add(_enemyMove); //----------------------------------------------------------------------------------------------------------------------------------dodajanje motorja za igralca Motors.CharacterMovement _charMove = new Motors.CharacterMovement(this.Game); this.Game.Components.Add(_charMove); //----------------------------------------------------------------------------dodajanje collider za igralca Colliders.CharacterCollider _charCollider = new Colliders.CharacterCollider(this.Game); this.Game.Components.Add(_charCollider); //--------------------------------------------------------------add wave manager Manger.WaveManger _waveManager = new Manger.WaveManger(this.Game); this.Game.Components.Add(_waveManager); this.Game.IsMouseVisible = false; base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here DrawScripts.AnimSprite _spMainMenuB = new DrawScripts.AnimSprite(this.Game); _spMainMenuB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Mainmenu"); _spMainMenuB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 3.7f, this.Game.GraphicsDevice.Viewport.Height - 30); _spMainMenuB.animations = new List <Rectangle>(); _spMainMenuB.animations.Add(new Rectangle(0, 0, _spMainMenuB.texture.Width, _spMainMenuB.texture.Height)); _spMainMenuB.center = new Vector2(_spMainMenuB.texture.Width / 2, _spMainMenuB.texture.Height / 2); _spMainMenuB.scale = new Vector2(0.5f, 0.5f); _spMainMenuB.currentAnim = 0; _spMainMenuB.slika = true; this.Game.Components.Add(_spMainMenuB); DrawScripts.AnimSprite _spRetryB = new DrawScripts.AnimSprite(this.Game); _spRetryB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Retry"); _spRetryB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height - 30); _spRetryB.animations = new List <Rectangle>(); _spRetryB.animations.Add(new Rectangle(0, 0, _spRetryB.texture.Width, _spRetryB.texture.Height)); _spRetryB.center = new Vector2(_spRetryB.texture.Width / 2, _spRetryB.texture.Height / 2); _spRetryB.scale = new Vector2(0.5f, 0.5f); _spRetryB.currentAnim = 0; _spRetryB.slika = true; this.Game.Components.Add(_spRetryB); DrawScripts.AnimSprite _spExitB = new DrawScripts.AnimSprite(this.Game); _spExitB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Exit"); _spExitB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 1.37f, this.Game.GraphicsDevice.Viewport.Height - 30); _spExitB.animations = new List <Rectangle>(); _spExitB.animations.Add(new Rectangle(0, 0, _spExitB.texture.Width, _spExitB.texture.Height)); _spExitB.center = new Vector2(_spExitB.texture.Width / 2, _spExitB.texture.Height / 2); _spExitB.scale = new Vector2(0.5f, 0.5f); _spExitB.currentAnim = 0; _spExitB.slika = true; this.Game.Components.Add(_spExitB); DrawScripts.AnimSprite _LeaderBoardTextHead = new DrawScripts.AnimSprite(this.Game); _LeaderBoardTextHead.font = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font"); _LeaderBoardTextHead.slika = false; _LeaderBoardTextHead.text = "Name -- Number of waves"; _LeaderBoardTextHead.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 100, 20); this.Game.Components.Add(_LeaderBoardTextHead); // 14 izpisev je lepa stevilka _LeaderBoardText = new DrawScripts.AnimSprite(this.Game); _LeaderBoardText.font = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font"); _LeaderBoardText.slika = false; _LeaderBoardText.text = "neki -- 13"; _LeaderBoardText.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 100, 50); this.Game.Components.Add(_LeaderBoardText); _UI = new List <DrawScripts.AnimSprite>(); _UI.Add(_spMainMenuB); _UI.Add(_spRetryB); _UI.Add(_spExitB); _UI.Add(_LeaderBoardTextHead); _UI.Add(_LeaderBoardText); DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI); this.Game.Components.Add(_draw); PrevisuMouseVale = 0; top = 0; bot = 14; _LeaderBoard = new List <string[]>(); fillLeaderBoard(); makeTextbetween(); this.Game.IsMouseVisible = true; base.Initialize(); }
private void bullethitrabit() { int itiBullet = 0; int itiEnemy = 0; int anim = 0; List <DrawScripts.AnimSprite> dodaniPowerupi = new List <DrawScripts.AnimSprite>(); List <int> zadetiEnemyi = new List <int>(); Boolean zadetek = false; foreach (Bullet.Bullet bullet in _bullets) { if (bullet.player) { itiEnemy = 0; foreach (Enemy.enemy enemy in _enemys) { if (enemy.position.X + 15 * enemy.body.scale.X >= bullet.position.X && enemy.position.Y + 15 * enemy.body.scale.Y >= bullet.position.Y && enemy.position.X - 15 * enemy.body.scale.X <= bullet.position.X && enemy.position.Y - 15 * enemy.body.scale.Y <= bullet.position.Y) { // kill enemy and bullet check if spawn power up zadetiEnemyi.Add(itiEnemy); Random rnd = new Random(); int randZaDrop = rnd.Next(0, 101); if (randZaDrop < 20) { int randZaKateriDrop = rnd.Next(0, 101); if (randZaKateriDrop >= 0 && randZaKateriDrop < 34) { anim = 0; } else if (randZaKateriDrop > 33 && randZaKateriDrop < 67) { anim = 1; } else if (randZaKateriDrop > 66 && randZaKateriDrop <= 100) { anim = 2; } DrawScripts.AnimSprite _powerUps = new DrawScripts.AnimSprite(Game); _powerUps.texture = _powerup.texture; _powerUps.animations = new List <Rectangle>(); _powerUps.animations.Add(new Rectangle(0, 0, 27, 28)); //multy shot _powerUps.animations.Add(new Rectangle(33, 0, 21, 28)); //speed shot _powerUps.animations.Add(new Rectangle(60, 0, 23, 28)); //speeeeeeed boooooost _powerUps.scale = new Vector2(2f, 2f); _powerUps.center = Vector2.Zero; _powerUps.position = enemy.position; _powerUps.slika = true; _powerUps.currentAnim = anim; dodaniPowerupi.Add(_powerUps); Game.Components.Add(_powerUps); } zadetek = true; float volume = 0.4f; float pitch = 0.0f; float pan = 0.0f; enemy.die.Play(volume, pitch, pan); break; } itiEnemy++; } if (zadetek) { break; } } else { //Check if player is hit if (_aspCharacter.position.X + (13 * _aspCharacter.body.scale.X) >= bullet.position.X) { if (_aspCharacter.position.X - (13 * _aspCharacter.body.scale.X) <= bullet.position.X) { if (_aspCharacter.position.Y + (20 * _aspCharacter.body.scale.Y) >= bullet.position.Y) { if (_aspCharacter.position.Y - (20 * _aspCharacter.body.scale.Y + 40 * _aspCharacter.legs.scale.Y) <= bullet.position.Y) { _aspCharacter.helth -= 10; zadetek = true; break; } } } } } itiBullet++; } //izbrisi vse zadeto iz tabel if (zadetek) { this.Game.Components.Remove(_bullets.ElementAt(itiBullet)); _bullets.RemoveAt(itiBullet); } foreach (int i in zadetiEnemyi) { this.Game.Components.Remove(_enemys.ElementAt(i)); _enemys.RemoveAt(i); } foreach (DrawScripts.AnimSprite i in dodaniPowerupi) { _powerUps.Add(i); } }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here DrawScripts.AnimSprite _spMainMenuB = new DrawScripts.AnimSprite(this.Game); _spMainMenuB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Mainmenu"); _spMainMenuB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2.7f, this.Game.GraphicsDevice.Viewport.Height - 30); _spMainMenuB.animations = new List <Rectangle>(); _spMainMenuB.animations.Add(new Rectangle(0, 0, _spMainMenuB.texture.Width, _spMainMenuB.texture.Height)); _spMainMenuB.center = new Vector2(_spMainMenuB.texture.Width / 2, _spMainMenuB.texture.Height / 2); _spMainMenuB.scale = new Vector2(0.5f, 0.5f); _spMainMenuB.currentAnim = 0; _spMainMenuB.slika = true; this.Game.Components.Add(_spMainMenuB); DrawScripts.AnimSprite _spSaveB = new DrawScripts.AnimSprite(this.Game); _spSaveB.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\Save"); _spSaveB.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 1.5f, this.Game.GraphicsDevice.Viewport.Height - 30); _spSaveB.animations = new List <Rectangle>(); _spSaveB.animations.Add(new Rectangle(0, 0, _spSaveB.texture.Width, _spSaveB.texture.Height)); _spSaveB.center = new Vector2(_spSaveB.texture.Width / 2, _spSaveB.texture.Height / 2); _spSaveB.scale = new Vector2(0.5f, 0.5f); _spSaveB.currentAnim = 0; _spSaveB.slika = true; this.Game.Components.Add(_spSaveB); DrawScripts.AnimSprite _spInputBack = new DrawScripts.AnimSprite(this.Game); _spInputBack.texture = this.Game.Content.Load <Texture2D>("Assets\\MainMenu\\InputBackGround"); _spInputBack.position = new Vector2(this.Game.GraphicsDevice.Viewport.Width / 2, this.Game.GraphicsDevice.Viewport.Height / 2); _spInputBack.animations = new List <Rectangle>(); _spInputBack.animations.Add(new Rectangle(0, 0, _spInputBack.texture.Width, _spInputBack.texture.Height)); _spInputBack.center = new Vector2(_spInputBack.texture.Width / 2, _spInputBack.texture.Height / 2); _spInputBack.scale = new Vector2(0.5f, 0.5f); _spInputBack.currentAnim = 0; _spInputBack.slika = true; this.Game.Components.Add(_spInputBack); DrawScripts.AnimSprite _EndScreenTextHeade = new DrawScripts.AnimSprite(this.Game); _EndScreenTextHeade.font = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font"); _EndScreenTextHeade.slika = false; _EndScreenTextHeade.text = " You died, \n at " + Waves + " waves. \n \n enter your name for the Leaderboard!"; _EndScreenTextHeade.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 200, 20); this.Game.Components.Add(_EndScreenTextHeade); _inputText = new DrawScripts.AnimSprite(this.Game); _inputText.font = this.Game.Content.Load <SpriteFont>("Assets\\Font\\Font"); _inputText.slika = false; _inputText.text = "";//17 max leght za ime _inputText.position = new Vector2(((int)this.Game.GraphicsDevice.Viewport.Width / 2) - 86, (this.Game.GraphicsDevice.Viewport.Height / 2) - 10); this.Game.Components.Add(_inputText); _UI = new List <DrawScripts.AnimSprite>(); _UI.Add(_spMainMenuB); _UI.Add(_spSaveB); _UI.Add(_spInputBack); _UI.Add(_EndScreenTextHeade); _UI.Add(_inputText); DrawScripts.DrawMenu _draw = new DrawScripts.DrawMenu(this.Game, _UI); this.Game.Components.Add(_draw); crke = new Dictionary <Keys, string>(); crke.Add(Keys.A, "a"); crke.Add(Keys.B, "b"); crke.Add(Keys.C, "c"); crke.Add(Keys.D, "d"); crke.Add(Keys.E, "e"); crke.Add(Keys.F, "f"); crke.Add(Keys.G, "g"); crke.Add(Keys.H, "h"); crke.Add(Keys.I, "i"); crke.Add(Keys.J, "j"); crke.Add(Keys.K, "k"); crke.Add(Keys.L, "l"); crke.Add(Keys.M, "m"); crke.Add(Keys.N, "n"); crke.Add(Keys.O, "o"); crke.Add(Keys.P, "p"); crke.Add(Keys.R, "r"); crke.Add(Keys.S, "s"); crke.Add(Keys.T, "t"); crke.Add(Keys.U, "u"); crke.Add(Keys.V, "v"); crke.Add(Keys.Z, "z"); crke.Add(Keys.Space, " "); keyStatesOld = new Dictionary <Keys, Boolean>(); keyStatesOld.Add(Keys.A, false); keyStatesOld.Add(Keys.B, false); keyStatesOld.Add(Keys.C, false); keyStatesOld.Add(Keys.D, false); keyStatesOld.Add(Keys.E, false); keyStatesOld.Add(Keys.F, false); keyStatesOld.Add(Keys.G, false); keyStatesOld.Add(Keys.H, false); keyStatesOld.Add(Keys.I, false); keyStatesOld.Add(Keys.J, false); keyStatesOld.Add(Keys.K, false); keyStatesOld.Add(Keys.L, false); keyStatesOld.Add(Keys.M, false); keyStatesOld.Add(Keys.N, false); keyStatesOld.Add(Keys.O, false); keyStatesOld.Add(Keys.P, false); keyStatesOld.Add(Keys.R, false); keyStatesOld.Add(Keys.S, false); keyStatesOld.Add(Keys.T, false); keyStatesOld.Add(Keys.U, false); keyStatesOld.Add(Keys.V, false); keyStatesOld.Add(Keys.Z, false); keyStatesOld.Add(Keys.Back, false); keyStatesOld.Add(Keys.Space, false); keyStatesNew = new Dictionary <Keys, Boolean>(); keyStatesNew.Add(Keys.A, false); keyStatesNew.Add(Keys.B, false); keyStatesNew.Add(Keys.C, false); keyStatesNew.Add(Keys.D, false); keyStatesNew.Add(Keys.E, false); keyStatesNew.Add(Keys.F, false); keyStatesNew.Add(Keys.G, false); keyStatesNew.Add(Keys.H, false); keyStatesNew.Add(Keys.I, false); keyStatesNew.Add(Keys.J, false); keyStatesNew.Add(Keys.K, false); keyStatesNew.Add(Keys.L, false); keyStatesNew.Add(Keys.M, false); keyStatesNew.Add(Keys.N, false); keyStatesNew.Add(Keys.O, false); keyStatesNew.Add(Keys.P, false); keyStatesNew.Add(Keys.R, false); keyStatesNew.Add(Keys.S, false); keyStatesNew.Add(Keys.T, false); keyStatesNew.Add(Keys.U, false); keyStatesNew.Add(Keys.V, false); keyStatesNew.Add(Keys.Z, false); keyStatesNew.Add(Keys.Back, false); keyStatesNew.Add(Keys.Space, false); this.Game.IsMouseVisible = true; base.Initialize(); }