Jump to content

  • Log In with Google      Sign In   
  • Create Account


scole127

Member Since 26 May 2013
Offline Last Active May 27 2013 03:08 AM
-----

Posts I've Made

In Topic: Help deleting an object in visual C# XNA

27 May 2013 - 01:45 AM

Thank you for helping but the problem I'm having isn't looking for a collision i have that already I just need to know how to delete the parachute or "Bullet"

 

Ok we as NightCreature said, you dont delete objects in C# if you want to remove it just set the object to null (this may cause NullReferenceExceptions) and then the garbage Collector will destroy it for you.

 

Or, if its in a List of some sort just .Remove(...) it.

Thanks you are really helping but i cant figure out how to set an object to Null


In Topic: Help deleting an object in visual C# XNA

26 May 2013 - 05:13 AM

Ok, well You want to know when a collision has occured, So im not goign todo your homework for you but i'll give you this section of code

 

 

Rectangle PlayerRectangle = new Rectangle(0,0,100,100);
List<Rectangle> BirdRectangles = new List<Rectangle>();
 
foreach(Rectangle r in BirdRectangles)
{
    if(r.Intersects(PlayerRectangle))
     { //There is a collision! }
}
 

Thank you for helping but the problem I'm having isn't looking for a collision i have that already I just need to know how to delete the parachute or "Bullet"


PARTNERS