Ask coding questions

← Back to all posts
Creating a scoring system in Pygame - Adding points
UmarQureshi4

Hello Repl.it community,

I am creating a game for my manga comic franchise Rebound Ready, which combines basketball and Pokémon. I have created a scoring system, but every time I run the program, it shows that the variable points has already got a value of 3 when the player hasn't received any points.

How can I make it so that the variable points isn't preset to 3?

Voters
UmarQureshi4
Comments
hotnewtop
Spacecraft

It defaults to 3 points because those are the conditions you've set it at. You set points=0 on line 308, but then immediately change it to 3 in the IF statement on lines 311 and 312. blRecOri is set to 0 on line 300:

Then you use an IF statement on lines 311, 312 to change points to 3 if blRecOri meets the conditions. Since 0 passes both conditions in the IF statement, it passes:

If you don't want to have points immediately changed to 3, you'll need to change the conditions of your IF statement so it doesn't include 0:

UmarQureshi4

@Spacecraft How would I accomplish that?