sources
This commit is contained in:
parent
41e9c5a685
commit
61bba2b17a
BIN
images/icon.png
BIN
images/icon.png
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 164 B |
@ -16,7 +16,7 @@ func start() -> void:
|
||||
|
||||
func load_dialogue(file_path) -> Array:
|
||||
var file = File.new()
|
||||
assert (file.file_exists(file_path))
|
||||
# assert (file.file_exists(file_path))
|
||||
|
||||
file.open(file_path, file.READ)
|
||||
var dialogue = parse_json(file.get_as_text())
|
||||
|
@ -3,3 +3,20 @@ extends Node
|
||||
var ui_accept_tip = false
|
||||
var ui_interact_flatfish_tip = false
|
||||
var did_already_play_once = false
|
||||
|
||||
func save_game():
|
||||
var file = File.new()
|
||||
file.open('user://globals.save', File.WRITE)
|
||||
file.store_line('1' if did_already_play_once else '0')
|
||||
file.close()
|
||||
print('saved')
|
||||
|
||||
func load_game():
|
||||
var file = File.new()
|
||||
if not file.file_exists("user://savegame.save"):
|
||||
return
|
||||
|
||||
file.open('user://globals.save', File.READ)
|
||||
var d = file.get_line()
|
||||
did_already_play_once = true if d == '1' else false
|
||||
print('loaded')
|
||||
|
@ -9,9 +9,9 @@ var previous_tracks : Array
|
||||
func play(music, offset=0, duration=1):
|
||||
print('Play music: ' + music)
|
||||
var path = "res://sounds/" + music + ".ogg"
|
||||
if !File.new().file_exists(path):
|
||||
path = "res://sounds/" + music
|
||||
assert(File.new().file_exists(path))
|
||||
# if !File.new().file_exists(path):
|
||||
# path = "res://sounds/" + music
|
||||
# assert(File.new().file_exists(path))
|
||||
var stream = load(path)
|
||||
|
||||
target_track = get_free_track()
|
||||
|
@ -1,7 +1,10 @@
|
||||
extends Node2D
|
||||
|
||||
|
||||
func _ready():
|
||||
Globals.did_already_play_once = true
|
||||
Globals.save_game()
|
||||
|
||||
func _input(event):
|
||||
if event.is_action_pressed("ui_accept"):
|
||||
Globals.did_already_play_once = true
|
||||
get_tree().change_scene("res://scenes/main_menu.tscn")
|
||||
|
@ -4,5 +4,6 @@ onready var music_player = get_node('/root/MusicPlayer') as MusicPlayer
|
||||
|
||||
func _ready():
|
||||
music_player.play('main_title')
|
||||
Globals.load_game()
|
||||
if Globals.did_already_play_once:
|
||||
$UI/Buttons/AnotherChoiceButton.show()
|
||||
|
Loading…
Reference in New Issue
Block a user