Merge branch 'shooting-mechanics'

This commit is contained in:
Kristofers Solo 2021-11-17 21:30:44 +02:00
commit 7806253aa8
5 changed files with 88 additions and 94 deletions

View File

@ -164,9 +164,9 @@ func _process(_delta: float) -> void:
clientPhase = puppet_phase clientPhase = puppet_phase
Global.set_current_phase(clientPhase) Global.set_current_phase(clientPhase)
$"weaponHolder/Player-character-theme-gun".play(theme) $"weaponHolder/Player-character-theme-gun".play(theme)
particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-" + theme + ".png") #particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-"+theme+".png")
particleTexture.create_from_image(particleImage) #particleTexture.create_from_image(particleImage)
$Particles2D.texture = particleTexture #$Particles2D.texture = particleTexture
if username_text_instance != null: if username_text_instance != null:
username_text_instance.name = "username" + name username_text_instance.name = "username" + name
if $Particles2D.position.x > 0 and direction != "left": if $Particles2D.position.x > 0 and direction != "left":
@ -307,7 +307,7 @@ func enable_trajectory_line(new_trajectory_line:String):
x.queue_free() x.queue_free()
var x = bullet_trajectory[new_trajectory_line].instance() var x = bullet_trajectory[new_trajectory_line].instance()
print(x) # print(x)
get_node('weaponHolder/Player-character-theme-gun/shoot_point').add_child(x) get_node('weaponHolder/Player-character-theme-gun/shoot_point').add_child(x)

View File

@ -2,7 +2,6 @@ extends Node2D
var current_spawn_location_instance_number = 1 var current_spawn_location_instance_number = 1
var current_player_location_instance_number = null var current_player_location_instance_number = null
var time = 20
var globalActivePhase = null var globalActivePhase = null
@ -10,7 +9,6 @@ func _ready() -> void:
get_tree().connect("network_peer_disconnected", self, "_player_disconnected") get_tree().connect("network_peer_disconnected", self, "_player_disconnected")
if get_tree().is_network_server(): if get_tree().is_network_server():
setup_player_positions() setup_player_positions()
Global.start_game(true)
func setup_player_positions() -> void: func setup_player_positions() -> void:
for player in PersistentNodes.get_children(): for player in PersistentNodes.get_children():
@ -29,11 +27,3 @@ func _player_disconnected(id) -> void:
PersistentNodes.get_node(str(id)).queue_free() PersistentNodes.get_node(str(id)).queue_free()
func _on_timer_timeout():
time -= 1
func _process(_delta):
globalActivePhase = Global.get_current_phase()
if globalActivePhase["active"] != null:
$timer.text = str(globalActivePhase["active"]["phase_name"])

View File

