The idea is to have a node that can be animated (preferably with spritesheet), press and hold until animation loading finish, fade out that node and make other smaller copies of that “button” spread randomly across the screen. That copies also can be touchable, but not hold. Just a tap and disappears.
I know how to verify that the user is touching the screen and add the signal so that it changes state after a certain amount of time, but I don’t know how to reference the specific node that I want to be touched.
I tried using rect2 methods, but they didn’t work. Not really sure if the problem is the button structure or if the type of node is incorrect… If you can give me any recommendations or tutorials, it would be helpful.
I’ve seen on forums that some people use Area2D, but I’m not too convinced by the idea. The most important thing is to find a way that is mobile-friendly and capable of playing an animation. And, if you need more info, let me know.
The problem is about the script, I don’t know how to reference the node I need. I was using an AnimatedSprite2D inside a Character node, but the script I saw in tutorials doesn’t work (get_rect) with that node
I know that the explanation is very general, so I will try to present it as a concept:
func _input(event):
if event is InputEventTouchScreen and event.pressed:
#if touchableNode is pressed then:
#do something...
The commented lines are the script I need to figure out. I try to use the method get_rect(), but apparently it’s not able to use it on AnimatedSprite2D.
Other people use an Area2D and check if the user taps inside the “button” area. But, I wonder if that would be inefficient in some way?
I tried but doesn’t work I made an AnimatedSpride2D inside a Control node, put a signal inside control script (_on_gui_input(event)). Also tried choosing he animated sprite to receive the signal with _on_control_gui_input(event) and nothing happen.