private void InitPlayState() { player1.ClearScore(); if (player1.Lives == 0) { player1 = new DefaultPlayer(TextureManager.Instance.GetTexture("DefaultPlayer"), new Vector2(300, 300)); ResourceManager.Instance.AddPlayer(player1); player1.ScaleSize((decimal)0.5); MobSpawner.Instance.Reset(); MobSpawner.Instance.SetSpawnerMode(SpawnerMode.Constant); } try { MediaPlayer.Play(song); } catch { MediaPlayer.Play(song); } MediaPlayer.IsRepeating = true; }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); fontRenderer = new FontRenderer(Content, "Times New Roman"); TextureManager.Instance.AddTexture("DefaultPlayer", Content.Load<Texture2D>("player2.png")); TextureManager.Instance.AddTexture("DefaultEnemy", Content.Load<Texture2D>("newEnemy1.png")); TextureManager.Instance.AddTexture("TriangleEnemy", Content.Load<Texture2D>("newEnemy3.png")); TextureManager.Instance.AddTexture("DefaultProjectile", Content.Load<Texture2D>("bulletFull.png")); TextureManager.Instance.AddTexture("PlayerProjectile", Content.Load<Texture2D>("playerBulletFull.png")); TextureManager.Instance.AddTexture("MissileDroppable", Content.Load<Texture2D>("missileUpgrade.png")); TextureManager.Instance.AddTexture("GunDroppable", Content.Load<Texture2D>("gunUpgrade.png")); TextureManager.Instance.AddTexture("ScoreDroppable", Content.Load<Texture2D>("scoreUpgrade.png")); TextureManager.Instance.AddTexture("DefaultMissile", Content.Load<Texture2D>("missileFull.png")); TextureManager.Instance.AddTexture("HunterEnemy", Content.Load<Texture2D>("newEnemy2.png")); TextureManager.Instance.AddTexture("Background", Content.Load<Texture2D>("bg.png")); backgroundTexture = TextureManager.Instance.GetTexture("Background"); song = Content.Load<Song>("597237_Lets-Fight-Loop"); titleTexture = Content.Load<Texture2D>("title.png"); menuSelectionTexture = TextureManager.Instance.GetTexture("DefaultPlayer"); //Texture2D hitboxTexture = new Texture2D(GraphicsDevice, 1, 1); //hitboxTexture.SetData(new Color[] { Color.Red }); TextureManager.Instance.AddTexture("Hitbox", TextureManager.Instance.createCircleText(GraphicsDevice, 40, Color.Red)); player1 = new DefaultPlayer(TextureManager.Instance.GetTexture("DefaultPlayer"), new Vector2(300, 300)); //projectile1 = new DefaultProjectile(TextureManager.Instance.GetTexture("DefaultProjectile"), new Vector2(200, 200), new Vector2(0, 120), 3); ResourceManager.Instance.AddPlayer(player1); //ResourceManager.Instance.AddProjectile(projectile1); player1.ScaleSize((decimal)0.5); //enemy1.ScaleSize((decimal)2); //projectile1.ScaleSize((decimal)0.5); //HACK: pretty jank way of getting the MobSpawner singleton to instantiate itself MobSpawner.Instance.GetType(); MobSpawner.Instance.SetSpawnerMode(SpawnerMode.Constant); // TODO: use this.Content to load your game content here }