public GameOverScreen(Game1 game, SpriteBatch spriteBatch, AnimatedSprite Sp) { this.game = game; this.spriteBatch = spriteBatch; this.Sprite = Sp; spriteFont = game.Content.Load<SpriteFont>("menufont"); image = game.Content.Load<Texture2D>("blood"); string[] menuItems = { "Restart Game", "End Game" }; menuComponent = new MenuComponent(game, spriteBatch, spriteFont, menuItems); game.Components.Add(menuComponent); imageRec = new Rectangle(0, 0, game.Window.ClientBounds.Width, game.Window.ClientBounds.Height); // Start Bat placement into list rand = new Random(); for (int i = 0; i < 60; i++) { Bat b = new Bat(game, spriteBatch, Sprite); b.Position = new Vector2(400 + (float)(-50 + rand.NextDouble() * 100), 200 + (float)(-50 + rand.NextDouble() * 100)); b.speed = 20f + (float)rand.NextDouble() * 40.0f; ListOBats.Add(b); game.Components.Add(b); } for (int j = 0; j < 60; j++) { ListOBats[j].batList = ListOBats; } // end bat placement into list }
public Bat(Game g, SpriteBatch sb, AnimatedSprite asp) : base(g) { spriteBatch = sb; Sprite = asp; Position = Vector2.Zero; speed = 50000; game = g; rand = new Random(); }
/// <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); Sprite = new AnimatedSprite(Content.Load<Texture2D>("Bat"), 1, 32, 31); startScreen = new StartScreen(this, this.SpriteBatch); activeScreen = Screen.StartScreen; base.LoadContent(); // TODO: use this.Content to load your game content here }