14 lines
426 B
GDScript
14 lines
426 B
GDScript
extends Area2D
|
|
|
|
signal edgehit
|
|
|
|
func _on_TankEdge_body_entered(body: Node) -> void:
|
|
if body.is_in_group("Fish"):
|
|
print("This bitch ass fish just crossed the line at " + str(body.position.x))
|
|
if body.position.x < get_viewport().size.x/2:
|
|
emit_signal("edgehit", "turn right")
|
|
print("Turning the " + body.name + " right.")
|
|
else:
|
|
emit_signal("edgehit", "turn left")
|
|
print("Turning the " + body.name + " left.")
|