How to keep/check a score?
Posted: Sat Jan 20, 2018 12:14 am
Apologies if this has been asked before, but if it has I can't find it.
So, what I'm trying to do is assign a score that starts at 0, goes up (and potentially down) depending on which choices the player makes, and then at certain points in the story what happens next depends on how the score compares to other numbers. My eventual goal is to have several such scores that get compared to each other to judge what the player is prioritizing. But I don't know the right code to make even a single score work.
What I have now is this before the start:
default score = 0
And this after the player makes a choice that will increase the score:
$ score += 1
And this when I want to check the score:
if score < 0:
"You scored some points!"
else:
"You didn't score any points!"
But when I playtest the game, it gives me the "You didn't score any points!" text even when I made the choice to increase the score. Can someone explain what I'm doing wrong? I know very little Python so please state your answer as simply as possible.
So, what I'm trying to do is assign a score that starts at 0, goes up (and potentially down) depending on which choices the player makes, and then at certain points in the story what happens next depends on how the score compares to other numbers. My eventual goal is to have several such scores that get compared to each other to judge what the player is prioritizing. But I don't know the right code to make even a single score work.
What I have now is this before the start:
default score = 0
And this after the player makes a choice that will increase the score:
$ score += 1
And this when I want to check the score:
if score < 0:
"You scored some points!"
else:
"You didn't score any points!"
But when I playtest the game, it gives me the "You didn't score any points!" text even when I made the choice to increase the score. Can someone explain what I'm doing wrong? I know very little Python so please state your answer as simply as possible.