Run once inside of box
in
Programming Questions
•
3 months ago
I'm new to Processing, and I'm trying to create a simple game.
When a shape enters a box, I want the player to earn +5 points. So, I set the parameters:
When a shape enters a box, I want the player to earn +5 points. So, I set the parameters:
int points = 0
//scoring
if (x > 225 && x < 255 && y > 225 && y < 125){
points = points +5;
}
However, the way it's set now, it doesn't just add +5 once. Instead, it adds it the entire time the shape is inside the box. So, it adds +5 over and over again. I understand why its happening, but I'm not sure how to fix it. Any help on only running through the script one time and only adding the points once?
Thanks for any help.
1