Turn statistics back on for a new game and fix low winning scores
Winning turned statistics off and nothing turned them back on, while the Settings checkbox still showed them as on. Resetting points now turns them back on if the win turned them off, and the checkbox shows the current state when Settings is opened. A winning score of 1 could never be won and with 2 the first point was not announced as match point, because the first-point check ran first. The winning score also could not be kept from going below 1.
This commit is contained in:
1 parent
739d0f7af6
commit
428decf73a
6 files changed
+111
-6
No files matched your search
+8
-4
@@ -37,13 +37,17 @@ func add_point() -> void:
|
||||
if player_score < Settings.winning_score:
|
||||
player_score += 1
|
||||
player_point_given.emit()
|
||||
if player_score == 1 && is_first_point:
|
||||
var first_point: bool = player_score == 1 && is_first_point
|
||||
if player_score == 1:
|
||||
is_first_point = false
|
||||
first_point_triggerd.emit()
|
||||
# With a low winning score the first point can also be match point or the win,
|
||||
# so the more important event is checked first
|
||||
if player_score == Settings.winning_score:
|
||||
winner_triggerd.emit()
|
||||
elif player_score == Settings.winning_score - 1:
|
||||
match_point_triggerd.emit()
|
||||
elif player_score == Settings.winning_score:
|
||||
winner_triggerd.emit()
|
||||
elif first_point:
|
||||
first_point_triggerd.emit()
|
||||
else:
|
||||
point_given_sound.emit()
|
||||
|
||||
|
||||
Reference in new issue
Block a user