updated amount of distance camera drops

changed refs in Game.gd to use the variables from GlobalVars
added more vars into GlobalVars
added a rudimentary save and load function into GlobalVars
master
Zac 4 years ago
parent edfe7972dc
commit 5bf4e1d44c
  1. 1
      Game.tscn
  2. 2
      scenes/Store.tscn
  3. 2
      scripts/BreakableObj.gd
  4. 5
      scripts/Game.gd
  5. 29
      scripts/singletons/GlobalVars.gd

@ -102,6 +102,7 @@ playback/speed = 1.0
[node name="TopBoard" type="Position2D" parent="." index="4"]
pause_mode = 2
editor/display_folded = true
position = Vector2( 300, 480 )
_sections_unfolded = [ "Pause" ]

@ -2,7 +2,7 @@
[ext_resource path="res://scripts/Store.gd" type="Script" id=1]
[node name="Store" type="Control" index="0"]
[node name="Store" type="Control"]
anchor_left = 0.0
anchor_top = 0.0

@ -30,7 +30,7 @@ func _on_ClickerArea_input_event(viewport, event, shape_idx):
spr.set_texture(textures[1])
$"../Tween".interpolate_property(self, "position", position,
$"..".to_local(to_global(Singleton.FinalPoint.position)), .16,
$"..".to_local(to_global(Singleton.FinalPoint.position)), .14,
Tween.TRANS_LINEAR, Tween.EASE_IN)
$"../Tween".start()

@ -9,7 +9,7 @@ var board_obj = preload("res://scenes/BreakableObj.tscn")
var wood_plank = preload("res://Sprites/Plank.png")
export var board_cnt = 1
export var time_limit = 5.0
export(float) var time_limit = GlobalVars.TimeLimit
var current_time = 0
var can_tap = true
var taps = 0
@ -59,9 +59,6 @@ func tapped(last = false):
update_labels()
can_tap = not last
# if last:
# can_tap = false
# emit_signal("round_over")
func update_labels():
if can_tap:

@ -1,9 +1,36 @@
extends Node
var TimeLimit = 5.0
var Points = 0
var StorePurchases = 0 setget apply_purchase
const SaveFile = "user://game.save" # the path to the save file
const SavePass = "asdf1234" # in case we start encrypting these saves
func save_data():
pass
var file = File.new()
file.open(SaveFile, File.WRITE)
var data = {
'current_points': Points,
'purchases': StorePurchases,
}
file.store_line(to_json(data))
file.close()
func load_data():
var file = File.new()
if not file.file_exists(SaveFile):
return
file.open(SaveFile, File.READ)
var save_dict = parse_json(file.get_line())
file.close()
Points = save_dict['current_points']
StorePurchases = save_dict['purchases']
func apply_purchase(p):
print(p)
pass
Loading…
Cancel
Save