diff --git a/source/assets/scripts/player_handlers/player_body_handler.gd b/source/assets/scripts/player_handlers/player_body_handler.gd index 3293072..804f481 100644 --- a/source/assets/scripts/player_handlers/player_body_handler.gd +++ b/source/assets/scripts/player_handlers/player_body_handler.gd @@ -154,6 +154,16 @@ func process_rotation(): func _process(_delta: float) -> void: + #print(Global.get('control')) +# if Global.get('control')._on_line_pressed(): +# enable_trajectory('line') +# if Global.get('control')._on_sine_pressed(): +# enable_trajectory('sine') +# if Global.get('control')._on_parab_pressed(): +# enable_trajectory('parab') +# if Global.get('control')._on_hyper_pressed(): +# enable_trajectory('hyper') + user_input = UIN_preset_pre_processor_instance.update(Global.get_current_phase()) if get_tree().is_network_server(): Global.phase_update_global() @@ -164,9 +174,9 @@ func _process(_delta: float) -> void: clientPhase = puppet_phase Global.set_current_phase(clientPhase) $"weaponHolder/Player-character-theme-gun".play(theme) - particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-" + theme + ".png") - particleTexture.create_from_image(particleImage) - $Particles2D.texture = particleTexture + #particleImage.load("res://source/assets/sprites/character/player/theme/" + theme + "/na/Player-character-theme-particle-"+theme+".png") + #particleTexture.create_from_image(particleImage) + #$Particles2D.texture = particleTexture if username_text_instance != null: username_text_instance.name = "username" + name if $Particles2D.position.x > 0 and direction != "left": @@ -268,7 +278,7 @@ func _physics_process(delta) -> void: move_and_slide(velocityVDIR.rotated(rotationalHolder)) rotate_weapon() choose_trajectory() - enable_trajectory_line(trajectory_line) + #enable_trajectory_line(trajectory_line) if user_input["shoot"] and can_shoot and not is_reloading: rpc("shoot", trajectory) is_reloading = true @@ -297,10 +307,6 @@ func _physics_process(delta) -> void: func choose_trajectory(): - Global.get('line_button') - Global.get('sine_button') - Global.get('parab_button') - Global.get('hyper_button') if Input.is_action_just_pressed("line"): trajectory = 'line' @@ -324,10 +330,27 @@ sync func shoot(new_trajectory:String): func enable_trajectory_line(new_trajectory_line:String): +# var x = bullet_trajectory[new_trajectory_line].instance() +# #print(x) +# get_parent().add_child(x) +# x.global_position = shoot_point.global_position +# x.global_rotation = shoot_point.global_rotation + for x in get_node('weaponHolder/Player-character-theme-gun/shoot_point').get_children(): #if there is gun remove it + x.queue_free() + 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 + print(x) + get_node('weaponHolder/Player-character-theme-gun/shoot_point').add_child(x) + + + +func enable_trajectory(new_trajectory_line:String): + for gun in get_children(): #if there is gun remove it + gun.queue_free() + + var gun = bullet_trajectory[new_trajectory_line].instance() + add_child(gun) + pass func _draw(): diff --git a/source/assets/scripts/server_handlers/global.gd b/source/assets/scripts/server_handlers/global.gd index f5ba27e..af8b93c 100644 --- a/source/assets/scripts/server_handlers/global.gd +++ b/source/assets/scripts/server_handlers/global.gd @@ -9,6 +9,7 @@ var sine_button var parab_button var hyper_button var global +var control var clientPhase = { "0": { diff --git a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd index 4ee2205..6995a64 100644 --- a/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd +++ b/source/assets/scripts/shooting/Hyperbola/Hyperbolic_Barrel.gd @@ -15,23 +15,39 @@ func _ready(): pos = Global.get("player").get_node('weaponHolder/Player-character-theme-gun').position -func _draw(): - update() - if pos.x > 0: - if dot_position.x < 1000: +#func _draw(): +# update() +# if pos.x > 0: +# if dot_position.x < 1000: +# velocity.x = 10 +# velocity.y = a_parameter/(time*b_parameter) +# dot_position += velocity * speed_hyper * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# if pos.x < 0: +# if dot_position.x < 1000: +# velocity.x = 10 +# velocity.y = -a_parameter/(time*b_parameter) +# dot_position += velocity * speed_hyper * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + + +func trajectory(): + while dot_position.x < 1000: + if true: + add_point(dot_position) velocity.x = 10 velocity.y = a_parameter/(time*b_parameter) dot_position += velocity * speed_hyper * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 - if pos.x < 0: - if dot_position.x < 1000: - velocity.x = 10 - velocity.y = -a_parameter/(time*b_parameter) - dot_position += velocity * speed_hyper * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) - time += 0.06944 - +# if pos.x < 0: +# add_point(dot_position) +# velocity.x = 10 +# velocity.y = -a_parameter/(time*b_parameter) +# dot_position += velocity * speed_hyper * 0.06944 +# time += 0.06944 func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Line/Line_Barrel.gd b/source/assets/scripts/shooting/Line/Line_Barrel.gd index 35f9e74..84c4c97 100644 --- a/source/assets/scripts/shooting/Line/Line_Barrel.gd +++ b/source/assets/scripts/shooting/Line/Line_Barrel.gd @@ -8,14 +8,25 @@ var time = 0 var a_parameter = 0 -func _draw(): - if dot_position.x < 1000: +#func _draw(): +# if dot_position.x < 1000: +# velocity.y = 10 * a_parameter +# velocity.x = 10 +# dot_position += velocity * speed * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + + +func trajectory(): + while dot_position.x < 1000: + add_point(dot_position) velocity.y = 10 * a_parameter velocity.x = 10 dot_position += velocity * speed * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 + pass func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd b/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd index 8097f78..b741d04 100644 --- a/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd +++ b/source/assets/scripts/shooting/Parabola/Parabolic_Barrel.gd @@ -12,23 +12,40 @@ var pos func _ready(): pos = Global.get("player").get_node('weaponHolder/Player-character-theme-gun').position -func _draw(): - if pos.x > 0: - if dot_position.x < 1000: +#func _draw(): +# if pos.x > 0: +# if dot_position.x < 1000: +# velocity.y = time*(a_parameter * time + b_parameter) +# velocity.x = 5 +# dot_position += velocity * speed_parab * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# if pos.x < 0: +# if dot_position.x < 1000: +# velocity.y = -time*(a_parameter * time + b_parameter) +# velocity.x = 5 +# dot_position += velocity * speed_parab * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 +# + +func trajectory(): + while dot_position.x < 1000: + if pos.x > 0: + add_point(dot_position) velocity.y = time*(a_parameter * time + b_parameter) velocity.x = 5 dot_position += velocity * speed_parab * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 - if pos.x < 0: - if dot_position.x < 1000: + if pos.x < 0: + add_point(dot_position) velocity.y = -time*(a_parameter * time + b_parameter) velocity.x = 5 dot_position += velocity * speed_parab * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 func _process(_delta): + trajectory() update() diff --git a/source/assets/scripts/shooting/Sine/Sine_Barrel.gd b/source/assets/scripts/shooting/Sine/Sine_Barrel.gd index f093b70..a37190a 100644 --- a/source/assets/scripts/shooting/Sine/Sine_Barrel.gd +++ b/source/assets/scripts/shooting/Sine/Sine_Barrel.gd @@ -10,13 +10,22 @@ export var amplitude = 4 export var frequency = 5 -func _draw(): - if dot_position.x < 1000: +#func _draw(): +# if dot_position.x < 1000: +# velocity.y = amplitude * cos(time * frequency) +# velocity.x = 5 +# dot_position += velocity * speed * 0.06944 +# draw_circle(dot_position, 2, Color(225, 225, 225)) +# time += 0.06944 + +func trajectory(): + while dot_position.x < 1000: + add_point(dot_position) velocity.y = amplitude * cos(time * frequency) velocity.x = 5 dot_position += velocity * speed * 0.06944 - draw_circle(dot_position, 2, Color(225, 225, 225)) time += 0.06944 func _process(_delta): + trajectory() update() diff --git a/source/entities/player/player_node.tscn b/source/entities/player/player_node.tscn index b63716a..7b2cfa9 100644 --- a/source/entities/player/player_node.tscn +++ b/source/entities/player/player_node.tscn @@ -249,14 +249,19 @@ animations = [ { "name": "boost-speed-left-04", "speed": 50.0 }, { -"frames": [ ExtResource( 114 ), ExtResource( 128 ), ExtResource( 93 ), ExtResource( 107 ), ExtResource( 117 ), ExtResource( 102 ), ExtResource( 81 ), ExtResource( 118 ), ExtResource( 76 ), ExtResource( 115 ), ExtResource( 127 ), ExtResource( 123 ), ExtResource( 113 ), ExtResource( 77 ), ExtResource( 78 ), ExtResource( 124 ), ExtResource( 94 ), ExtResource( 112 ), ExtResource( 131 ), ExtResource( 95 ) ], +"frames": [ ExtResource( 73 ), ExtResource( 57 ), ExtResource( 65 ), ExtResource( 64 ), ExtResource( 54 ), ExtResource( 71 ), ExtResource( 58 ), ExtResource( 66 ), ExtResource( 62 ), ExtResource( 59 ), ExtResource( 56 ), ExtResource( 60 ), ExtResource( 63 ), ExtResource( 50 ), ExtResource( 61 ), ExtResource( 67 ), ExtResource( 72 ), ExtResource( 51 ), ExtResource( 68 ), ExtResource( 69 ) ], "loop": true, "name": "boost-speed-right-03", "speed": 50.0 }, { -"frames": [ ExtResource( 5 ), ExtResource( 42 ), ExtResource( 35 ), ExtResource( 24 ), ExtResource( 8 ), ExtResource( 31 ), ExtResource( 30 ), ExtResource( 38 ), ExtResource( 10 ), ExtResource( 43 ), ExtResource( 41 ), ExtResource( 33 ), ExtResource( 44 ), ExtResource( 19 ), ExtResource( 29 ), ExtResource( 25 ), ExtResource( 36 ), ExtResource( 12 ), ExtResource( 45 ), ExtResource( 21 ) ], +"frames": [ ExtResource( 48 ), ExtResource( 4 ), ExtResource( 3 ), ExtResource( 46 ), ExtResource( 47 ), ExtResource( 32 ), ExtResource( 13 ), ExtResource( 40 ), ExtResource( 6 ), ExtResource( 15 ), ExtResource( 22 ), ExtResource( 14 ), ExtResource( 9 ), ExtResource( 37 ), ExtResource( 23 ), ExtResource( 39 ), ExtResource( 20 ), ExtResource( 18 ), ExtResource( 7 ), ExtResource( 34 ) ], "loop": true, -"name": "move-speed-right-01", +"name": "idle-speed-left-01", +"speed": 25.0 +}, { +"frames": [ ExtResource( 48 ), ExtResource( 4 ), ExtResource( 3 ), ExtResource( 46 ), ExtResource( 47 ), ExtResource( 32 ), ExtResource( 13 ), ExtResource( 40 ), ExtResource( 6 ), ExtResource( 15 ), ExtResource( 22 ), ExtResource( 14 ), ExtResource( 9 ), ExtResource( 37 ), ExtResource( 23 ), ExtResource( 39 ), ExtResource( 20 ), ExtResource( 18 ), ExtResource( 7 ), ExtResource( 34 ) ], +"loop": true, +"name": "move-speed-left-01", "speed": 35.0 }, { "frames": [ ExtResource( 167 ), ExtResource( 157 ), ExtResource( 158 ), ExtResource( 126 ), ExtResource( 90 ), ExtResource( 89 ), ExtResource( 97 ), ExtResource( 88 ), ExtResource( 98 ), ExtResource( 91 ), ExtResource( 125 ), ExtResource( 105 ), ExtResource( 82 ), ExtResource( 84 ), ExtResource( 92 ), ExtResource( 103 ), ExtResource( 122 ), ExtResource( 130 ), ExtResource( 104 ), ExtResource( 116 ) ], @@ -300,7 +305,7 @@ radius = 41.5403 animations = [ { "frames": [ ExtResource( 170 ) ], "loop": true, -"name": "02", +"name": "03", "speed": 5.0 }, { "frames": [ ExtResource( 27 ) ], diff --git a/source/entities/shooting/Line_Trajectory/Line_Bullet.tscn b/source/entities/shooting/Line_Trajectory/Line_Bullet.tscn index 9675fcd..76383e2 100644 --- a/source/entities/shooting/Line_Trajectory/Line_Bullet.tscn +++ b/source/entities/shooting/Line_Trajectory/Line_Bullet.tscn @@ -7,15 +7,11 @@ radius = 9.85811 height = 35.0082 -[node name="player_character_bullet" type="Sprite" groups=[ -"Net", -]] +[node name="player_character_bullet" type="Sprite" groups=["Net"]] texture = ExtResource( 1 ) script = ExtResource( 2 ) -[node name="hitbox" type="Area2D" parent="." groups=[ -"Player_damager", -]] +[node name="hitbox" type="Area2D" parent="." groups=["Player_damager"]] [node name="CollisionShape2D" type="CollisionShape2D" parent="hitbox"] position = Vector2( 10.8253, -0.381073 ) diff --git a/source/entities/shooting/Sine_Trajectory/Sine_Barrel.tscn b/source/entities/shooting/Sine_Trajectory/Sine_Barrel.tscn index 5c2db70..3a0e275 100644 --- a/source/entities/shooting/Sine_Trajectory/Sine_Barrel.tscn +++ b/source/entities/shooting/Sine_Trajectory/Sine_Barrel.tscn @@ -4,5 +4,4 @@ [node name="Sine_Barrel" type="Line2D"] show_behind_parent = true -width = 4.0 script = ExtResource( 1 ) diff --git a/source/levels/trinity_site/trinity_site_level.tscn b/source/levels/trinity_site/trinity_site_level.tscn index 5649f4d..ad7a708 100644 --- a/source/levels/trinity_site/trinity_site_level.tscn +++ b/source/levels/trinity_site/trinity_site_level.tscn @@ -160,10 +160,10 @@ 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 +custom_fonts/font = SubResource( 1 ) text = "You are the winner" align = 1 valign = 1 diff --git a/source/scenes/GUI/main_menu.tscn b/source/scenes/GUI/main_menu.tscn index 308c53f..c298a45 100644 --- a/source/scenes/GUI/main_menu.tscn +++ b/source/scenes/GUI/main_menu.tscn @@ -54,8 +54,8 @@ margin_left = -150.0 margin_top = -36.0 margin_right = 150.0 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "PLAY" align = 1 valign = 1 @@ -79,8 +79,8 @@ margin_left = -98.8223 margin_top = -36.0 margin_right = 134.178 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "LAN Party" align = 1 valign = 1 @@ -111,8 +111,8 @@ margin_left = -150.0 margin_top = -36.0 margin_right = 150.0 margin_bottom = 36.0 -custom_fonts/font = ExtResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = ExtResource( 5 ) text = "EXIT" align = 1 valign = 1 diff --git a/source/scenes/OVERLAY/elements/Trajectory_Control.gd b/source/scenes/OVERLAY/elements/Trajectory_Control.gd new file mode 100644 index 0000000..5ae7223 --- /dev/null +++ b/source/scenes/OVERLAY/elements/Trajectory_Control.gd @@ -0,0 +1,34 @@ +extends Control + +var on_line_pressed = false +var on_sine_pressed = false +var on_parab_pressed = false +var on_hyper_pressed = false + +func _ready(): + Global.set('control', self) + + + +func _on_line_pressed(): + Global.get('player').enable_trajectory_line('line') + #Global.get('player').choose_trajectory('line') + pass # Replace with function body. + + +func _on_parabol_pressed(): + Global.get('player').enable_trajectory_line('parab') + #Global.get('player').choose_trajectory('parab') + pass # Replace with function body. + + +func _on_hyperbol_pressed(): + Global.get('player').enable_trajectory_line('hyper') + #Global.get('player').trajectory_line = 'hyper' + pass # Replace with function body. + + +func _on_sine_pressed(): + Global.get('player').enable_trajectory_line('sine') + #Global.get('player').trajectory_line = 'sine' + pass # Replace with function body. diff --git a/source/scenes/OVERLAY/elements/trajectory_control.tscn b/source/scenes/OVERLAY/elements/trajectory_control.tscn index ba01923..364c5c1 100644 --- a/source/scenes/OVERLAY/elements/trajectory_control.tscn +++ b/source/scenes/OVERLAY/elements/trajectory_control.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=2] +[gd_scene load_steps=16 format=2] [ext_resource path="res://source/assets/sprites/GUI/in_game/trajectories/background.svg" type="Texture" id=1] [ext_resource path="res://source/assets/sprites/GUI/in_game/trajectories/line_inactive.svg" type="Texture" id=2] @@ -10,6 +10,7 @@ [ext_resource path="res://source/assets/sprites/GUI/in_game/trajectories/hyperbol_inactive.svg" type="Texture" id=8] [ext_resource path="res://source/assets/sprites/GUI/in_game/trajectories/hyperbol_active.svg" type="Texture" id=9] [ext_resource path="res://source/fonts/oxygen/Oxygen-Regular.ttf" type="DynamicFontData" id=10] +[ext_resource path="res://source/scenes/OVERLAY/elements/Trajectory_Control.gd" type="Script" id=11] [sub_resource type="StyleBoxTexture" id=1] texture = ExtResource( 1 ) @@ -61,8 +62,8 @@ margin_left = 128.0 margin_top = 24.0 margin_right = 253.0 margin_bottom = 35.0 -custom_fonts/font = SubResource( 3 ) custom_colors/font_color = Color( 0.113725, 0.203922, 0.552941, 1 ) +custom_fonts/font = SubResource( 3 ) text = "Government issued - v/613.92.1" align = 1 valign = 1 @@ -98,8 +99,8 @@ anchor_bottom = 1.0 margin_left = 11.0 margin_top = -18.0 margin_right = -11.0 -custom_fonts/font = SubResource( 4 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 4 ) text = "line" align = 1 valign = 1 @@ -132,8 +133,8 @@ anchor_bottom = 1.0 margin_left = 11.0 margin_top = -18.0 margin_right = -11.0 -custom_fonts/font = SubResource( 4 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 4 ) text = "parabol" align = 1 valign = 1 @@ -167,8 +168,8 @@ anchor_bottom = 1.0 margin_left = 11.0 margin_top = -18.0 margin_right = -11.0 -custom_fonts/font = SubResource( 4 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 4 ) text = "hyperbol" align = 1 valign = 1 @@ -202,8 +203,8 @@ margin_left = 11.0 margin_top = -18.0 margin_right = -11.0 margin_bottom = 1.0 -custom_fonts/font = SubResource( 4 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 4 ) text = "sin" align = 1 valign = 1 @@ -212,3 +213,16 @@ __meta__ = { "_edit_lock_": true, "_edit_use_anchors_": false } + +[node name="Control" type="Control" parent="."] +margin_right = 40.0 +margin_bottom = 40.0 +script = ExtResource( 11 ) +__meta__ = { +"_edit_use_anchors_": false +} + +[connection signal="pressed" from="line" to="Control" method="_on_line_pressed"] +[connection signal="pressed" from="parabol" to="Control" method="_on_parabol_pressed"] +[connection signal="pressed" from="hyperbol" to="Control" method="_on_hyperbol_pressed"] +[connection signal="pressed" from="sine" to="Control" method="_on_sine_pressed"] diff --git a/source/scenes/OVERLAY/elements/user_input.tscn b/source/scenes/OVERLAY/elements/user_input.tscn index 5acf2ef..f97aba3 100644 --- a/source/scenes/OVERLAY/elements/user_input.tscn +++ b/source/scenes/OVERLAY/elements/user_input.tscn @@ -112,8 +112,8 @@ anchor_bottom = 1.0 margin_left = -39.0 margin_top = -19.0 margin_right = 39.0 -custom_fonts/font = SubResource( 3 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 3 ) text = "line" align = 1 valign = 1 @@ -147,8 +147,8 @@ anchor_bottom = 1.0 margin_left = -39.0 margin_top = -19.0 margin_right = 39.0 -custom_fonts/font = SubResource( 5 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 5 ) text = "parabol" align = 1 valign = 1 @@ -182,8 +182,8 @@ anchor_bottom = 1.0 margin_left = -39.0 margin_top = -19.0 margin_right = 39.0 -custom_fonts/font = SubResource( 7 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 7 ) text = "hyperbol" align = 1 valign = 1 @@ -217,8 +217,8 @@ anchor_bottom = 1.0 margin_left = -39.0 margin_top = -19.0 margin_right = 39.0 -custom_fonts/font = SubResource( 7 ) custom_colors/font_color = Color( 0, 0, 0, 1 ) +custom_fonts/font = SubResource( 7 ) text = "sin" align = 1 valign = 1