15 lines
363 B
GDScript
15 lines
363 B
GDScript
extends Node2D
|
|
|
|
@export var fullStop: bool = true
|
|
|
|
func _on_body_entered(body: Node2D) -> void:
|
|
$Label.text = str(body)+ " " + "body entered "
|
|
if body.has_method("brake"):
|
|
(body as Car).brake(fullStop)
|
|
|
|
|
|
func _on_body_exited(body: Node2D) -> void:
|
|
$Label.text = str(body)+ " " + "body exited "
|
|
if body.has_method("accelerate"):
|
|
(body as Car).accelerate()
|