fixed multiple levels loading at once and also reset all collectibles on change_map()
This commit is contained in:
parent
9aedf0bc1d
commit
7700326cc0
1 changed files with 5 additions and 2 deletions
7
game.gd
7
game.gd
|
@ -68,8 +68,10 @@ func get_map():
|
|||
|
||||
#Go to new map
|
||||
func change_map(map):
|
||||
shards_collected = [false,false,false,false,false,false,false,false,false,false]
|
||||
get_map().queue_free()
|
||||
clear_collectibles()
|
||||
#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)
|
||||
|
||||
#Clear data
|
||||
|
@ -78,6 +80,7 @@ func clear_collectibles():
|
|||
Game.golds = 0
|
||||
Game.stars = [false,false,false,false,false]
|
||||
Game.shards = 0
|
||||
Game.shards_collected = [false,false,false,false,false,false,false,false,false,false]
|
||||
Game.arrows = 0
|
||||
Game.lives = 2
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue