void spawnEnemy() { for (int i = 0; i < (rand.Next(10) + 1); i++) { CEnemy e = new CEnemy(); e.createSprite(Content, randomPosition(1000, 500), "Images/Sprites/enemy spritesheet", 2.0f, 13, 12); enemies.Add(e); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { IsMouseVisible = true; gs = gameState.gs_Menu;//start game at menu screen spriteBatch = new SpriteBatch(GraphicsDevice);// Create a new SpriteBatch, which can be used to draw textures. player.createSprite(Content, randomPosition(1000, 500), "Images/Sprites/sun", 1.0f, 13, 12); //create the player sprite for (int i = 0; i < 1000; i++) { CEnemy e = new CEnemy(); e.alive = true; e.move = new Vector2((float)rand.NextDouble() * 2 - 1, (float)rand.NextDouble() * 2 - 1); e.createSprite(Content, randomPosition(30000, 15000), "Images/Sprites/enemy spritesheet", 0.5f, 13, 8); //create an enemy e.scale = (float)rand.NextDouble() * 10 + 1; //create a random size for the enemy enemies.Add(e); //add the enemy to the enemy list } for (int i = 0; i < rand.Next(10, 100); i++) { CObject o = new CObject(); o.createSprite(Content, randomPosition(10000, 5000), "Images/Sprites/nebula sprite", 0.0f, 13, 8); //create static object statObjects.Add(o); //add object to sprite list } background = Content.Load<Texture2D>("Images/background"); //load background image bar = Content.Load<Texture2D>("Images/bar"); //load the image used for the health bar info1 = Content.Load<Texture2D>("Images/instructions page one"); info2 = Content.Load<Texture2D>("Images/instructions page two"); banner = Content.Load<Texture2D>("Images/Nebula"); credits = Content.Load<Texture2D>("Images/Credits Mockup"); barhealth = 10; //set initial health to 0 camera.init(player.m_Pos, 0.2f, 0.0f); //initalize camera audioPlayer.init(Content, "audio"); //load in the background music and play it. size = 20.0f; //set inital size to 0 debugFont = Content.Load<SpriteFont>("Font/debugFont"); //create a spritefont used for drawing text on the screen sstate.AddressU = TextureAddressMode.Mirror; //create sstate for mirroring bg image sstate.AddressV = TextureAddressMode.Mirror; //and mirror in both x and y axis }