Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
luanpotter committed Jul 3, 2023
1 parent d8b9084 commit 351b267
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/firebase/scores.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,14 @@ class Scores {
final document =
firestore.collection('scores').document(playerId.toString());
if (await document.exists) {
print('Updating score for player id $playerId to $score.');
await document.update({'score': score});
final current = await document.get();
final currentScore = Score.fromDocument(current).score;
final newScore = currentScore + score;
print(
'Updating score for player id $playerId '
'from $currentScore to $newScore.',
);
await document.update({'score': newScore});
} else {
print('Error: Score not found for player id $playerId.');
}
Expand Down
2 changes: 1 addition & 1 deletion lib/game/components/count_down.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:flutter/painting.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:lightrunners/ui/ui.dart';

const _matchLength = 20.0;
const _matchLength = 60.0;
const _radius = Radius.circular(3.0);

class CountDown extends PositionComponent {
Expand Down

0 comments on commit 351b267

Please sign in to comment.