1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00

Fix null deref when entering singleplayer after exiting multiplayer

This commit is contained in:
John 2021-11-13 23:07:19 -06:00
parent 8232bec5d0
commit 4cc4cd8f89
2 changed files with 10 additions and 20 deletions

View File

@ -1,6 +1,5 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=2 format=2]
[ext_resource path="res://assets/backgrounds/dark.png" type="Texture" id=1]
[ext_resource path="res://script/game/Gameplay/Game.gd" type="Script" id=3]
[node name="Game" type="Control"]
@ -12,15 +11,6 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Background" type="Sprite" parent="."]
show_behind_parent = true
position = Vector2( 321.081, 179.931 )
texture = ExtResource( 1 )
flip_h = true
__meta__ = {
"_edit_lock_": true
}
[node name="Buttons" type="VBoxContainer" parent="."]
anchor_left = 0.912
anchor_top = 0.932

View File

@ -1,10 +1,10 @@
extends Control
# Scenes
onready var title_screen = preload("res://scenes/Title Screen.tscn")
onready var game = preload("res://scenes/Game/Game.tscn" )
onready var options = preload("res://scenes/Options.tscn" )
onready var debug_menu = preload("res://scenes/Debug Menu.tscn" )
onready var Title_Screen = preload("res://scenes/Title Screen.tscn")
onready var Game = preload("res://scenes/Game/Game.tscn" )
onready var Options = preload("res://scenes/Options.tscn" )
onready var Debug_Menu = preload("res://scenes/Debug Menu.tscn" )
#flags
var power_saving = true
@ -26,7 +26,7 @@ func _ready():
OS.low_processor_usage_mode_sleep_usec = 6800
OS.window_fullscreen = start_fullscreen
if debug_enabled:
add_child(debug_menu.instance())
add_child(Debug_Menu.instance())
# Process global keybinds
func _input(event):
@ -48,19 +48,19 @@ func _on_scene_start(scene):
#print ("_on_scene_start(",scene,")")
match scene:
"Singleplayer":
add_child (game.instance())
add_child (Game.instance())
return true
"Multiplayer":
game = game.instance()
var game = Game.instance()
game.is_multiplayer = true
add_child (game)
# add_child (multiplayercontroller.instance())
return true
"Options":
add_child (options.instance())
add_child (Options.instance())
return true
"Title":
add_child (title_screen.instance())
add_child (Title_Screen.instance())
return true
func _on_scene_start_by_name(scene):