2015-06-11 12:55:38 +00:00
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
extends Node
|
2015-06-11 12:55:38 +00:00
|
|
|
|
2015-11-21 15:13:43 +00:00
|
|
|
# Member variables
|
2015-06-11 12:55:38 +00:00
|
|
|
var points = 0
|
|
|
|
var max_points = 0
|
|
|
|
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
var f = File.new()
|
2015-11-21 15:13:43 +00:00
|
|
|
# Load high score
|
|
|
|
if (f.open("user://highscore", File.READ) == OK):
|
|
|
|
max_points = f.get_var()
|
2015-06-11 12:55:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
func game_over():
|
2015-11-21 15:13:43 +00:00
|
|
|
if (points > max_points):
|
|
|
|
max_points = points
|
|
|
|
# Save high score
|
2015-06-11 12:55:38 +00:00
|
|
|
var f = File.new()
|
2015-11-21 15:13:43 +00:00
|
|
|
f.open("user://highscore", File.WRITE)
|
2015-06-11 12:55:38 +00:00
|
|
|
f.store_var(max_points)
|