Shoot through

This commit is contained in:
MaddoScientisto 2024-05-26 11:40:35 +02:00
commit 92a82b05df
6 changed files with 31 additions and 42 deletions

View file

@ -24,4 +24,5 @@ editor_description = "Player Bullet"
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="."]
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]

View file

@ -25,9 +25,9 @@ public partial class fragola : RigidBody2D
private void _on_body_entered(Node body)
{
Debug.WriteLine("Collision");
EmitSignal(SignalName.Hit);
}
private void _on_area_2d_area_entered(Area2D area)
{
@ -35,10 +35,10 @@ public partial class fragola : RigidBody2D
Debug.WriteLine("Collision area");
EmitSignal(SignalName.Hit);
if (_isAlive)
if (_isAlive)
{
Explode();
}
}
}
private void Explode()

View file

@ -135,9 +135,10 @@ animations = [{
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Muzzle") groups=["player"]]
collision_layer = 2
collision_mask = 3
collision_mask = 35
script = ExtResource("1_m27vu")
Speed = 2000
Speed = 2500
CrosshairDistance = 20.0
BulletScene = ExtResource("2_ov36d")
Muzzle = NodePath("Muzzle")
metadata/_edit_group_ = true

File diff suppressed because one or more lines are too long