added main menu and can continue from last level
This commit is contained in:
@@ -35,6 +35,12 @@ var engine_time_scale_cache : float = 1.0
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
level_name = self.get_name()
|
||||
GameGlobals.current_level = str(self.scene_file_path)
|
||||
|
||||
if GameGlobals.loading_gamemode != null:
|
||||
gamemode = GameGlobals.loading_gamemode
|
||||
GameGlobals.loading_gamemode = null
|
||||
|
||||
#connect to signals
|
||||
SignalBus.enemy_count_changed.connect(enemy_count)
|
||||
|
||||
@@ -60,6 +66,8 @@ func _ready():
|
||||
if crown_target:
|
||||
crown_target.add_child(crown_spawn)
|
||||
crown_spawn.position = Vector3(0,2,0)
|
||||
if crown_target.is_in_group("enemy"):
|
||||
crown_target.loot_amount = 10
|
||||
#global randomize function
|
||||
randomize()
|
||||
|
||||
@@ -208,19 +216,20 @@ func pickup_spawn(randomized):
|
||||
var i_weight
|
||||
match int(i):
|
||||
0:
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(expected_ammo["light"]),0,1)
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(gamemode.expected_ammo["light"]),0,1)
|
||||
1:
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(expected_ammo["medium"]),0,1)
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(gamemode.expected_ammo["medium"]),0,1)
|
||||
2:
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(expected_ammo["heavy"]),0,1)
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(gamemode.expected_ammo["heavy"]),0,1)
|
||||
3:
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(expected_ammo["shotgun"]),0,1)
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(gamemode.expected_ammo["shotgun"]),0,1)
|
||||
4:
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(expected_ammo["rocket"]),0,1)
|
||||
i_weight = 1.0 - clamp(float(GameGlobals.ammo_reserve[str(i)]) / float(gamemode.expected_ammo["rocket"]),0,1)
|
||||
5:
|
||||
i_weight = 0
|
||||
if i_weight > ammo_weight:
|
||||
ammo_weight = i_weight
|
||||
ammo_type_weight.erase(5)
|
||||
ammo_type_weight[i] = i_weight + drop_chance_minimum
|
||||
|
||||
pickup_type = HelperFuncs.weighted_random({"0" : ammo_weight, "1" : stamina_weight,"2" : health_weight,"3" : money_weight})
|
||||
@@ -244,5 +253,6 @@ func pickup_spawn(randomized):
|
||||
return {"pickup_type" : pickup_type,"ammo_type" : ammo_type,"value" : value}
|
||||
|
||||
func save_quit():
|
||||
SignalBus.emit_signal("player_exiting_tree")
|
||||
SaveLoad.save_game_data(level_name)
|
||||
get_tree().quit()
|
||||
|
||||
Reference in New Issue
Block a user