fixed multiple levels loading at once and also reset all collectibles on change_map()

This commit is contained in:
pennyrigate 2023-02-03 03:04:30 -05:00
parent 9aedf0bc1d
commit 7700326cc0

View file

@ -68,8 +68,10 @@ func get_map():
#Go to new map #Go to new map
func change_map(map): func change_map(map):
shards_collected = [false,false,false,false,false,false,false,false,false,false] clear_collectibles()
get_map().queue_free() #Loop is so no more than one level is loaded at a time
for maps in get_tree().get_nodes_in_group("map"):
maps.queue_free()
instance_node(map,0,0,viewport) instance_node(map,0,0,viewport)
#Clear data #Clear data
@ -78,6 +80,7 @@ func clear_collectibles():
Game.golds = 0 Game.golds = 0
Game.stars = [false,false,false,false,false] Game.stars = [false,false,false,false,false]
Game.shards = 0 Game.shards = 0
Game.shards_collected = [false,false,false,false,false,false,false,false,false,false]
Game.arrows = 0 Game.arrows = 0
Game.lives = 2 Game.lives = 2