/// <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); // set up spriteDictionary spriteDictionary = new SpriteDictionary(Content); spriteDictionary.Add("exampleSprite", "Sprite/explosion"); spriteDictionary.Add("player", "Sprite/player"); spriteDictionary.Add("waterBullet", "Sprite/waterBullet"); // player player = new Player(this, spriteBatch, spriteDictionary["player"], Tools.Math.Vectors.FromPoint(Screen.Center)); Components.Add(player); player.InputTriggeredEvent += SpawnBullet; //enemies enemy = new BasicEnemy(this, spriteBatch, spriteDictionary["player"], new Vector2(Screen.Width / 2, 0)); enemy2 = new BasicEnemy(this, spriteBatch, spriteDictionary["player"], new Vector2(Screen.Width, 0)); enemy3 = new BasicEnemy(this, spriteBatch, spriteDictionary["player"], new Vector2(Screen.Width * 0.25f, 0)); enemy4 = new BasicEnemy(this, spriteBatch, spriteDictionary["player"], new Vector2(Screen.Width / 3, 0)); enemy5 = new BasicEnemy(this, spriteBatch, spriteDictionary["player"], new Vector2(Screen.Width / 1.5f, 0)); Components.Add(enemy); Components.Add(enemy2); Components.Add(enemy3); Components.Add(enemy4); Components.Add(enemy5); //Score Stuff scoreFont = Content.Load <SpriteFont>("Arial"); score = 0; scoreText = SCORE_STRING + score; scoreTextLocation = new Vector2(TEXT_OFFSET, 20); //Health Stuff healthFont = Content.Load <SpriteFont>("Arial"); healthText = HEALTH_STRING + player.Health; healthTextLocation = new Vector2(HEALTH_TEXT_OFFSET, 20); //Win and Died Screens youWin = Content.Load <Texture2D>("youWin"); youDied = Content.Load <Texture2D>("youDied"); drawRectangleWin = new Rectangle(0, 0, youWin.Width, youWin.Height); drawRectangleDied = new Rectangle(0, 0, youDied.Width, youDied.Height); // Example //example = new BasicSprite(this, spriteBatch, spriteDictionary["exampleSprite"], Tools.Math.Vectors.FromPoint(Screen.Center)); //Components.Add(example); //animation = new Animation(spriteDictionary["exampleSprite"], 5); //enemy.Origin = Tools.Math.Vectors.FromPoint(animation.AnimationRectangle.Center); //enemy.Texture = animation.Texture; //TestAnimation(); // Test destruction of outside screen items //Screen = new Rectangle(100, 100, 600, 400); //Components.OfType<BasicBullet>().ToList().ForEach(bullet => bullet.Position = Vector2.Zer0); }
/// <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); // set up spriteDictionary spriteDictionary = new SpriteDictionary(Content); spriteDictionary.Add("exampleSprite", "Sprite/explosion"); spriteDictionary.Add("player", "Sprite/player2"); spriteDictionary.Add("waterBullet", "Sprite/waterBullet"); spriteDictionary.Add("needleBullet", "Sprite/needleBullet"); spriteDictionary.Add("donutBullet", "Sprite/donutBullet"); TestTexture = Content.Load <Texture2D>("Sprite/CollisionDebugTexture"); //player player = new Player(this, spriteBatch, spriteDictionary["player"], Tools.Math.Vectors.FromPoint(Screen.Center)); Components.Add(player); player.InputTriggeredEvent += SpawnBullet; //score stuff1 scoreFont = Content.Load <SpriteFont>("Arial"); score = 0; scoreText = SCORE_STRING + score; healthText = HEALTH_STRING + player.Health; ammoText = AMMO_STRING + player.Ammo; scoreTextLocation = new Vector2(TEXT_OFFSET, 20); // spawn Rate timer spawnTimeSpan = TimeSpan.FromSeconds(6); spawnTimer = new Timer(); spawnTimer.OnExpire += () => canSpawn = true; spawnTimer.Start(spawnTimeSpan); // Example //example = new BasicSprite(this, spriteBatch, spriteDictionary["exampleSprite"], Tools.Math.Vectors.FromPoint(Screen.Center)); //Components.Add(example); //animation = new Animation(spriteDictionary["exampleSprite"], 5); //enemy.Origin = Tools.Math.Vectors.FromPoint(animation.AnimationRectangle.Center); //enemy.Texture = animation.Texture; //TestAnimation(); // Test destruction of outside screen items //Screen = new Rectangle(100, 100, 600, 400); //Components.OfType<BasicBullet>().ToList().ForEach(bullet => bullet.Position = Vector2.Zer0); }