public void CheckCollisions(ref Player player1) { foreach (Projectile pro in m_lstProjectiles) { pro.CheckCollisions(ref player1); } }
public void CheckCollisions(ref Player player1) { if (Bounds.Intersects(player1.Bounds)) { player1.Kill(); } }
/// <summary> /// Loads the content. /// </summary> /// <param name="Content">The content.</param> /// <param name="sprBatch">The SPR batch.</param> public override void LoadContent(ContentManager Content, SpriteBatch sprBatch) { m_sprBatch = sprBatch; m_bFirstLaunch = true; Texture2D texTemp = Content.Load<Texture2D>("Avoider/Graphics/spritesheet"); m_texEnemy = Content.Load<Texture2D>("Avoider/Graphics/Devil"); m_texBackground = Content.Load<Texture2D>("Avoider/Graphics/background2"); m_sprFont = Content.Load<SpriteFont>("Avoider/Fonts/SpriteFont1"); m_player1 = new Player(new Vector2((272/2),480-30-texTemp.Height), texTemp); m_lstProjectileTextures = new List<Texture2D>(); m_texOverLay = Content.Load<Texture2D>("Avoider/Graphics/menu"); m_player1.ScreamSound = Content.Load<SoundEffect>("Avoider/Sounds/Scream"); m_sndThrow = Content.Load<SoundEffect>("Avoider/Sounds/Throw"); m_texCursor = Content.Load<Texture2D>("Falldown/Textures/cursor"); m_texBackArrow = Content.Load<Texture2D>("Falldown/Textures/arrow"); m_recBackArrow = new Rectangle(0, 480 - 50, 50, 50); MediaPlayer.IsRepeating = true; MediaPlayer.Play(Content.Load<Song>("Avoider/Sounds/SantellosEscapeAvoider")); for (int index = 0; index < NUM_PROJECTILE_TEXTURES; index++) { m_lstProjectileTextures.Add(Content.Load<Texture2D>("Avoider/Projectiles/" + index.ToString())); // lstProjectileTextures[index] = Content.Load<Texture2D>("Avoider/Projectiles/" + index.ToString()); } AddEnemy(); base.LoadContent(Content, sprBatch); }