Compare commits
3 Commits
135817c8af
...
14427f14d0
| Author | SHA1 | Date | |
|---|---|---|---|
| 14427f14d0 | |||
| 5ffc359cba | |||
| b01f4ed027 |
@ -1,8 +1,8 @@
|
|||||||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||||
|
|
||||||
[sub_resource type="DynamicFontData" id=12]
|
[sub_resource type="DynamicFontData" id=14]
|
||||||
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
size = 8
|
size = 8
|
||||||
font_data = SubResource( 12 )
|
font_data = SubResource( 14 )
|
||||||
|
|||||||
@ -329,7 +329,7 @@ threads/thread_model=2
|
|||||||
gles3/shaders/shader_compilation_mode=2
|
gles3/shaders/shader_compilation_mode=2
|
||||||
quality/depth/hdr=false
|
quality/depth/hdr=false
|
||||||
environment/default_environment="res://default_env.tres"
|
environment/default_environment="res://default_env.tres"
|
||||||
environment/2d/use_nvidia_rect_flicker_workaround=true
|
environment/2d/use_nvidia_rect_flicker_workaround=false
|
||||||
environment/stretch/aspect="ignore"
|
environment/stretch/aspect="ignore"
|
||||||
environment/intended_usage/framebuffer_allocation.mobile=0
|
environment/intended_usage/framebuffer_allocation.mobile=0
|
||||||
|
|
||||||
|
|||||||
@ -4575,7 +4575,7 @@ unique_name_in_owner = true
|
|||||||
position = Vector2( -12, 0 )
|
position = Vector2( -12, 0 )
|
||||||
enabled = true
|
enabled = true
|
||||||
cast_to = Vector2( 0, 32 )
|
cast_to = Vector2( 0, 32 )
|
||||||
collision_mask = 8
|
collision_mask = 152
|
||||||
|
|
||||||
[node name="SlopeRaycastLeft" type="RayCast2D" parent="."]
|
[node name="SlopeRaycastLeft" type="RayCast2D" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
@ -4623,5 +4623,5 @@ one_shot = true
|
|||||||
[connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"]
|
[connection signal="timeout" from="BlobbyStateMachine/JumpBufferTimer" to="BlobbyStateMachine" method="_on_JumpBufferTimer_timeout"]
|
||||||
[connection signal="timeout" from="BlobbyStateMachine/CrushTimer" to="." method="_on_CrushTimer_timeout"]
|
[connection signal="timeout" from="BlobbyStateMachine/CrushTimer" to="." method="_on_CrushTimer_timeout"]
|
||||||
[connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"]
|
[connection signal="timeout" from="InvincibilityTimer" to="." method="_on_InvincibilityTimer_timeout"]
|
||||||
[connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"]
|
|
||||||
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real" binds= [ -1 ]]
|
[connection signal="timeout" from="PitfallTimer" to="." method="die_for_real" binds= [ -1 ]]
|
||||||
|
[connection signal="timeout" from="PitfallTimer" to="." method="_on_PitfallTimer_timeout"]
|
||||||
|
|||||||
@ -31,7 +31,7 @@ func load_sounds() -> void:
|
|||||||
|
|
||||||
func set_progress(value) -> void:
|
func set_progress(value) -> void:
|
||||||
gsr.progress_dict = value
|
gsr.progress_dict = value
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func get_progress() -> Dictionary:
|
func get_progress() -> Dictionary:
|
||||||
@ -41,6 +41,7 @@ func get_progress() -> Dictionary:
|
|||||||
func save() -> void:
|
func save() -> void:
|
||||||
SaveManager.save_default()
|
SaveManager.save_default()
|
||||||
|
|
||||||
|
|
||||||
# Returns if the level was completed or not
|
# Returns if the level was completed or not
|
||||||
func get_level_completed(level_name: String) -> bool:
|
func get_level_completed(level_name: String) -> bool:
|
||||||
if gsr.progress_dict.has(level_name) && gsr.progress_dict[level_name].has("levelcompleted"):
|
if gsr.progress_dict.has(level_name) && gsr.progress_dict[level_name].has("levelcompleted"):
|
||||||
@ -53,14 +54,14 @@ func set_level_completed(level_name: String, state: bool) -> void:
|
|||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
gsr.progress_dict[level_name] = {}
|
gsr.progress_dict[level_name] = {}
|
||||||
gsr.progress_dict[level_name]["levelcompleted"] = state
|
gsr.progress_dict[level_name]["levelcompleted"] = state
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func set_leveltime(level_name: String, time: float) -> void:
|
func set_level_time(level_name: String, time: float) -> void:
|
||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
gsr.progress_dict[level_name] = {}
|
gsr.progress_dict[level_name] = {}
|
||||||
gsr.progress_dict[level_name]["leveltime"] = time
|
gsr.progress_dict[level_name]["leveltime"] = time
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func get_level_time(level_name: String) -> float:
|
func get_level_time(level_name: String) -> float:
|
||||||
@ -74,7 +75,7 @@ func set_uncompleted_level_time(level_name: String, time: float) -> void:
|
|||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
gsr.progress_dict[level_name] = {}
|
gsr.progress_dict[level_name] = {}
|
||||||
gsr.progress_dict[level_name]["uncompletedleveltime"] = time
|
gsr.progress_dict[level_name]["uncompletedleveltime"] = time
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func get_uncompleted_level_time(level_name: String) -> float:
|
func get_uncompleted_level_time(level_name: String) -> float:
|
||||||
@ -90,28 +91,29 @@ func set_savepoint(level_name: String, position: Vector2) -> void:
|
|||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
gsr.progress_dict[level_name] = {}
|
gsr.progress_dict[level_name] = {}
|
||||||
gsr.progress_dict[level_name]["savepoint"] = position
|
gsr.progress_dict[level_name]["savepoint"] = position
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func set_level_state(level_name: String, property_dict: Dictionary) -> void:
|
func set_level_state(level_name: String, property_dict: Dictionary) -> void:
|
||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
gsr.progress_dict[level_name] = {}
|
gsr.progress_dict[level_name] = {}
|
||||||
gsr.progress_dict[level_name]["savestate"] = property_dict
|
gsr.progress_dict[level_name]["savestate"] = property_dict
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func remove_savepoint(level_name: String) -> void:
|
func remove_savepoint(level_name: String) -> void:
|
||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
return
|
return
|
||||||
gsr.progress_dict[level_name].erase("savepoint")
|
gsr.progress_dict[level_name].erase("savepoint")
|
||||||
|
gsr.progress_dict[level_name].erase("currency")
|
||||||
gsr.progress_dict[level_name].erase("uncompletedleveltime")
|
gsr.progress_dict[level_name].erase("uncompletedleveltime")
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
func remove_savestate(level_name: String) -> void:
|
func remove_savestate(level_name: String) -> void:
|
||||||
if !gsr.progress_dict.has(level_name):
|
if !gsr.progress_dict.has(level_name):
|
||||||
return
|
return
|
||||||
gsr.progress_dict[level_name].erase("savestate")
|
gsr.progress_dict[level_name].erase("savestate")
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
|
|
||||||
func get_property_value(level_name: String, propertyName: String) -> int:
|
func get_property_value(level_name: String, propertyName: String) -> int:
|
||||||
@ -149,14 +151,14 @@ func touch_level(level_name: String) -> void:
|
|||||||
# TODO This is permanent immediatly
|
# TODO This is permanent immediatly
|
||||||
func set_wallet(value) -> void:
|
func set_wallet(value) -> void:
|
||||||
gsr.wallet = value
|
gsr.wallet = value
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
func get_wallet() -> int:
|
func get_wallet() -> int:
|
||||||
return gsr.wallet
|
return gsr.wallet
|
||||||
|
|
||||||
func set_swaying_grass(value: bool) -> void:
|
func set_swaying_grass(value: bool) -> void:
|
||||||
gsr.swaying_grass = value
|
gsr.swaying_grass = value
|
||||||
SaveManager.save_default()
|
save()
|
||||||
|
|
||||||
func get_swaying_grass() -> bool:
|
func get_swaying_grass() -> bool:
|
||||||
return gsr.swaying_grass
|
return gsr.swaying_grass
|
||||||
|
|||||||
@ -9,20 +9,17 @@ export var currencyValue := 1
|
|||||||
export var coin_3D_fps := 30
|
export var coin_3D_fps := 30
|
||||||
|
|
||||||
var last_draw_time := 0
|
var last_draw_time := 0
|
||||||
var scene_saved_id := 0
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scene_saved_id = level_state.register_saveable_object(self)
|
level_state.register_saveable_node(self)
|
||||||
var collected_saved = level_state.get_saved_object_property(scene_saved_id, "was_collected")
|
var collected_saved = level_state.get_saved_node_property(self, "was_collected")
|
||||||
|
|
||||||
if collected_saved != null:
|
if collected_saved != null:
|
||||||
was_collected = collected_saved
|
was_collected = collected_saved
|
||||||
|
|
||||||
if was_collected:
|
if was_collected:
|
||||||
visible = false
|
visible = false
|
||||||
level_state.set_currency(level_state.get_currency() + currencyValue)
|
|
||||||
return
|
|
||||||
|
|
||||||
func _physics_process(delta: float) -> void:
|
func _physics_process(delta: float) -> void:
|
||||||
if !visible || proto_coin == null:
|
if !visible || proto_coin == null:
|
||||||
|
|||||||
@ -15,10 +15,10 @@ var scene_saved_id := 0
|
|||||||
var activatable = true
|
var activatable = true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scene_saved_id = level_state.register_saveable_object(self)
|
level_state.register_saveable_node(self)
|
||||||
var activated_saved = level_state.get_saved_object_property(scene_saved_id, "activated")
|
var activated_saved = level_state.get_saved_node_property(self, "activated")
|
||||||
|
|
||||||
if activated_saved != null:
|
if level_state.savepoint_loaded && activated_saved != null:
|
||||||
activated = activated_saved
|
activated = activated_saved
|
||||||
$Digit.frame = frog_number
|
$Digit.frame = frog_number
|
||||||
if activated:
|
if activated:
|
||||||
|
|||||||
@ -8,14 +8,13 @@ onready var unactivatable_timer := $Timer
|
|||||||
|
|
||||||
export onready var activated := false
|
export onready var activated := false
|
||||||
|
|
||||||
var scene_saved_id := 0
|
|
||||||
var activatable := true
|
var activatable := true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
scene_saved_id = level_state.register_saveable_object(self)
|
level_state.register_saveable_node(self)
|
||||||
var activated_saved = level_state.get_saved_object_property(scene_saved_id, "activated")
|
var activated_saved = level_state.get_saved_node_property(self, "activated")
|
||||||
|
|
||||||
if activated_saved != null:
|
if level_state.savepoint_loaded && activated_saved != null:
|
||||||
activated = activated_saved
|
activated = activated_saved
|
||||||
|
|
||||||
signal_manager.connect("unlocked", self, "receive_unlock")
|
signal_manager.connect("unlocked", self, "receive_unlock")
|
||||||
|
|||||||
@ -9,14 +9,13 @@ onready var unactivatable_timer := $Timer
|
|||||||
export onready var activated := false
|
export onready var activated := false
|
||||||
export var cost := 3
|
export var cost := 3
|
||||||
|
|
||||||
var scene_saved_id := 0
|
|
||||||
var activatable = false
|
var activatable = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
scene_saved_id = level_state.register_saveable_object(self)
|
level_state.register_saveable_node(self)
|
||||||
var activated_saved = level_state.get_saved_object_property(scene_saved_id, "activated")
|
var activated_saved = level_state.get_saved_node_property(self, "activated")
|
||||||
|
|
||||||
if activated_saved != null:
|
if level_state.savepoint_loaded && activated_saved != null:
|
||||||
activated = activated_saved
|
activated = activated_saved
|
||||||
|
|
||||||
$Sprite.frame = 0
|
$Sprite.frame = 0
|
||||||
|
|||||||
@ -104,7 +104,7 @@ func grass_wave_update(delta: float) -> void:
|
|||||||
$Timer.stop()
|
$Timer.stop()
|
||||||
is_idle_swinging = true
|
is_idle_swinging = true
|
||||||
var start = displacement_coeff.x if begin_idle else 0.0
|
var start = displacement_coeff.x if begin_idle else 0.0
|
||||||
displacement_coeff.x = start * exp(-0.2 * (time-start_swing_time)) + 0.3 * -sin(2.0*(time - start_swing_time))
|
displacement_coeff.x = start * exp(-0.2 * (time-start_swing_time)) + 0.5 * -sin(2.0*(time - start_swing_time))
|
||||||
begin_idle = false
|
begin_idle = false
|
||||||
# if(displacement_coeff.x > saved_coeff):
|
# if(displacement_coeff.x > saved_coeff):
|
||||||
# print(displacement_coeff.x)
|
# print(displacement_coeff.x)
|
||||||
|
|||||||
@ -7,14 +7,13 @@ export onready var is_armed = false
|
|||||||
|
|
||||||
var trigger_zone_entered: bool = false
|
var trigger_zone_entered: bool = false
|
||||||
|
|
||||||
var scene_saved_id := 0
|
|
||||||
var activatable = false
|
var activatable = false
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
scene_saved_id = level_state.register_saveable_object(self)
|
level_state.register_saveable_node(self)
|
||||||
var is_armed_saved = level_state.get_saved_object_property(scene_saved_id, "is_armed")
|
var is_armed_saved = level_state.get_saved_node_property(self, "is_armed")
|
||||||
|
|
||||||
if is_armed_saved != null:
|
if level_state.savepoint_loaded && is_armed_saved != null:
|
||||||
is_armed = is_armed_saved
|
is_armed = is_armed_saved
|
||||||
|
|
||||||
if(!is_armed):
|
if(!is_armed):
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
extends AudibleButton
|
extends AudibleButton
|
||||||
|
|
||||||
onready var level_state := get_tree().root.get_child(4).get_node("%LevelState")
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
if !GlobalState.get_savepoint(level_state.level_name):
|
|
||||||
visible = false
|
|
||||||
|
|
||||||
func _on_button_up() -> void:
|
func _on_button_up() -> void:
|
||||||
get_tree().paused = false
|
get_tree().paused = false
|
||||||
get_tree().reload_current_scene()
|
get_tree().reload_current_scene()
|
||||||
|
|||||||
@ -36,9 +36,9 @@ func _zoom_timer() -> void:
|
|||||||
|
|
||||||
|
|
||||||
func update_interface() -> void:
|
func update_interface() -> void:
|
||||||
var wallet = GlobalState.gsr.wallet
|
var wallet: int = 0
|
||||||
if level_state != null:
|
if level_state != null:
|
||||||
wallet += level_state.currency
|
wallet = level_state.check_balance()
|
||||||
|
|
||||||
currency.text = "Orbs: %s" % wallet
|
currency.text = "savings: %s" % wallet
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=10 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=1]
|
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=1]
|
||||||
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=2]
|
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=2]
|
||||||
@ -55,6 +55,13 @@ tracks/0/keys = {
|
|||||||
"values": [ Color( 0, 0, 0, 0 ), Color( 1, 0, 0, 0.117647 ) ]
|
"values": [ Color( 0, 0, 0, 0 ), Color( 1, 0, 0, 0.117647 ) ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFontData" id=14]
|
||||||
|
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=15]
|
||||||
|
size = 12
|
||||||
|
font_data = SubResource( 14 )
|
||||||
|
|
||||||
[node name="HUD" type="Control"]
|
[node name="HUD" type="Control"]
|
||||||
pause_mode = 1
|
pause_mode = 1
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -116,11 +123,11 @@ anims/Redlight = SubResource( 2 )
|
|||||||
|
|
||||||
[node name="Currency" type="Label" parent="."]
|
[node name="Currency" type="Label" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
|
||||||
anchor_top = 1.0
|
anchor_top = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
margin_left = 9.0
|
margin_left = 9.0
|
||||||
margin_top = -21.0
|
margin_top = -21.0
|
||||||
margin_right = 253.0
|
margin_right = 253.0
|
||||||
rect_scale = Vector2( 0.590909, 0.627907 )
|
rect_scale = Vector2( 0.590909, 0.627907 )
|
||||||
|
custom_fonts/font = SubResource( 15 )
|
||||||
text = "Orbs: 100000000000000000"
|
text = "Orbs: 100000000000000000"
|
||||||
|
|||||||
@ -61,7 +61,10 @@ func set_paused(value: bool) -> void:
|
|||||||
pause_overlay.visible = value
|
pause_overlay.visible = value
|
||||||
if value == true:
|
if value == true:
|
||||||
$"%Continue".grab_focus()
|
$"%Continue".grab_focus()
|
||||||
|
if !GlobalState.get_savepoint(level_state.level_name):
|
||||||
|
$"%RetryCheckpoint".visible = false
|
||||||
|
else:
|
||||||
|
$"%RetryCheckpoint".visible = true
|
||||||
|
|
||||||
func _on_Controls_button_up() -> void:
|
func _on_Controls_button_up() -> void:
|
||||||
$ControlsMenu.visible = true
|
$ControlsMenu.visible = true
|
||||||
|
|||||||
@ -866,11 +866,6 @@ anchor_bottom = 1.0
|
|||||||
texture = SubResource( 14 )
|
texture = SubResource( 14 )
|
||||||
expand = true
|
expand = true
|
||||||
|
|
||||||
[node name="Title" type="Label" parent="PauseOverlay"]
|
|
||||||
margin_right = 170.0
|
|
||||||
margin_bottom = 45.0
|
|
||||||
text = "Blobby, The"
|
|
||||||
|
|
||||||
[node name="Panel" type="Panel" parent="PauseOverlay"]
|
[node name="Panel" type="Panel" parent="PauseOverlay"]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
@ -924,6 +919,7 @@ text = "Audio"
|
|||||||
script = ExtResource( 23 )
|
script = ExtResource( 23 )
|
||||||
|
|
||||||
[node name="RetryCheckpoint" parent="PauseOverlay/Panel/VBoxContainer" instance=ExtResource( 4 )]
|
[node name="RetryCheckpoint" parent="PauseOverlay/Panel/VBoxContainer" instance=ExtResource( 4 )]
|
||||||
|
unique_name_in_owner = true
|
||||||
margin_top = 126.0
|
margin_top = 126.0
|
||||||
margin_right = 222.0
|
margin_right = 222.0
|
||||||
margin_bottom = 165.0
|
margin_bottom = 165.0
|
||||||
@ -961,12 +957,29 @@ theme = ExtResource( 2 )
|
|||||||
custom_fonts/font = SubResource( 9 )
|
custom_fonts/font = SubResource( 9 )
|
||||||
text = "Paused"
|
text = "Paused"
|
||||||
|
|
||||||
[node name="SwayingGrassCheckbox" type="CheckBox" parent="PauseOverlay"]
|
[node name="MarginContainer2" type="MarginContainer" parent="PauseOverlay"]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 1.0
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
margin_left = -151.0
|
||||||
|
margin_top = -36.0
|
||||||
|
margin_right = 161.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="SwayingGrassCheckbox" type="CheckBox" parent="PauseOverlay/MarginContainer2"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
margin_left = 16.0
|
margin_right = 312.0
|
||||||
margin_top = 331.0
|
margin_bottom = 36.0
|
||||||
margin_right = 284.0
|
grow_horizontal = 2
|
||||||
margin_bottom = 355.0
|
grow_vertical = 2
|
||||||
|
focus_neighbour_left = NodePath("../../Panel/VBoxContainer/Continue")
|
||||||
|
focus_neighbour_top = NodePath("../../Panel/VBoxContainer/Continue")
|
||||||
|
focus_neighbour_right = NodePath("../../Panel/VBoxContainer/Continue")
|
||||||
|
focus_neighbour_bottom = NodePath("../../Panel/VBoxContainer/Continue")
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
theme = ExtResource( 2 )
|
theme = ExtResource( 2 )
|
||||||
custom_colors/font_color_disabled = Color( 1, 1, 1, 1 )
|
custom_colors/font_color_disabled = Color( 1, 1, 1, 1 )
|
||||||
custom_colors/font_color_focus = Color( 1, 1, 1, 1 )
|
custom_colors/font_color_focus = Color( 1, 1, 1, 1 )
|
||||||
@ -976,7 +989,14 @@ custom_colors/font_color_hover = Color( 1, 1, 1, 1 )
|
|||||||
custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
|
custom_colors/font_color_pressed = Color( 1, 1, 1, 1 )
|
||||||
text = "fancy swaying grass
|
text = "fancy swaying grass
|
||||||
( diasabling can fix browser performance)"
|
( diasabling can fix browser performance)"
|
||||||
|
flat = true
|
||||||
|
clip_text = true
|
||||||
|
align = 1
|
||||||
|
icon_align = 1
|
||||||
script = ExtResource( 32 )
|
script = ExtResource( 32 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": true
|
||||||
|
}
|
||||||
|
|
||||||
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
stream = ExtResource( 24 )
|
stream = ExtResource( 24 )
|
||||||
@ -998,4 +1018,3 @@ volume_db = -10.0
|
|||||||
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Continue" to="PauseOverlay/Panel/VBoxContainer/Continue" method="_on_button_up"]
|
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Continue" to="PauseOverlay/Panel/VBoxContainer/Continue" method="_on_button_up"]
|
||||||
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Controls" to="." method="_on_Controls_button_up"]
|
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Controls" to="." method="_on_Controls_button_up"]
|
||||||
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Audio" to="." method="open_audio_menu"]
|
[connection signal="button_up" from="PauseOverlay/Panel/VBoxContainer/Audio" to="." method="open_audio_menu"]
|
||||||
[connection signal="toggled" from="PauseOverlay/SwayingGrassCheckbox" to="." method="_on_SwayingGrassCheckbox_toggled"]
|
|
||||||
|
|||||||
14
src/UserInterface/Screens/MainMenu/CollectedCoins.gd
Normal file
14
src/UserInterface/Screens/MainMenu/CollectedCoins.gd
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
onready var proto_coin := get_parent().get_parent().get_parent().get_node("ProtoCoin3DSprite")
|
||||||
|
var last_draw_time := 0
|
||||||
|
var coin_3D_fps := 30
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
if !visible || proto_coin == null:
|
||||||
|
return
|
||||||
|
if last_draw_time <= 0:
|
||||||
|
$CoinTexture.texture = proto_coin.texture
|
||||||
|
last_draw_time = 1/coin_3D_fps
|
||||||
|
else:
|
||||||
|
last_draw_time -= delta
|
||||||
@ -3,12 +3,30 @@ extends VBoxContainer
|
|||||||
func initialize_with_progress(levelFullName: String) -> void:
|
func initialize_with_progress(levelFullName: String) -> void:
|
||||||
if !GlobalState.get_progress().has(levelFullName):
|
if !GlobalState.get_progress().has(levelFullName):
|
||||||
return
|
return
|
||||||
if !GlobalState.get_progress()[levelFullName].has("froggies"):
|
if GlobalState.get_progress()[levelFullName].has("froggies"):
|
||||||
return
|
|
||||||
var froggies : Dictionary = GlobalState.get_progress()[levelFullName]["froggies"]
|
var froggies : Dictionary = GlobalState.get_progress()[levelFullName]["froggies"]
|
||||||
for key in froggies.keys():
|
for key in froggies.keys():
|
||||||
register_froggy(int(key), froggies[key])
|
register_froggy(int(key), froggies[key])
|
||||||
|
|
||||||
|
var collectibles: Dictionary = GlobalState.get_savestate(levelFullName)
|
||||||
|
var coin_number: int = 0
|
||||||
|
var coin_collected_number: int = 0
|
||||||
|
for key in collectibles.keys():
|
||||||
|
if key.to_lower().find("coin") != -1:
|
||||||
|
coin_number += 1
|
||||||
|
if collectibles[key]["was_collected"] == true:
|
||||||
|
coin_collected_number += 1
|
||||||
|
|
||||||
|
if GlobalState.get_savepoint(levelFullName) != Vector2() \
|
||||||
|
&& !GlobalState.get_level_completed(levelFullName):
|
||||||
|
$CollectedCoins.visible = true
|
||||||
|
$CollectedCoins/Label.text = "Checkpoint Reached"
|
||||||
|
elif coin_number > 0:
|
||||||
|
$CollectedCoins.visible = true
|
||||||
|
$CollectedCoins/Label.text = str(coin_collected_number) + " of " + str(coin_number) + " Coins "
|
||||||
|
if coin_collected_number == coin_number:
|
||||||
|
$CollectedCoins/CoinTexture.visible = true
|
||||||
|
|
||||||
var level_time : float = GlobalState.get_level_time(levelFullName)
|
var level_time : float = GlobalState.get_level_time(levelFullName)
|
||||||
if(GlobalState.get_level_completed(levelFullName)):
|
if(GlobalState.get_level_completed(levelFullName)):
|
||||||
$"%LevelTime".visible = true
|
$"%LevelTime".visible = true
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=12 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/ui/froggy-freed-ui.png" type="Texture" id=1]
|
[ext_resource path="res://assets/ui/froggy-freed-ui.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://assets/ui/froggy-imprisoned-ui.png" type="Texture" id=2]
|
[ext_resource path="res://assets/ui/froggy-imprisoned-ui.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelCheckBox.gd" type="Script" id=3]
|
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelCheckBox.gd" type="Script" id=3]
|
||||||
[ext_resource path="res://src/UserInterface/Buttons/AudibleCheckbox.gd" type="Script" id=4]
|
[ext_resource path="res://src/UserInterface/Buttons/AudibleCheckbox.gd" type="Script" id=4]
|
||||||
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=5]
|
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=5]
|
||||||
|
[ext_resource path="res://src/UserInterface/Screens/MainMenu/CollectedCoins.gd" type="Script" id=6]
|
||||||
|
|
||||||
[sub_resource type="DynamicFontData" id=12]
|
[sub_resource type="DynamicFontData" id=12]
|
||||||
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
||||||
@ -15,6 +16,14 @@ extra_spacing_top = 4
|
|||||||
extra_spacing_bottom = 4
|
extra_spacing_bottom = 4
|
||||||
font_data = SubResource( 12 )
|
font_data = SubResource( 12 )
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFontData" id=15]
|
||||||
|
font_path = "res://assets/ui/fonts/Kenney Thick.ttf"
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=16]
|
||||||
|
size = 6
|
||||||
|
extra_spacing_top = 1
|
||||||
|
font_data = SubResource( 15 )
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=13]
|
[sub_resource type="DynamicFont" id=13]
|
||||||
size = 6
|
size = 6
|
||||||
extra_spacing_top = 4
|
extra_spacing_top = 4
|
||||||
@ -33,21 +42,50 @@ script = ExtResource( 3 )
|
|||||||
[node name="CheckBox" type="CheckBox" parent="."]
|
[node name="CheckBox" type="CheckBox" parent="."]
|
||||||
margin_right = 126.0
|
margin_right = 126.0
|
||||||
margin_bottom = 17.0
|
margin_bottom = 17.0
|
||||||
grow_horizontal = 0
|
|
||||||
grow_vertical = 0
|
|
||||||
custom_fonts/font = SubResource( 14 )
|
custom_fonts/font = SubResource( 14 )
|
||||||
text = "This is a level "
|
text = "This is a level "
|
||||||
align = 1
|
|
||||||
icon_align = 1
|
icon_align = 1
|
||||||
expand_icon = true
|
expand_icon = true
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
|
|
||||||
[node name="FreedFroggy1" type="TextureRect" parent="."]
|
[node name="CollectedCoins" type="HBoxContainer" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
margin_top = 21.0
|
margin_top = 21.0
|
||||||
margin_right = 126.0
|
margin_right = 126.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 48.0
|
||||||
|
rect_min_size = Vector2( 0, 10 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
script = ExtResource( 6 )
|
||||||
|
|
||||||
|
[node name="CoinTexture" type="TextureRect" parent="CollectedCoins"]
|
||||||
|
visible = false
|
||||||
|
margin_right = 39.0
|
||||||
|
margin_bottom = 11.0
|
||||||
|
grow_horizontal = 0
|
||||||
|
grow_vertical = 0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CollectedCoins"]
|
||||||
|
margin_right = 126.0
|
||||||
|
margin_bottom = 27.0
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
theme = ExtResource( 5 )
|
||||||
|
custom_colors/font_color = Color( 0.717647, 0.717647, 0.717647, 1 )
|
||||||
|
custom_fonts/font = SubResource( 16 )
|
||||||
|
text = "3 of 3 Coins "
|
||||||
|
align = 1
|
||||||
|
valign = 1
|
||||||
|
|
||||||
|
[node name="FreedFroggy1" type="TextureRect" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
|
margin_top = 35.0
|
||||||
|
margin_right = 126.0
|
||||||
|
margin_bottom = 54.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
@ -165,15 +203,15 @@ texture = ExtResource( 2 )
|
|||||||
[node name="LevelTime" type="Label" parent="."]
|
[node name="LevelTime" type="Label" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
visible = false
|
visible = false
|
||||||
margin_top = 21.0
|
margin_top = 37.0
|
||||||
margin_right = 126.0
|
margin_right = 126.0
|
||||||
margin_bottom = 32.0
|
margin_bottom = 48.0
|
||||||
focus_mode = 2
|
focus_mode = 2
|
||||||
custom_colors/font_color = Color( 0.717647, 0.717647, 0.717647, 1 )
|
custom_colors/font_color = Color( 0.717647, 0.717647, 0.717647, 1 )
|
||||||
custom_fonts/font = SubResource( 13 )
|
custom_fonts/font = SubResource( 13 )
|
||||||
text = "Time: 10 sec"
|
text = "Time: 10 sec"
|
||||||
align = 1
|
align = 1
|
||||||
autowrap = true
|
valign = 1
|
||||||
|
|
||||||
[node name="HSeparator" type="HSeparator" parent="."]
|
[node name="HSeparator" type="HSeparator" parent="."]
|
||||||
margin_top = 21.0
|
margin_top = 21.0
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
[gd_scene load_steps=22 format=2]
|
[gd_scene load_steps=20 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/UserInterface/Buttons/QuitButton.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/UserInterface/Buttons/QuitButton.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/UserInterface/Titel.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/BenefitialObjects/ProtoCoin3DSprite.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://src/UserInterface/Buttons/ChangeSceneButton.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://src/UserInterface/Buttons/ChangeSceneButton.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/Utilities/SignalManager.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5]
|
[ext_resource path="res://assets/meta/ui_theme.tres" type="Theme" id=5]
|
||||||
@ -9,7 +9,6 @@
|
|||||||
[ext_resource path="res://assets/environment/background/space.png" type="Texture" id=7]
|
[ext_resource path="res://assets/environment/background/space.png" type="Texture" id=7]
|
||||||
[ext_resource path="res://src/UserInterface/Buttons/PlayButton.gd" type="Script" id=8]
|
[ext_resource path="res://src/UserInterface/Buttons/PlayButton.gd" type="Script" id=8]
|
||||||
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelSelectButtonGroup.tres" type="ButtonGroup" id=9]
|
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelSelectButtonGroup.tres" type="ButtonGroup" id=9]
|
||||||
[ext_resource path="res://assets/meta/montserrat_extrabold.otf" type="DynamicFontData" id=10]
|
|
||||||
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelList.gd" type="Script" id=11]
|
[ext_resource path="res://src/UserInterface/Screens/MainMenu/LevelList.gd" type="Script" id=11]
|
||||||
[ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=12]
|
[ext_resource path="res://src/UserInterface/Buttons/MenuNavigationButton.gd" type="Script" id=12]
|
||||||
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=13]
|
[ext_resource path="res://assets/ui/sci-fi-godot-theme/sci-fi-theme.tres" type="Theme" id=13]
|
||||||
@ -43,10 +42,6 @@ fill = 1
|
|||||||
fill_from = Vector2( 0.514029, 0.849867 )
|
fill_from = Vector2( 0.514029, 0.849867 )
|
||||||
fill_to = Vector2( 1, 0.994443 )
|
fill_to = Vector2( 1, 0.994443 )
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
|
||||||
size = 60
|
|
||||||
font_data = ExtResource( 10 )
|
|
||||||
|
|
||||||
[node name="MainScreen" type="Control"]
|
[node name="MainScreen" type="Control"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
@ -124,6 +119,10 @@ margin_right = 312.0
|
|||||||
margin_bottom = 36.0
|
margin_bottom = 36.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
focus_neighbour_left = NodePath("../../MenuContainer/Buttons/PlayButton")
|
||||||
|
focus_neighbour_top = NodePath("../../MenuContainer/Buttons/PlayButton")
|
||||||
|
focus_neighbour_right = NodePath("../../MenuContainer/Buttons/PlayButton")
|
||||||
|
focus_neighbour_bottom = NodePath("../../MenuContainer/Buttons/PlayButton")
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
theme = ExtResource( 13 )
|
theme = ExtResource( 13 )
|
||||||
@ -180,18 +179,6 @@ texture = ExtResource( 16 )
|
|||||||
expand = true
|
expand = true
|
||||||
stretch_mode = 1
|
stretch_mode = 1
|
||||||
|
|
||||||
[node name="Titel" parent="MarginContainer" instance=ExtResource( 2 )]
|
|
||||||
visible = false
|
|
||||||
margin_right = 260.0
|
|
||||||
margin_bottom = 85.0
|
|
||||||
grow_horizontal = 2
|
|
||||||
grow_vertical = 2
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 3
|
|
||||||
theme = ExtResource( 13 )
|
|
||||||
custom_fonts/font = SubResource( 1 )
|
|
||||||
text = "Blobby"
|
|
||||||
|
|
||||||
[node name="MenuContainer" type="HBoxContainer" parent="."]
|
[node name="MenuContainer" type="HBoxContainer" parent="."]
|
||||||
anchor_left = 0.45
|
anchor_left = 0.45
|
||||||
anchor_top = 0.75
|
anchor_top = 0.75
|
||||||
@ -281,9 +268,10 @@ follow_focus = true
|
|||||||
scroll_horizontal_enabled = false
|
scroll_horizontal_enabled = false
|
||||||
script = ExtResource( 11 )
|
script = ExtResource( 11 )
|
||||||
|
|
||||||
|
[node name="ProtoCoin3DSprite" parent="MenuContainer/Panel/LevelList" instance=ExtResource( 2 )]
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/Panel/LevelList"]
|
[node name="VBoxContainer" type="VBoxContainer" parent="MenuContainer/Panel/LevelList"]
|
||||||
margin_right = 123.0
|
margin_right = 119.0
|
||||||
margin_bottom = 102.0
|
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|||||||
@ -10,6 +10,7 @@ var freed_frogs := []
|
|||||||
# TODO Rename probs
|
# TODO Rename probs
|
||||||
var is_dead := false setget set_dead
|
var is_dead := false setget set_dead
|
||||||
|
|
||||||
|
var savepoint_loaded := false
|
||||||
var level_time := 0.0
|
var level_time := 0.0
|
||||||
|
|
||||||
var saved_property_dictionary := {}
|
var saved_property_dictionary := {}
|
||||||
@ -19,8 +20,9 @@ var object_in_scene_id: int = 0
|
|||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
GlobalState.touch_level(level_name)
|
GlobalState.touch_level(level_name)
|
||||||
|
saved_property_dictionary = GlobalState.get_savestate(level_name)
|
||||||
GlobalState.gsr.last_played_level = level_name
|
GlobalState.gsr.last_played_level = level_name
|
||||||
SaveManager.save_default()
|
GlobalState.save()
|
||||||
signal_manager.connect("level_completed", self, "_on_level_completed")
|
signal_manager.connect("level_completed", self, "_on_level_completed")
|
||||||
signal_manager.connect("player_died", self, "player_dying")
|
signal_manager.connect("player_died", self, "player_dying")
|
||||||
|
|
||||||
@ -42,52 +44,61 @@ func set_currency(value: int) -> void:
|
|||||||
currency = value
|
currency = value
|
||||||
signal_manager.emit_signal("currency_updated")
|
signal_manager.emit_signal("currency_updated")
|
||||||
|
|
||||||
|
|
||||||
func get_currency() -> int:
|
func get_currency() -> int:
|
||||||
return currency
|
return currency
|
||||||
|
|
||||||
|
|
||||||
func set_deaths(value: int) -> void:
|
func set_deaths(value: int) -> void:
|
||||||
deaths = value
|
deaths = value
|
||||||
|
|
||||||
|
|
||||||
func set_dead(value: bool) -> void:
|
func set_dead(value: bool) -> void:
|
||||||
is_dead = value
|
is_dead = value
|
||||||
|
|
||||||
func get_own_scene_id(obj: Object) -> int:
|
|
||||||
if "scene_id" in obj && saved_object_dictionary.has(obj.scene_id):
|
func register_saveable_node(node: Node) -> void:
|
||||||
return obj.scene_id
|
if saved_object_dictionary.has(node.name):
|
||||||
|
return
|
||||||
else:
|
else:
|
||||||
return register_saveable_object(obj)
|
saved_object_dictionary[node.name] = node
|
||||||
|
if !saved_property_dictionary.has(node.name):
|
||||||
|
save_node_properties()
|
||||||
|
|
||||||
|
|
||||||
func register_saveable_object(obj: Object) -> int:
|
# Saves the state of triggers, collected collectibles and such
|
||||||
var id = object_in_scene_id
|
func save_node_properties() -> void:
|
||||||
saved_object_dictionary[id] = obj
|
for name in saved_object_dictionary.keys():
|
||||||
object_in_scene_id += 1
|
var object = saved_object_dictionary[name]
|
||||||
return id
|
|
||||||
|
|
||||||
|
|
||||||
func save_object_properties() -> void:
|
|
||||||
for id in saved_object_dictionary.keys():
|
|
||||||
var object = saved_object_dictionary[id]
|
|
||||||
var property_list = object.get_property_list()
|
var property_list = object.get_property_list()
|
||||||
var saved_properties = {}
|
var saved_properties = {}
|
||||||
for property in property_list:
|
for property in property_list:
|
||||||
# Only script Variables and only "primitive" types
|
# Only script Variables and only "primitive" types
|
||||||
if property["usage"] == PROPERTY_USAGE_SCRIPT_VARIABLE && property["type"] <= 16:
|
if property["usage"] == PROPERTY_USAGE_SCRIPT_VARIABLE && property["type"] <= 16:
|
||||||
saved_properties[property["name"]] = object.get(property["name"])
|
saved_properties[property["name"]] = object.get(property["name"])
|
||||||
saved_property_dictionary[id] = saved_properties
|
saved_property_dictionary[name] = saved_properties
|
||||||
|
GlobalState.set_level_state(level_name, saved_property_dictionary)
|
||||||
|
|
||||||
func get_saved_object_property(id: int, property: String):
|
|
||||||
if saved_property_dictionary.has(id) && saved_property_dictionary[id].has(property):
|
func get_saved_node_property(node: Node, property: String):
|
||||||
return saved_property_dictionary[id][property]
|
if (
|
||||||
|
saved_property_dictionary.has(node.name)
|
||||||
|
&& saved_property_dictionary[node.name].has(property)
|
||||||
|
):
|
||||||
|
return saved_property_dictionary[node.name][property]
|
||||||
else:
|
else:
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
func set_savepoint(pos: Vector2) -> void:
|
func set_savepoint(pos: Vector2) -> void:
|
||||||
GlobalState.set_savepoint(level_name, pos)
|
GlobalState.set_savepoint(level_name, pos)
|
||||||
save_object_properties()
|
|
||||||
GlobalState.set_uncompleted_level_time(level_name, level_time)
|
GlobalState.set_uncompleted_level_time(level_name, level_time)
|
||||||
GlobalState.set_level_state(level_name, saved_property_dictionary)
|
save_node_properties()
|
||||||
|
GlobalState.get_progress()[level_name]["currency"] = (
|
||||||
|
GlobalState.get_property_value(level_name, "currency")
|
||||||
|
+ currency)
|
||||||
|
currency = 0
|
||||||
|
update_global_state()
|
||||||
|
|
||||||
|
|
||||||
func load_savepoint() -> bool:
|
func load_savepoint() -> bool:
|
||||||
@ -95,6 +106,9 @@ func load_savepoint() -> bool:
|
|||||||
return false
|
return false
|
||||||
saved_property_dictionary = GlobalState.get_savestate(level_name)
|
saved_property_dictionary = GlobalState.get_savestate(level_name)
|
||||||
level_time = GlobalState.get_uncompleted_level_time(level_name)
|
level_time = GlobalState.get_uncompleted_level_time(level_name)
|
||||||
|
# Just update the hud
|
||||||
|
set_currency(currency)
|
||||||
|
savepoint_loaded = true
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
@ -134,48 +148,48 @@ func absolved_tutorial(lesson: String) -> void:
|
|||||||
# and returns true if so. Else it does not spend and return false.
|
# and returns true if so. Else it does not spend and return false.
|
||||||
func spend_currency(cost: int) -> bool:
|
func spend_currency(cost: int) -> bool:
|
||||||
# TODO member that
|
# TODO member that
|
||||||
if OS.is_debug_build():
|
#if OS.is_debug_build():
|
||||||
return true
|
# return true
|
||||||
if check_balance() < cost:
|
if check_balance() < cost:
|
||||||
return false
|
return false
|
||||||
# Can get negative if the cost is greater than what was collected in the same level
|
# Can get negative if the cost is greater than what was collected in the same level
|
||||||
currency = currency - cost
|
currency = currency - cost
|
||||||
return true
|
return true
|
||||||
|
|
||||||
|
|
||||||
func check_balance() -> int:
|
func check_balance() -> int:
|
||||||
var balance = currency + GlobalState.get_wallet()
|
var balance = currency + GlobalState.get_wallet() + GlobalState.get_property_value(level_name, "currency")
|
||||||
return balance
|
return balance
|
||||||
|
|
||||||
|
|
||||||
func _on_level_completed():
|
func _on_level_completed():
|
||||||
#if(OS.is_debug_build()):
|
#if(OS.is_debug_build()):
|
||||||
# return
|
# return
|
||||||
# TODO Extra screen for new best time
|
# TODO Extra screen for new best time
|
||||||
|
save_node_properties()
|
||||||
|
savepoint_loaded = false
|
||||||
GlobalState.set_level_completed(level_name, true)
|
GlobalState.set_level_completed(level_name, true)
|
||||||
if(GlobalState.get_level_time(level_name) > level_time ):
|
if GlobalState.get_level_time(level_name) > level_time:
|
||||||
GlobalState.set_leveltime(level_name, level_time)
|
GlobalState.set_level_time(level_name, level_time)
|
||||||
GlobalState.set_uncompleted_level_time(level_name, INF)
|
GlobalState.set_uncompleted_level_time(level_name, INF)
|
||||||
GlobalState.remove_savepoint(level_name)
|
|
||||||
GlobalState.remove_savestate(level_name)
|
|
||||||
update_global_state()
|
update_global_state()
|
||||||
|
GlobalState.remove_savepoint(level_name)
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
|
|
||||||
# TODO This is now inconsistent as the level_completed property could be used to
|
# TODO This is now inconsistent as the level_completed property could be used to
|
||||||
# determine what was achieved for good and what progress was lost due to death/reloading
|
# determine what was achieved for good and what progress was lost due to death/reloading
|
||||||
func update_global_state() -> void:
|
func update_global_state() -> void:
|
||||||
var progress_dict: Dictionary = GlobalState.get_progress()
|
var progress_dict: Dictionary = GlobalState.get_progress()
|
||||||
var levelProgress: Dictionary = {}
|
var levelProgress: Dictionary = {}
|
||||||
|
|
||||||
levelProgress["currency"] = currency
|
|
||||||
levelProgress["deaths"] = deaths
|
levelProgress["deaths"] = deaths
|
||||||
|
|
||||||
# TODO Doesnt account for multiple plays of same level
|
# TODO Doesnt account for multiple plays of same level
|
||||||
if !progress_dict.has(level_name):
|
if !progress_dict.has(level_name):
|
||||||
progress_dict[level_name] = levelProgress
|
progress_dict[level_name] = levelProgress
|
||||||
else:
|
else:
|
||||||
progress_dict[level_name]["currency"] = (
|
|
||||||
GlobalState.get_property_value(level_name, "currency")
|
|
||||||
+ currency
|
|
||||||
)
|
|
||||||
progress_dict[level_name]["deaths"] = (
|
progress_dict[level_name]["deaths"] = (
|
||||||
GlobalState.get_property_value(level_name, "deaths")
|
GlobalState.get_property_value(level_name, "deaths")
|
||||||
+ deaths
|
+ deaths
|
||||||
@ -186,11 +200,15 @@ func update_global_state() -> void:
|
|||||||
for frog_number in freed_frogs:
|
for frog_number in freed_frogs:
|
||||||
if progress_dict[level_name]["froggies"].has(frog_number):
|
if progress_dict[level_name]["froggies"].has(frog_number):
|
||||||
progress_dict[level_name]["froggies"][frog_number] = true
|
progress_dict[level_name]["froggies"][frog_number] = true
|
||||||
|
if GlobalState.get_level_completed(level_name):
|
||||||
# TODO Wallet is independant from progress_dict because???
|
currency += GlobalState.get_property_value(level_name, "currency")
|
||||||
GlobalState.set_wallet(GlobalState.gsr.wallet + currency)
|
GlobalState.set_wallet(GlobalState.gsr.wallet + currency)
|
||||||
|
progress_dict[level_name]["currency"] = 0
|
||||||
|
currency = 0
|
||||||
|
# Adds currency to level progress temporarily
|
||||||
GlobalState.set_progress(progress_dict)
|
GlobalState.set_progress(progress_dict)
|
||||||
|
|
||||||
|
|
||||||
func player_dying(animation_number: int = 0) -> void:
|
func player_dying(animation_number: int = 0) -> void:
|
||||||
currency = 0
|
currency = 0
|
||||||
is_dead = true
|
is_dead = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user