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