Projectile is actually a parent scene
This commit is contained in:
parent
d1db3ed693
commit
51ffebbf75
|
|
@ -20,6 +20,8 @@ func _process(delta):
|
||||||
position += direction_normal * velocity_pps * delta
|
position += direction_normal * velocity_pps * delta
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_body_entered(body):
|
func _on_body_entered(body):
|
||||||
var colliding_node = body
|
var colliding_node = body
|
||||||
if colliding_node.has_node("Projectile_Receiver"):
|
if colliding_node.has_node("Projectile_Receiver"):
|
||||||
|
|
@ -28,3 +30,7 @@ func _on_body_entered(body):
|
||||||
|
|
||||||
func _on_area_entered(area):
|
func _on_area_entered(area):
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
func _on_VisibilityNotifier2D_screen_exited():
|
||||||
|
queue_free()
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,12 @@
|
||||||
|
|
||||||
[ext_resource path="res://src/classes/projectile.gd" type="Script" id=1]
|
[ext_resource path="res://src/classes/projectile.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="Projectile_Template" type="Area2D"]
|
[node name="Projectile" type="Area2D"]
|
||||||
monitorable = false
|
monitorable = false
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="VisibilityNotifier2D" type="VisibilityNotifier2D" parent="."]
|
||||||
|
|
||||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||||
|
[connection signal="screen_exited" from="VisibilityNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user