summaryrefslogtreecommitdiff
path: root/demos/2d/space_shooter/game_state.gd
diff options
context:
space:
mode:
Diffstat (limited to 'demos/2d/space_shooter/game_state.gd')
-rw-r--r--demos/2d/space_shooter/game_state.gd20
1 files changed, 9 insertions, 11 deletions
diff --git a/demos/2d/space_shooter/game_state.gd b/demos/2d/space_shooter/game_state.gd
index f66d0fa8fa..0aa5e1f42b 100644
--- a/demos/2d/space_shooter/game_state.gd
+++ b/demos/2d/space_shooter/game_state.gd
@@ -1,24 +1,22 @@
-extends Node
+extends Node
+# Member variables
var points = 0
var max_points = 0
func _ready():
var f = File.new()
- #load high score
-
- if (f.open("user://highscore",File.READ)==OK):
-
- max_points=f.get_var()
+ # Load high score
+ if (f.open("user://highscore", File.READ) == OK):
+ max_points = f.get_var()
func game_over():
- if (points>max_points):
- max_points=points
- #save high score
+ if (points > max_points):
+ max_points = points
+ # Save high score
var f = File.new()
- f.open("user://highscore",File.WRITE)
+ f.open("user://highscore", File.WRITE)
f.store_var(max_points)
- \ No newline at end of file