Fixed some debugger problems

This commit is contained in:
Kristofers Solo 2021-11-14 21:52:55 +02:00
parent 261e63b7f3
commit ccf3093fac
19 changed files with 67 additions and 53 deletions

View File

@ -95,6 +95,7 @@ func _ready():
weaponPositionalOffset = Vector2(-$"weaponHolder/Player-character-theme-gun-na3".texture.get_width() * $"weaponHolder/Player-character-theme-gun-na3".scale.x / 2,-$"weaponHolder/Player-character-theme-gun-na3".texture.get_height() * $"weaponHolder/Player-character-theme-gun-na3".scale.y / 2) + Vector2(-$weaponHolder.get_shape().get_radius(), 0)
$"weaponHolder/Player-character-theme-gun".position = weaponPositionalOffset
# warning-ignore:return_value_discarded
get_tree().connect("network_peer_connected", self, "_network_peer_connected")
username_text_instance = Global.instance_node_at_location(username_text, PersistentNodes, global_position)
username_text_instance.player_following = self
@ -115,7 +116,7 @@ func _ready():
func get_user_state():
# Create a dictionary of all variables that relate to clients' active state.
var user_state = {
user_state = {
"global_position": global_transform.origin
}
return user_state
@ -123,7 +124,7 @@ func get_user_state():
func get_dimensions():
# Create a dictionary of all (required) sizes in regards to the client.
var dimensions = {
dimensions = {
"sprite": {
"width":$player_sprite.texture.get_width(),
"height":$player_sprite.texture.get_height(),
@ -150,7 +151,7 @@ func process_rotation():
rotation_degrees += VDIR_ray_offset / 10
func _process(delta: float) -> void:
func _process(_delta: float) -> void:
user_input = UIN_preset_pre_processor_instance.update(Global.get_current_phase())
if get_tree().is_network_server():
Global.phase_update_global()
@ -261,12 +262,13 @@ func _physics_process(delta) -> void:
elif characterStates["onGround"] and velocityVDIR.y > 0:
velocityVDIR.y -= deccelerationSpeed
velocityVDIR = Vector2(clamp(velocityVDIR.x, -maxMovementSpeed.x, maxMovementSpeed.x), clamp(velocityVDIR.y, -maxMovementSpeed.y, maxMovementSpeed.y))
# warning-ignore:return_value_discarded
move_and_slide(velocityVDIR.rotated(rotationalHolder))
rotate_weapon()
choose_trajectory()
enable_trajectory_line(trajectory_line)
if user_input["shoot"] and can_shoot and not is_reloading:
rpc("shoot", trajectory, get_tree().get_network_unique_id())
rpc("shoot", trajectory)
is_reloading = true
reload_timer.start()
else:
@ -312,16 +314,15 @@ func choose_trajectory():
trajectory_line = 'hyper'
sync func shoot(trajectory:String, id):
bullet = bullet_env[trajectory].instance()
sync func shoot(new_trajectory:String):
bullet = bullet_env[new_trajectory].instance()
get_parent().add_child(bullet)
bullet.global_position = shoot_point.global_position
bullet.global_rotation = shoot_point.global_rotation
# bullet.player_owner = id
func enable_trajectory_line(trajectory_line:String):
var x = bullet_trajectory[trajectory_line].instance()
func enable_trajectory_line(new_trajectory_line:String):
var x = bullet_trajectory[new_trajectory_line].instance()
get_parent().add_child(x)
x.global_position = shoot_point.global_position
x.global_rotation = shoot_point.global_rotation

View File

@ -4,7 +4,7 @@ var VDIR = {}
func update(userState, userDimensions):
var bSP = 0
var bHO = userDimensions["sprite"]["width"] / 2 * userDimensions["sprite"]["scale"].x
var _bHO = userDimensions["sprite"]["width"] / 2 * userDimensions["sprite"]["scale"].x
var bVVO = userDimensions["sprite"]["height"] * userDimensions["sprite"]["scale"].y
var spHO = userDimensions["collider"]["radius"]
VDIR = {

View File

@ -28,8 +28,11 @@ func _ready() -> void:
if ip.begins_with("192.168.") and not ip.ends_with(".1"):
ip_address = ip
# warning-ignore:return_value_discarded
get_tree().connect("connected_to_server", self, "_connected_to_server")
# warning-ignore:return_value_discarded
get_tree().connect("server_disconnected", self, "_server_disconnected")
# warning-ignore:return_value_discarded
get_tree().connect("connection_failed", self, "_connection_failed")
@ -37,6 +40,7 @@ func create_server() -> void:
server = NetworkedMultiplayerENet.new()
server.create_server(DEFAULT_PORT, MAX_CLIENTS)
get_tree().set_network_peer(server)
# warning-ignore:return_value_discarded
Global.instance_node(load("res://source/scenes/GUI/server_handlers/server_advertiser.tscn"), get_tree().current_scene)

View File

@ -25,12 +25,14 @@ func _ready() -> void:
background_lobby.hide()
device_ip_address.hide()
text.hide()
menu_botton.hide()
Global.start_game(false)
# warning-ignore:return_value_discarded
get_tree().connect("network_peer_connected", self, "_player_connected")
# warning-ignore:return_value_discarded
get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
# warning-ignore:return_value_discarded
get_tree().connect("connected_to_server", self, "_connected_to_server")
device_ip_address.text = Network.ip_address
@ -41,6 +43,7 @@ func _ready() -> void:
device_ip_address.show()
text.show()
current_spawn_location_instance_number = 1
# warning-ignore:shadowed_variable
for player in PersistentNodes.get_children():
if player.is_in_group("Player"):
for spawn_location in $spawn_locations.get_children():
@ -116,6 +119,7 @@ sync func switch_to_game() -> void:
if child.is_in_group("Player"):
child.update_shoot_mode(true)
# warning-ignore:return_value_discarded
get_tree().change_scene("res://source/levels/trinity_site/trinity_site_level.tscn")
@ -128,6 +132,7 @@ func _on_confirm_pressed():
instance_player(get_tree().get_network_unique_id())
elif mode == "join":
if username_text_edit.text != "":
# warning-ignore:return_value_discarded
Global.instance_node(load("res://source/scenes/GUI/server_handlers/server_browser.tscn"), self)
@ -140,5 +145,6 @@ func show_lobby():
func _on_return_pressed():
# warning-ignore:return_value_discarded
get_tree().change_scene("res://source/scenes/GUI/main_menu.tscn")

View File

@ -29,7 +29,7 @@ func _ready():
print("GameServer LAN service: Listening port: " + str(listen_port))
func _process(delta):
func _process(_delta):
if socket_udp.get_available_packet_count() > 0:
var server_ip = socket_udp.get_packet_ip()
var server_port = socket_udp.get_packet_port()

View File

@ -33,7 +33,5 @@ func _draw():
time += 0.06944
func _process(delta):
func _process(_delta):
update()
pass

View File

@ -12,6 +12,7 @@ var pos
func _ready():
pos = Global.get("player").get_node('weaponHolder/Player-character-theme-gun').position
func follow_hyperbolic_trajectory():
if pos.x > 0:
velocity.x = 5
@ -20,11 +21,12 @@ func follow_hyperbolic_trajectory():
velocity.x = 5
velocity.y = -a_parameter/(time*b_parameter)
func _process(delta):
follow_hyperbolic_trajectory()
time += delta
position += velocity * speed_hyper * delta
func _on_hitbox_body_entered(body):
func _on_hitbox_body_entered(_body):
queue_free()

View File

@ -16,6 +16,6 @@ func _draw():
draw_circle(dot_position, 2, Color(225, 225, 225))
time += 0.06944
func _process(delta):
func _process(_delta):
update()

View File

@ -20,5 +20,5 @@ func _process(delta):
position += velocity * speed_line * delta
func _on_hitbox_body_entered(body):
func _on_hitbox_body_entered(_body):
queue_free()

View File

@ -28,7 +28,7 @@ func _draw():
draw_circle(dot_position, 2, Color(225, 225, 225))
time += 0.06944
func _process(delta):
func _process(_delta):
update()

View File

@ -29,5 +29,5 @@ func _process(delta):
position += velocity * speed_parab * delta
func _on_hitbox_body_entered(body):
func _on_hitbox_body_entered(_body):
queue_free()

View File

@ -18,5 +18,5 @@ func _draw():
draw_circle(dot_position, 2, Color(225, 225, 225))
time += 0.06944
func _process(delta):
func _process(_delta):
update()

View File

@ -1,6 +1,6 @@
extends Node
func _process(delta):
func _process(_delta):
if Input.is_action_just_pressed("fullscreen_toggle"):
OS.window_fullscreen = !OS.window_fullscreen
pass

View File

@ -8,7 +8,7 @@ var distanceToPlayerOffset = -150
onready var health_bar = $health_bar
func _process(delta: float) -> void:
func _process(_delta) -> void:
if player_following != null:
global_position = player_following.global_position + Vector2(0,distanceToPlayerOffset).rotated(player_following.rotation) + Vector2(0,45)

View File

@ -1,15 +1,17 @@
extends Control
func _on_play_pressed():
func _on_play_pressed() -> void:
# warning-ignore:return_value_discarded
get_tree().change_scene("res://source/scenes/GUI/singleplayer_setup.tscn")
func _on_LAN_party_pressed():
func _on_LAN_party_pressed() -> void:
# warning-ignore:return_value_discarded
get_tree().change_scene("res://source/scenes/GUI/network_setup.tscn")
func _on_exit_pressed():
func _on_exit_pressed() -> void:
get_tree().quit()

View File

@ -5,4 +5,5 @@ extends TextureButton
# Global.instance_node(load("res://source/scenes/OVERLAY/elements/menu_button_overlay.tscn"), Global.ui)
func _on_menu_button_pressed():
# warning-ignore:return_value_discarded
Global.instance_node(load("res://source/scenes/OVERLAY/elements/menu_button_overlay.tscn"), Global.ui)

View File

@ -8,7 +8,7 @@ var distanceToPlayerOffset = -150
onready var label = $Label
func _process(delta: float) -> void:
func _process(_delta) -> void:
if player_following != null:
global_position = player_following.global_position + Vector2(0,distanceToPlayerOffset).rotated(player_following.rotation)

View File

@ -5,7 +5,7 @@
[ext_resource path="res://source/assets/scripts/server_handlers/server_processors/server_browser.gd" type="Script" id=3]
[ext_resource path="res://source/scenes/OVERLAY/elements/button.tscn" type="PackedScene" id=4]
[ext_resource path="res://source/assets/sprites/GUI/background_server.svg" type="Texture" id=5]
[ext_resource path="res://source/assets/sprites/GUI/in_game/button_disabled.svg" type="Texture" id=7]
[ext_resource path="res://source/assets/sprites/GUI/in_game/buttons/button_disabled.svg" type="Texture" id=7]
[ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=8]
[sub_resource type="DynamicFont" id=1]

View File

@ -13,25 +13,25 @@
[ext_resource path="res://source/assets/sprites/GUI/in_game/user_input/ready_button/ready_button_hover.svg" type="Texture" id=11]
[ext_resource path="res://source/assets/sprites/GUI/in_game/user_input/skip_button/skip_button.svg" type="Texture" id=12]
[sub_resource type="StyleBoxTexture" id=9]
[sub_resource type="StyleBoxTexture" id=1]
texture = ExtResource( 1 )
region_rect = Rect2( 0, 0, 480, 156 )
[sub_resource type="StyleBoxTexture" id=7]
[sub_resource type="StyleBoxTexture" id=2]
texture = ExtResource( 3 )
region_rect = Rect2( 0, 0, 100, 100 )
[sub_resource type="DynamicFont" id=2]
[sub_resource type="DynamicFont" id=3]
size = 14
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxTexture" id=8]
[sub_resource type="StyleBoxTexture" id=4]
texture = ExtResource( 5 )
region_rect = Rect2( 0, 0, 100, 100 )
[sub_resource type="DynamicFont" id=3]
[sub_resource type="DynamicFont" id=5]
size = 14
use_mipmaps = true
use_filter = true
@ -41,16 +41,22 @@ font_data = ExtResource( 2 )
texture = ExtResource( 4 )
region_rect = Rect2( 0, 0, 100, 100 )
[sub_resource type="DynamicFont" id=4]
[sub_resource type="DynamicFont" id=7]
size = 14
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="StyleBoxTexture" id=5]
[sub_resource type="StyleBoxTexture" id=8]
texture = ExtResource( 6 )
region_rect = Rect2( 0, 0, 100, 100 )
[sub_resource type="DynamicFont" id=9]
size = 22
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=10]
size = 22
use_mipmaps = true
@ -63,16 +69,10 @@ use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[sub_resource type="DynamicFont" id=12]
size = 22
use_mipmaps = true
use_filter = true
font_data = ExtResource( 2 )
[node name="user_input" type="Panel"]
margin_right = 480.0
margin_bottom = 156.0
custom_styles/panel = SubResource( 9 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
@ -98,7 +98,7 @@ margin_left = -50.0
margin_top = -50.0
margin_right = 50.0
margin_bottom = 50.0
custom_styles/panel = SubResource( 7 )
custom_styles/panel = SubResource( 2 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
@ -112,7 +112,7 @@ anchor_bottom = 1.0
margin_left = -39.0
margin_top = -19.0
margin_right = 39.0
custom_fonts/font = SubResource( 2 )
custom_fonts/font = SubResource( 3 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "line"
align = 1
@ -133,7 +133,7 @@ margin_left = -50.0
margin_top = -50.0
margin_right = 50.0
margin_bottom = 50.0
custom_styles/panel = SubResource( 8 )
custom_styles/panel = SubResource( 4 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
@ -147,7 +147,7 @@ anchor_bottom = 1.0
margin_left = -39.0
margin_top = -19.0
margin_right = 39.0
custom_fonts/font = SubResource( 3 )
custom_fonts/font = SubResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "parabol"
align = 1
@ -182,7 +182,7 @@ anchor_bottom = 1.0
margin_left = -39.0
margin_top = -19.0
margin_right = 39.0
custom_fonts/font = SubResource( 4 )
custom_fonts/font = SubResource( 7 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "hyperbol"
align = 1
@ -203,7 +203,7 @@ margin_left = -50.0
margin_top = -50.0
margin_right = 50.0
margin_bottom = 50.0
custom_styles/panel = SubResource( 5 )
custom_styles/panel = SubResource( 8 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
@ -217,7 +217,7 @@ anchor_bottom = 1.0
margin_left = -39.0
margin_top = -19.0
margin_right = 39.0
custom_fonts/font = SubResource( 4 )
custom_fonts/font = SubResource( 7 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "sin"
align = 1
@ -240,7 +240,7 @@ __meta__ = {
[node name="Label" type="Label" parent="controls"]
anchor_right = 1.0
margin_bottom = 29.0
custom_fonts/font = SubResource( 10 )
custom_fonts/font = SubResource( 9 )
text = "Active formula"
align = 1
valign = 1
@ -264,7 +264,7 @@ __meta__ = {
[node name="Label" type="Label" parent="controls/ready_button"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 11 )
custom_fonts/font = SubResource( 10 )
text = "Ready"
align = 1
valign = 1
@ -288,7 +288,7 @@ __meta__ = {
[node name="Label" type="Label" parent="controls/skip_button"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_fonts/font = SubResource( 12 )
custom_fonts/font = SubResource( 11 )
text = "Skip"
align = 1
valign = 1