collision fix

This commit is contained in:
2025-09-08 22:19:06 +02:00
parent f91ae53533
commit cb4a68898b
7 changed files with 56 additions and 13 deletions

View File

@@ -24,6 +24,7 @@ func _process(delta: float) -> void:
if delay_dup < 1:
delay_dup += delta
linear_velocity = direction * SPEED
func split():
var packed_use: PackedScene
@@ -68,13 +69,22 @@ func _on_body_entered(body: Node) -> void:
body.queue_free()
GameController.emit_signal("point_gain", type, global_position)
split()
elif body is Ship and !body.is_inv():
func _on_body_exited(body: Node) -> void:
if body is Ship:
body.is_currently_hit = false
func _on_area_2d_body_entered(body: Node2D) -> void:
if body is Ship and !body.is_inv():
body.is_currently_hit = true
direction = (global_position - body.global_position).normalized()
body.velocity += direction * 10
#GameController.emit_signal("player_hit")
func _on_body_exited(body: Node) -> void:
if body is Ship:
body.is_currently_hit = false
func _on_area_2d_body_exited(body: Node2D) -> void:
if body is Ship :
body.is_currently_hit = false