Adding global variables
This commit is contained in:
parent
57b312a3a5
commit
645b252da9
@ -11,6 +11,14 @@ var dev_stats = true
|
||||
var dbname = "storage.db"
|
||||
var mainscene = ""
|
||||
var base_tilemap = preload("res://Other/base_tilemap/base_tilemap.tscn")
|
||||
var map_name
|
||||
|
||||
func load_scene(map_data):
|
||||
map_name = map_data
|
||||
var scene = load(map_data+".tscn")
|
||||
print("MAP NAME ",map_data+".tscn")
|
||||
var map = scene.instance()
|
||||
return map
|
||||
|
||||
func AddInventoryItem(itemid, amount):
|
||||
for x in range(40):
|
||||
|
@ -1,5 +1,5 @@
|
||||
extends Node2D
|
||||
#Global functions for the game, like speech bubbles and sounds
|
||||
const gamevariables = "res://MiscScenes/GameVariables.tscn"
|
||||
|
||||
func RenderSpeech(load_on, text):
|
||||
var speech = preload("res://MiscScenes/Speech.tscn").instance()
|
||||
@ -8,9 +8,7 @@ func RenderSpeech(load_on, text):
|
||||
load_on.add_child(speech)
|
||||
|
||||
func SoundOnInteraction(load_on, sound_name):
|
||||
var audio = preload("res://MiscScenes/Sound.tscn").instance()
|
||||
var format_string = "res://Sounds/%s.wav"
|
||||
var actual_string = format_string % sound_name
|
||||
var Sound = load(actual_string)
|
||||
audio.stream = Sound
|
||||
var audio = preload(gamevariables).instance().get_node("Sound")
|
||||
audio.stream = load("res://Sounds/%s.wav" % sound_name)
|
||||
load_on.add_child(audio)
|
||||
Global.Log("Sound playing "+sound_name, 1)
|
||||
|
@ -55,11 +55,6 @@ func InteractWithCell():
|
||||
print("plant cell mouse line 1: ", interaction_map.get_cell(12, 36))
|
||||
print('plant_cell_mouse=',plant_cell_mouse,' | plant_cell_character=', plant_cell_character,' | background_cell=', background_cell,' | interaction_cell=',interaction_cell)
|
||||
GlobalGameFunctions.SoundOnInteraction(self, "standard")
|
||||
for i in 150:
|
||||
for j in 150:
|
||||
if interaction_map.get_cell(int(i),int(j)) != -1:
|
||||
print(interaction_map.get_cell(int(i),int(j)))
|
||||
print(i, j)
|
||||
|
||||
if plant_cell_mouse > 0 and plant_cell_mouse % 2 == 0:
|
||||
Global.AddInventoryItem(plant_cell_mouse/2, 1)
|
||||
@ -84,3 +79,4 @@ func AnimationOnInteraction(Item):
|
||||
|
||||
func _ready():
|
||||
Global.player_inventory_items = Database.GetInventoryItems().duplicate()
|
||||
print("Map = ", Global.map_name)
|
||||
|
@ -6,15 +6,6 @@ func _ready():
|
||||
func _on_Btn_PlayGame_pressed():
|
||||
Global.LoadSave()
|
||||
Global.GoToScene("res://Other/base_tilemap/base_tilemap.tscn") #Hier kan eventueel de mapnaam van de database ingevoerd worden!
|
||||
#
|
||||
#
|
||||
# #save this scene to global scenes
|
||||
# Global.AddScene(self, "menu", false)
|
||||
#
|
||||
# #set this scene as main
|
||||
# Global.mainscene = "startmap1"
|
||||
# Global.AddScene(game, "startmap1", true)
|
||||
## get_tree().get_root().add_child(game)
|
||||
|
||||
func _on_Btn_LoadGame_pressed():
|
||||
Global.GoToScene("loadgame_screen")
|
||||
|
9
MiscScenes/GameVariables.tscn
Normal file
9
MiscScenes/GameVariables.tscn
Normal file
@ -0,0 +1,9 @@
|
||||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Sounds/standard.wav" type="AudioStream" id=1]
|
||||
|
||||
[node name="GameVariables" type="Node"]
|
||||
|
||||
[node name="Sound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource( 1 )
|
||||
autoplay = true
|
@ -1,4 +1,3 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="Sound" type="AudioStreamPlayer"]
|
||||
autoplay = true
|
||||
|
@ -1,12 +1,5 @@
|
||||
extends Node2D
|
||||
|
||||
func load_scene(map_data):
|
||||
var scene = load(map_data+".tscn")
|
||||
print("MAP NAME ",map_data+".tscn")
|
||||
var map = scene.instance()
|
||||
return map
|
||||
|
||||
func _ready():
|
||||
var map = "res://Maps/river_intersection"
|
||||
self.add_child(load_scene(map))
|
||||
|
||||
var map_name = "res://Maps/river_intersection"
|
||||
self.add_child(Global.load_scene(map_name))
|
||||
|
10
default_bus_layout.tres
Normal file
10
default_bus_layout.tres
Normal file
@ -0,0 +1,10 @@
|
||||
[gd_resource type="AudioBusLayout" format=2]
|
||||
|
||||
[resource]
|
||||
bus/0/solo = true
|
||||
bus/1/name = "New Bus"
|
||||
bus/1/solo = false
|
||||
bus/1/mute = false
|
||||
bus/1/bypass_fx = false
|
||||
bus/1/volume_db = 6.02
|
||||
bus/1/send = "Master"
|
Loading…
Reference in New Issue
Block a user