1

I'm having a problem with an if statement which has an or in it as well. I am essentially trying to have it so that if either of the player's score is 50, the game ends. I'm trying to have my code saying something like this:

if ball.score2 or ball.score1 == 50: 
    EndGame()

However, when I have this, as soon as the thing which ups ball.score2 (but this only happens for whichever one is first in the if statement, so here it does not do it if ball.score1 is upped) happens, and it is meant to be upped by 5, it runs the EndGame(). They work individually, so if I have:

if ball.score2 == 50:
     EndGame()

It will end the game when ball.score2 gets to 50, but not when I use them both like in the first example. Could someone help?

skamsie
  • 2,614
  • 5
  • 36
  • 48
  • Yeah your right that one solves the problem - sorry, didn't see it when i looked –  Apr 01 '14 at 20:02

1 Answers1

2

You need to check the equality of each scores:

if ball.score2 == 50 or ball.score == 50:
    EndGame()
Chris Arena
  • 1,602
  • 15
  • 17