Skip to content

Commit

Permalink
save-system
Browse files Browse the repository at this point in the history
  • Loading branch information
arkadeepde142 committed Jan 3, 2021
1 parent 4fe6d71 commit d10e25d
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ config/name="Productathon"
run/main_scene="res://Player_s.tscn"
config/icon="res://icon.png"

[autoload]

ProgressManager="*res://scenes/ProgressManager.tscn"

[rendering]

quality/driver/driver_name="GLES2"
Expand Down
1 change: 1 addition & 0 deletions resources/accesable_miniature/science_society_12X16.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ func _ready():


func _on_Area2D_body_entered(body):
ProgressManager.save_game()
get_tree().change_scene("res://resources/accesable_miniature/Indoors/Science_socity.tscn")

4 changes: 4 additions & 0 deletions resources/characters/Player.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,7 @@ margin_left = -33.6739
margin_top = -26.9391
margin_right = -33.6739
margin_bottom = -26.9391

[node name="Camera2D" type="Camera2D" parent="."]
current = true
zoom = Vector2( 1.6, 1.6 )
4 changes: 2 additions & 2 deletions resources/script/Player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ func save() -> Dictionary:
var save_dict = {
"filename" : get_filename(),
"parent" : get_parent().get_path(),
"pos_x": position.x,
"pos_y": position.y,
"pos_x": position.x + 100,
"pos_y": position.y + 100,
}
return save_dict
# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand Down
12 changes: 11 additions & 1 deletion resources/script/dialog.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ onready var speaker = $DialogBox/box/speaker
onready var box = $DialogBox/box

export (String, FILE, "*.json") var dialogue_file_path: String
signal completed

var index = -1
var index = 0
var loadedDialogue: Dictionary

onready var dialogLoader: DialogueLoader = $DialogueLoader
Expand All @@ -31,7 +32,16 @@ func _ready() -> void:

func _on_Button_button_down() -> void:
tween.stop(dialogue)
dialogue.visible_characters = dialogue.text.length()
index += 1
if index < loadedDialogue.size():
set_state(loadedDialogue[String(index)])
process_state(state)
else:
set_visible(false)
emit_signal("completed")

func start() -> void:
set_visible(true)
set_state(loadedDialogue[String(index)])
process_state(state)

0 comments on commit d10e25d

Please sign in to comment.