Added dynamically loading for inventory
This commit is contained in:
parent
8b8baeba87
commit
8f3e13e532
27
Global.gd
27
Global.gd
@ -11,6 +11,7 @@ var current_scene = null
|
||||
var current_camera = null
|
||||
var dev_stats = true
|
||||
var dbname = "storage.db"
|
||||
var mainscene = ""
|
||||
|
||||
func AddInventoryItem(itemid, amount):
|
||||
for x in range(40):
|
||||
@ -43,18 +44,20 @@ func GoToScene(scene):
|
||||
current_scene = loadedscenes[scene]
|
||||
get_tree().get_root().add_child(loadedscenes[scene])
|
||||
return
|
||||
match scene:
|
||||
"river_intersection_home_2":
|
||||
current_scene = river_intersection_home_2
|
||||
get_tree().get_root().add_child(river_intersection_home_2)
|
||||
"inventory_screen":
|
||||
inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
||||
current_scene = inventory_screen
|
||||
get_tree().get_root().add_child(inventory_screen)
|
||||
"loadgame_screen":
|
||||
loadgame_screen = preload("res://MenuScenes/LoadGame_Menu.tscn").instance()
|
||||
current_scene = loadgame_screen
|
||||
get_tree().get_root().add_child(loadgame_screen)
|
||||
else:
|
||||
print("Could not load scene " + scene)
|
||||
# match scene:
|
||||
# "river_intersection_home_2":
|
||||
# current_scene = river_intersection_home_2
|
||||
# get_tree().get_root().add_child(river_intersection_home_2)
|
||||
# "inventory_screen":
|
||||
# inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
||||
# current_scene = inventory_screen
|
||||
# get_tree().get_root().add_child(inventory_screen)
|
||||
# "loadgame_screen":
|
||||
# loadgame_screen = preload("res://MenuScenes/LoadGame_Menu.tscn").instance()
|
||||
# current_scene = loadgame_screen
|
||||
# get_tree().get_root().add_child(loadgame_screen)
|
||||
|
||||
func LoadSave(target="Storage.db"):
|
||||
dbname = target
|
||||
|
@ -33,4 +33,4 @@ func _input(event):
|
||||
holding_item.global_position = get_global_mouse_position()
|
||||
|
||||
func _on_TouchScreenButton_pressed():
|
||||
Global.GoToScene("river_intersection_home_2")
|
||||
Global.GoToScene(Global.mainscene)
|
||||
|
@ -18,6 +18,9 @@ func _on_Btn_PlayGame_pressed():
|
||||
game_data.init_map(150, 150, "res://omgeving/Floor.tres",map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data)
|
||||
var game = load("res://base_tilemap/base_tilemap.tscn").instance()
|
||||
game.load_scene(game_data)
|
||||
|
||||
#set this scene as main
|
||||
Global.mainscene = "startmap1"
|
||||
Global.AddScene(game, "startmap1", true)
|
||||
# get_tree().get_root().add_child(game)
|
||||
|
||||
|
@ -18,4 +18,5 @@ func _unhandled_input(event):
|
||||
set_cellv(pl_pos_tile, -1)
|
||||
|
||||
func _on_Inventory_pressed():
|
||||
Global.GoToScene("inventory_screen")
|
||||
var inventory_screen = preload("res://MiscScenes/Inventory.tscn").instance()
|
||||
Global.AddScene(inventory_screen, "inventory_screen", true)
|
||||
|
Loading…
Reference in New Issue
Block a user