From e18e3cdf0d7b473453afed3dc5ce153ffa1d72a6 Mon Sep 17 00:00:00 2001 From: unfa Date: Sat, 26 Sep 2020 00:44:21 +0200 Subject: [PATCH] Tweaked crosshair hit marker. disabled collision for dead players. --- Assets/Weapons/Handgun/Casing.gd | 2 +- Player.gd | 15 +++++++++++++-- Player.tscn | 8 ++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/Assets/Weapons/Handgun/Casing.gd b/Assets/Weapons/Handgun/Casing.gd index 588ae02..ddc8c43 100644 --- a/Assets/Weapons/Handgun/Casing.gd +++ b/Assets/Weapons/Handgun/Casing.gd @@ -26,7 +26,7 @@ func _on_Casing_body_entered(body): $AudioStreamPlayer3D.max_db = max(20 - (linear_velocity.length() * 10), 0) $AudioStreamPlayer3D.pitch_scale = rand_range(0.98, 1.02) - print($AudioStreamPlayer3D.max_db) + #print($AudioStreamPlayer3D.max_db) #$AudioStreamPlayer3D.play() collisions += 1 diff --git a/Player.gd b/Player.gd index 17fbc56..80ee7ee 100644 --- a/Player.gd +++ b/Player.gd @@ -169,6 +169,9 @@ master func kill(): gibs.global_transform = global_transform gibs.show() + $CollisionShapeBody.disabled = true + $CollisionShapeFeet.disabled = true + # enable the ragdoll colliders for i in gibs.get_children(): i.get_child(1).disabled = false @@ -178,6 +181,8 @@ master func kill(): is_dead = true $MeshInstance.hide() $Camera/Hand.hide() + $CrosshairContainer.hide() + yield(get_tree().create_timer(3), "timeout") @@ -204,6 +209,11 @@ func spawn(): $MeshInstance.show() $Camera/Hand.show() + $CrosshairContainer.show() + + $CollisionShapeBody.disabled = false + $CollisionShapeFeet.disabled = false + $Camera.rotation = Vector3.ZERO rotation = Vector3.ZERO @@ -223,12 +233,13 @@ func shoot(): if "collider" in result: var hit = result.collider - + if hit.has_method("on_hit"): hit.rpc("on_hit", 30, result.position) if hit is get_script(): - print("Is player") + print("Is a live player") + $CrosshairContainer/HitConfirmation.activate(.2) func _input(event): diff --git a/Player.tscn b/Player.tscn index a0c71e1..1c205ea 100644 --- a/Player.tscn +++ b/Player.tscn @@ -76,9 +76,9 @@ anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -511.401 -margin_top = -300.757 +margin_top = -301.225 margin_right = 512.599 -margin_bottom = 299.243 +margin_bottom = 298.775 __meta__ = { "_edit_use_anchors_": false } @@ -149,6 +149,7 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 45.3067 +rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -160,6 +161,7 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 135.307 +rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -171,6 +173,7 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = 225.306 +rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false @@ -182,6 +185,7 @@ margin_top = -1.0 margin_right = 16.0 margin_bottom = 1.0 rect_rotation = -44.6931 +rect_scale = Vector2( 1, 0.5 ) rect_pivot_offset = Vector2( -8, 1 ) __meta__ = { "_edit_use_anchors_": false