mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2025-12-16 05:20:06 +01:00
14 lines
342 B
GDScript
14 lines
342 B
GDScript
extends Area3D
|
|
|
|
|
|
var taken: bool = false
|
|
|
|
|
|
func _on_coin_body_enter(body: Node) -> void:
|
|
if not taken and body is Player:
|
|
$Animation.play(&"take")
|
|
taken = true
|
|
# We've already checked whether the colliding body is a Player, which has a `coins` property.
|
|
# As a result, we can safely increment its `coins` property.
|
|
body.coins += 1
|