summaryrefslogtreecommitdiff
path: root/demos/2d/space_shooter/game_state.gd
blob: 26ef086f14c4004531b87a96351f8c2720fcf8e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extends Node


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()



func game_over():
	if (points>max_points):
		max_points=points
		#save high score
		var f = File.new()
		f.open("user://highscore",File.WRITE)
		f.store_var(max_points)