diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cc229f2 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +# Godot-specific ignores +.import/ +export.cfg +export_presets.cfg + +# Imported translations (automatically generated from CSV files) +*.translation + +# Mono-specific ignores +.mono/ +data_*/ + +*.import diff --git a/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.md5 b/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.md5 deleted file mode 100644 index 3bec12e..0000000 --- a/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.md5 +++ /dev/null @@ -1,3 +0,0 @@ -source_md5="952a962f6d20acc3a10ace9f4b0baaca" -dest_md5="b89d6940e050aef38a2c90c450d3bf94" - diff --git a/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.scn b/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.scn deleted file mode 100644 index 8bc991b..0000000 Binary files a/.import/Handgun.gltf-dfc6de5a6d72ba5ef43f43a4cd2ab91e.scn and /dev/null differ diff --git a/GUI/Hitmarker.gd b/GUI/Hitmarker.gd new file mode 100644 index 0000000..097768a --- /dev/null +++ b/GUI/Hitmarker.gd @@ -0,0 +1,10 @@ +extends Control + +var remaining_time = -10.0 + +func activate(time): + remaining_time = time + +func _process(delta): + remaining_time -= delta + self.modulate = Color(1, 1, 1, exp(remaining_time * 10)) diff --git a/Game.gd b/Game.gd index 4bf1315..8f0439c 100644 --- a/Game.gd +++ b/Game.gd @@ -101,6 +101,9 @@ func join_jan(): SERVER_IP = "172.25.166.24" initialize_client() +func set_ip(ip): + SERVER_IP = ip + func set_mouse_sensitivity(sensitivity_multiplier, save=true): if mouse_sensitivity_multiplier != sensitivity_multiplier: mouse_sensitivity_multiplier = sensitivity_multiplier diff --git a/Game.tscn b/Game.tscn index 111a32a..3d57adf 100644 --- a/Game.tscn +++ b/Game.tscn @@ -219,6 +219,7 @@ margin_right = 300.0 margin_bottom = 64.0 text = "Fullscreen" [connection signal="pressed" from="MenuContainer/MainMenu/QuickJoin" to="." method="open_menu" binds= [ "QuickJoinMenu" ]] +[connection signal="text_changed" from="MenuContainer/MainMenu/Destination/IPAdress" to="." method="set_ip"] [connection signal="pressed" from="MenuContainer/MainMenu/NetworkType/Host" to="." method="initialize_server"] [connection signal="pressed" from="MenuContainer/MainMenu/NetworkType/Join" to="." method="initialize_client"] [connection signal="pressed" from="MenuContainer/MainMenu/Options" to="." method="open_menu" binds= [ "OptionsMenu" ]] diff --git a/LevelComponents/LevelGeometry.gd b/LevelComponents/LevelGeometry.gd index 12ddfe9..668d6a5 100644 --- a/LevelComponents/LevelGeometry.gd +++ b/LevelComponents/LevelGeometry.gd @@ -4,5 +4,5 @@ var bulletHitEffect = preload("res://Assets/Effects/BulletHit.tscn") remotesync func on_hit(damage, position): var effect = bulletHitEffect.instance() + add_child(effect) effect.global_transform.origin = position - get_tree().root.call_deferred("add_child", effect) diff --git a/Player.gd b/Player.gd index 9e2c96c..86cdb5f 100644 --- a/Player.gd +++ b/Player.gd @@ -36,10 +36,6 @@ var walkDirInt = Vector2.ZERO var bulletHitEffect = preload("res://Assets/Effects/BulletHit.tscn") -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - func sfx_play_footsteps(): if not sfx_footsteps_play: sfx_footsteps_play = true @@ -175,6 +171,10 @@ func shoot(): if hit.has_method("on_hit"): hit.rpc("on_hit", 30, result.position) + + if hit is get_script(): + print("Is player") + $CrosshairContainer/Hitmarker.activate(.2) func _input(event): if str(get_tree().get_network_unique_id()) != name: diff --git a/Player.tscn b/Player.tscn index 3ac0943..60fc36b 100644 --- a/Player.tscn +++ b/Player.tscn @@ -7,6 +7,7 @@ [ext_resource path="res://Assets/SFX/Player-Step-Concrete-04.wav" type="AudioStream" id=5] [ext_resource path="res://Assets/SFX/Player-Step-Concrete-03.wav" type="AudioStream" id=6] [ext_resource path="res://SoundPlayer.gd" type="Script" id=7] +[ext_resource path="res://GUI/Hitmarker.gd" type="Script" id=8] [sub_resource type="CapsuleShape" id=1] radius = 0.33 @@ -68,7 +69,7 @@ stream = ExtResource( 6 ) stream = ExtResource( 5 ) [node name="SoundPlayer" type="Spatial" parent="Sounds"] -script = ExtResource( 7 ) +script = ExtResource( 8 ) [node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Sounds/SoundPlayer"] @@ -134,13 +135,15 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="CrosshairHitConfirmation" type="Control" parent="CrosshairContainer"] +[node name="Hitmarker" type="Control" parent="CrosshairContainer"] +light_mask = -2147483647 margin_left = 512.0 margin_top = 300.0 margin_right = 512.0 margin_bottom = 300.0 +script = ExtResource( 7 ) -[node name="Line1" type="ColorRect" parent="CrosshairContainer/CrosshairHitConfirmation"] +[node name="Line1" type="ColorRect" parent="CrosshairContainer/Hitmarker"] margin_left = 8.0 margin_top = -1.0 margin_right = 16.0 @@ -151,7 +154,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Line2" type="ColorRect" parent="CrosshairContainer/CrosshairHitConfirmation"] +[node name="Line2" type="ColorRect" parent="CrosshairContainer/Hitmarker"] margin_left = 8.0 margin_top = -1.0 margin_right = 16.0 @@ -162,7 +165,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Line3" type="ColorRect" parent="CrosshairContainer/CrosshairHitConfirmation"] +[node name="Line3" type="ColorRect" parent="CrosshairContainer/Hitmarker"] margin_left = 8.0 margin_top = -1.0 margin_right = 16.0 @@ -173,7 +176,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Line4" type="ColorRect" parent="CrosshairContainer/CrosshairHitConfirmation"] +[node name="Line4" type="ColorRect" parent="CrosshairContainer/Hitmarker"] margin_left = 8.0 margin_top = -1.0 margin_right = 16.0