I am coding a base game. The player collects a gem by touching it; this adds +1 to his score. A gem is an image, and I want to get rid of it as soon as it is assembled.
As far as I know, this is not possible, but there may be a hacker solution. Here is my code - I will continue to study and study this in the mean time. If anyone can help, I would really appreciate it!
if (player.Bounds.IntersectsWith(gem.Bounds))
{
points += 1;
points_lbl.Text = points.ToString();
}
It works. However, the gem remains on the screen - so the player gets endless points.
I tried gem.Dispose (); but it just “hides” the image, so the collision still works. gem = null; game crash. No XNA, please.
multipack1
source
share