Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | CaueHenrique |
Hello, how can i call animations of other objects?
I’ve tried this, but it doesn’t work.
func on_click():
hand_c.get_node("anim").play("fade_out")
I’ve these objects:
Area2D
hand_c
hand_o
hand_s
All theses nodes inherit hand
hand.tscn code:
extends Area2D
func _ready():
pass
func _on_hand_mouse_entered():
$anim.play("zoom_in")
pass # replace with function body
func _on_hand_mouse_exited():
$anim.play("zoom_out")
func fade_out():
$anim.play("fade_out")
func _on_hand_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton \
and event.button_index == BUTTON_LEFT \
and event.is_pressed():
self.on_click()
How can i call this “fade_out” animation, from one object to other?
Example:
when the user clicks on one hand, the other hands will fade out.
Oh and i forgot to say, it’s a rock-paper-scissors game.