Xna wp7 game.
At the moment, this piece of code, lets me spawn ball everytime I tap.
What I want is, not let the user tap in the same position. i.e. force him not to spam in the same position.
foreach (TouchLocation location in TouchPanel.GetState())
{
TouchLocation prevLocation;
bool prevLocationAvailable = location.TryGetPreviousLocation(out prevLocation);
if (location.State == TouchLocationState.Moved && prevLocation.State != TouchLocationState.Moved)
{
if (hitbox.Contains((int)location.Position.X, (int)location.Position.Y))
releaseBalls();
}
}
Hitbox is a rectangle which is defined as being the whole screen.
I got it solved. I have made a small rectangle with my touch positions. Then I checked if it hits my new rectangle. If not, spawn a ball. 😀