police car weak point
This commit is contained in:
parent
324e7d437b
commit
8a173b968d
15 changed files with 203 additions and 9 deletions
|
|
@ -10,12 +10,14 @@ var health: int = 1:
|
|||
if v == 0:
|
||||
queue_free()
|
||||
|
||||
func _on_collision(node: Node3D):
|
||||
if node.has_method("hit"):
|
||||
if node.hit(self):
|
||||
health -= 1
|
||||
|
||||
func _ready() -> void:
|
||||
body_entered.connect(func(body: Node3D):
|
||||
if body.has_method("hit"):
|
||||
body.hit(self)
|
||||
health -= 1
|
||||
)
|
||||
body_entered.connect(_on_collision)
|
||||
area_entered.connect(_on_collision)
|
||||
|
||||
func init(dir: Vector3) -> void:
|
||||
_initialized = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue