public Boolean OverlapsPatrouille(Patrouille aPatrouille) { int w0 = this.texture.Width, h0 = this.texture.Width, w1 = aPatrouille.texture.Width, h1 = aPatrouille.texture.Height; if (this.position.X > aPatrouille.position.X + w1 || this.position.X + w0 < aPatrouille.position.X || this.position.Y > aPatrouille.position.Y + h1 || this.position.Y + h0 < aPatrouille.position.Y) { return(false); } else { return(true); } }
protected override void Initialize() { // Pass often referenced variables to Global Global.GraphicsDevice = GraphicsDevice; Global.content = Content; // Create and Initialize game objects thePlayer = new Player(); theBullet = new Bullet(); thePatrouille = new Patrouille(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); Global.spriteBatch = spriteBatch; background = Content.Load <Texture2D>("background"); scanlines = Content.Load <Texture2D>("scanlines"); CallInvader(); CallShield(); base.Initialize(); }