@ -240,16 +240,6 @@ animations = [ {
"name": "move-speed-right-03", "name": "move-speed-right-03",
"speed": 35.0 "speed": 35.0
}, { }, {
"frames": [ ExtResource( 162 ), ExtResource( 135 ), ExtResource( 146 ), ExtResource( 141 ), ExtResource( 143 ), ExtResource( 163 ), ExtResource( 149 ), ExtResource( 136 ), ExtResource( 154 ), ExtResource( 137 ), ExtResource( 165 ), ExtResource( 142 ), ExtResource( 139 ), ExtResource( 159 ), ExtResource( 140 ), ExtResource( 155 ), ExtResource( 144 ), ExtResource( 151 ), ExtResource( 153 ), ExtResource( 166 ) ],
"loop": true,
"name": "boost-speed-left-04",
"speed": 50.0
}, {
"frames": [ ExtResource( 99 ), ExtResource( 83 ), ExtResource( 109 ), ExtResource( 111 ), ExtResource( 101 ), ExtResource( 96 ), ExtResource( 79 ), ExtResource( 132 ), ExtResource( 119 ), ExtResource( 80 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 106 ), ExtResource( 121 ), ExtResource( 129 ), ExtResource( 100 ), ExtResource( 108 ), ExtResource( 110 ), ExtResource( 120 ) ],
"loop": true,
"name": "move-speed-right-04",
"speed": 35.0
}, {
"frames": [ ExtResource( 99 ), ExtResource( 83 ), ExtResource( 109 ), ExtResource( 111 ), ExtResource( 101 ), ExtResource( 96 ), ExtResource( 79 ), ExtResource( 132 ), ExtResource( 119 ), ExtResource( 80 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 106 ), ExtResource( 121 ), ExtResource( 129 ), ExtResource( 100 ), ExtResource( 108 ), ExtResource( 110 ), ExtResource( 120 ) ], "frames": [ ExtResource( 99 ), ExtResource( 83 ), ExtResource( 109 ), ExtResource( 111 ), ExtResource( 101 ), ExtResource( 96 ), ExtResource( 79 ), ExtResource( 132 ), ExtResource( 119 ), ExtResource( 80 ), ExtResource( 85 ), ExtResource( 86 ), ExtResource( 87 ), ExtResource( 106 ), ExtResource( 121 ), ExtResource( 129 ), ExtResource( 100 ), ExtResource( 108 ), ExtResource( 110 ), ExtResource( 120 ) ],
"loop": true, "loop": true,
"name": "boost-speed-right-04", "name": "boost-speed-right-04",

View File

@ -1,18 +1,31 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=18 format=2]
[ext_resource path="res://source/assets/scripts/server_handlers/trinity_site_level_playground.gd" type="Script" id=1] [ext_resource path="res://source/assets/scripts/server_handlers/trinity_site_level_playground.gd" type="Script" id=1]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=2] [ext_resource path="res://source/assets/scripts/ui_element_handlers/UI.gd" type="Script" id=2]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_0.svg" type="Texture" id=3] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_0.svg" type="Texture" id=3]
[ext_resource path="res://source/fonts/roboto/Roboto-Regular.ttf" type="DynamicFontData" id=4]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/winner.gd" type="Script" id=5]
[ext_resource path="res://source/assets/scripts/ui_element_handlers/game_UI.gd" type="Script" id=6]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_4.svg" type="Texture" id=7] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_4.svg" type="Texture" id=7]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_3.svg" type="Texture" id=8] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_3.svg" type="Texture" id=8]
[ext_resource path="res://source/entities/grass/grass_node.tscn" type="PackedScene" id=9] [ext_resource path="res://source/entities/grass/grass_node.tscn" type="PackedScene" id=9]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_2.svg" type="Texture" id=10] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_2.svg" type="Texture" id=10]
[ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_1.svg" type="Texture" id=11] [ext_resource path="res://source/levels/trinity_site/images/trinity_site_level_layout_level_design_z_index_1.svg" type="Texture" id=11]
[ext_resource path="res://source/fonts/oxygen/oxygen_bold.tres" type="DynamicFont" id=12]
[ext_resource path="res://source/scenes/OVERLAY/elements/menu_button.tscn" type="PackedScene" id=13] [ext_resource path="res://source/scenes/OVERLAY/elements/menu_button.tscn" type="PackedScene" id=13]
[ext_resource path="res://source/scenes/OVERLAY/elements/user_input.tscn" type="PackedScene" id=15]
[ext_resource path="res://source/scenes/OVERLAY/elements/timer.tscn" type="PackedScene" id=17]
[ext_resource path="res://source/scenes/OVERLAY/elements/trajectory_control.tscn" type="PackedScene" id=18]
[ext_resource path="res://source/assets/scripts/trinity_site_body_handler.gd" type="Script" id=46] [ext_resource path="res://source/assets/scripts/trinity_site_body_handler.gd" type="Script" id=46]
[node name="trinity-site" type="Node2D"] [sub_resource type="DynamicFont" id=1]
size = 120
outline_size = 7
outline_color = Color( 0, 0, 0, 1 )
use_mipmaps = true
use_filter = true
font_data = ExtResource( 4 )
[node name="trinity-site-playground" type="Node2D"]
script = ExtResource( 1 ) script = ExtResource( 1 )
[node name="trinity_site_body" type="StaticBody2D" parent="."] [node name="trinity_site_body" type="StaticBody2D" parent="."]
@ -136,84 +149,85 @@ __meta__ = {
[node name="UI" type="CanvasLayer" parent="."] [node name="UI" type="CanvasLayer" parent="."]
script = ExtResource( 2 ) script = ExtResource( 2 )
[node name="timer" type="Label" parent="."] [node name="game_UI" type="CanvasLayer" parent="."]
margin_right = 589.0 script = ExtResource( 6 )
margin_bottom = 175.0
custom_fonts/font = ExtResource( 12 ) [node name="winner" type="Label" parent="game_UI"]
text = "null" anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = 2.37842
margin_top = -35.5
margin_right = 2.37842
margin_bottom = 106.5
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
custom_constants/shadow_offset_x = 6
custom_constants/shadow_offset_y = 6
custom_fonts/font = SubResource( 1 )
text = "You are the winner"
align = 1
valign = 1
script = ExtResource( 5 )
__meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false
}
[node name="win_timer" type="Timer" parent="game_UI/winner"]
wait_time = 4.0
[node name="loser" type="Label" parent="game_UI"]
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = 2.37842
margin_top = -35.5
margin_right = 2.37842
margin_bottom = 106.5
custom_fonts/font = SubResource( 1 )
custom_colors/font_color_shadow = Color( 0, 0, 0, 1 )
custom_constants/shadow_offset_x = 6
custom_constants/shadow_offset_y = 6
text = "You lost"
align = 1 align = 1
valign = 1 valign = 1
__meta__ = { __meta__ = {
"_edit_lock_": true,
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="controls" type="Control" parent="."] [node name="controls" type="Control" parent="."]
margin_right = 1920.0 margin_left = -2.1189
margin_right = 1917.88
margin_bottom = 1080.0 margin_bottom = 1080.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="menu_button" parent="controls" instance=ExtResource( 13 )] [node name="menu_button" parent="controls" instance=ExtResource( 13 )]
anchor_left = 1.0 margin_right = 50.0
anchor_right = 1.0 margin_bottom = 50.0
margin_left = -70.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = 70.0
[node name="Line" type="Button" parent="controls"] [node name="user_input" parent="controls" instance=ExtResource( 15 )]
anchor_left = 0.018 anchor_left = 0.5
anchor_top = 0.875 anchor_top = 0.5
anchor_right = 0.06 anchor_right = 0.5
anchor_bottom = 0.95 anchor_bottom = 0.5
margin_left = 8.82419 margin_left = -240.0
margin_top = -6.4104 margin_top = -65.0
margin_right = 47.8242 margin_right = 240.0
margin_bottom = 13.5896 margin_bottom = 91.0
text = "Line"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Sine" type="Button" parent="controls"] [node name="trajectory_control" parent="controls" instance=ExtResource( 18 )]
anchor_left = 0.018 anchor_top = 1.0
anchor_top = 0.875 anchor_bottom = 1.0
anchor_right = 0.06 margin_top = -150.0
anchor_bottom = 0.95 margin_bottom = 0.0
margin_left = 126.824
margin_top = -6.4104
margin_right = 165.824
margin_bottom = 13.5896
text = "Sine"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Parab" type="Button" parent="controls"] [node name="timer" parent="controls" instance=ExtResource( 17 )]
anchor_left = 0.018 anchor_left = 0.5
anchor_top = 0.875 anchor_right = 0.5
anchor_right = 0.06 margin_left = -225.0
anchor_bottom = 0.95 margin_right = 225.0
margin_left = 241.824
margin_top = -6.4104
margin_right = 307.824
margin_bottom = 13.5896
text = "Parabola"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Hyper" type="Button" parent="controls"] [connection signal="timeout" from="game_UI/winner/win_timer" to="game_UI/winner" method="_on_win_timer_timeout"]
anchor_left = 0.018
anchor_top = 0.875
anchor_right = 0.06
anchor_bottom = 0.95
margin_left = 356.824
margin_top = -6.4104
margin_right = 433.824
margin_bottom = 13.5896
text = "Hyperbola"
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -54,8 +54,8 @@ margin_left = -150.0
margin_top = -36.0 margin_top = -36.0
margin_right = 150.0 margin_right = 150.0
margin_bottom = 36.0 margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 5 ) custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "PLAY" text = "PLAY"
align = 1 align = 1
valign = 1 valign = 1
@ -79,8 +79,8 @@ margin_left = -98.8223
margin_top = -36.0 margin_top = -36.0
margin_right = 134.178 margin_right = 134.178
margin_bottom = 36.0 margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 5 ) custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "LAN Party" text = "LAN Party"
align = 1 align = 1
valign = 1 valign = 1
@ -111,8 +111,8 @@ margin_left = -150.0
margin_top = -36.0 margin_top = -36.0
margin_right = 150.0 margin_right = 150.0
margin_bottom = 36.0 margin_bottom = 36.0
custom_colors/font_color = Color( 0, 0, 0, 1 )
custom_fonts/font = ExtResource( 5 ) custom_fonts/font = ExtResource( 5 )
custom_colors/font_color = Color( 0, 0, 0, 1 )
text = "EXIT" text = "EXIT"
align = 1 align = 1
valign = 1 valign = 1