clears savegame on death
This commit is contained in:
@@ -96,6 +96,7 @@ theme_override_font_sizes/font_size = 150
|
|||||||
text = "Resume"
|
text = "Resume"
|
||||||
|
|
||||||
[node name="Load" type="Button" parent="MarginContainer/VBoxContainer"]
|
[node name="Load" type="Button" parent="MarginContainer/VBoxContainer"]
|
||||||
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
theme_override_fonts/font = ExtResource("3_4nq4f")
|
theme_override_fonts/font = ExtResource("3_4nq4f")
|
||||||
theme_override_font_sizes/font_size = 150
|
theme_override_font_sizes/font_size = 150
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ var engine_time_scale_cache : float = 1.0
|
|||||||
func _ready():
|
func _ready():
|
||||||
##LOAD DATA
|
##LOAD DATA
|
||||||
SaveLoad.load_persistent_data()
|
SaveLoad.load_persistent_data()
|
||||||
|
SaveLoad.load_save_game_data()
|
||||||
|
|
||||||
|
if SaveLoad.data_cleared:
|
||||||
|
refresh_scene()
|
||||||
|
|
||||||
#Spawn Crown
|
#Spawn Crown
|
||||||
var crown_spawn = crown.instantiate()
|
var crown_spawn = crown.instantiate()
|
||||||
@@ -56,15 +60,6 @@ func _ready():
|
|||||||
#global randomize function
|
#global randomize function
|
||||||
randomize()
|
randomize()
|
||||||
|
|
||||||
health = start_health
|
|
||||||
|
|
||||||
respawn_position = player.camera.global_position
|
|
||||||
respawn_cam_rotation = player.global_transform.basis
|
|
||||||
|
|
||||||
#clear spawned in objects
|
|
||||||
for node in get_tree().get_nodes_in_group("spawned"):
|
|
||||||
node.queue_free()
|
|
||||||
|
|
||||||
#assign pickups to array
|
#assign pickups to array
|
||||||
if ammo_drop_enabled == true:
|
if ammo_drop_enabled == true:
|
||||||
pickups.append(ammo_drop)
|
pickups.append(ammo_drop)
|
||||||
@@ -75,6 +70,22 @@ func _ready():
|
|||||||
if money_drop_enabled == true:
|
if money_drop_enabled == true:
|
||||||
pickups.append(money_drop)
|
pickups.append(money_drop)
|
||||||
|
|
||||||
|
#clear spawned in objects
|
||||||
|
for node in get_tree().get_nodes_in_group("spawned"):
|
||||||
|
node.queue_free()
|
||||||
|
|
||||||
|
#find enemy hiveminds
|
||||||
|
for node in get_tree().get_nodes_in_group("enemy_hivemind"):
|
||||||
|
enemy_hiveminds.append(node)
|
||||||
|
#count starting enemies
|
||||||
|
enemy_count()
|
||||||
|
|
||||||
|
func refresh_scene():
|
||||||
|
health = start_health
|
||||||
|
|
||||||
|
respawn_position = player.camera.global_position
|
||||||
|
respawn_cam_rotation = player.global_transform.basis
|
||||||
|
|
||||||
if player:
|
if player:
|
||||||
#Set up starting guns and ammo
|
#Set up starting guns and ammo
|
||||||
if gun_1 != null:
|
if gun_1 != null:
|
||||||
@@ -94,11 +105,6 @@ func _ready():
|
|||||||
current_gun_index = 0
|
current_gun_index = 0
|
||||||
gun_spawn(0)
|
gun_spawn(0)
|
||||||
|
|
||||||
#find enemy hiveminds
|
|
||||||
for node in get_tree().get_nodes_in_group("enemy_hivemind"):
|
|
||||||
enemy_hiveminds.append(node)
|
|
||||||
#count starting enemies
|
|
||||||
enemy_count()
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
|
|||||||
@@ -130,7 +130,8 @@ func load_save_game_data():
|
|||||||
level_control.health = player_health
|
level_control.health = player_health
|
||||||
level_control.money = player_money
|
level_control.money = player_money
|
||||||
level_control.held_guns = held_guns
|
level_control.held_guns = held_guns
|
||||||
player.gun.queue_free()
|
if player.gun:
|
||||||
|
player.gun.queue_free()
|
||||||
level_control.gun_spawn(current_gun)
|
level_control.gun_spawn(current_gun)
|
||||||
level_control.ammo_current = current_ammo
|
level_control.ammo_current = current_ammo
|
||||||
level_control.ammo_reserve = reserve_ammo
|
level_control.ammo_reserve = reserve_ammo
|
||||||
|
|||||||
Reference in New Issue
Block a user