How do I have a Sprite move when the player is in the area?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Danielle’sgames

I’m trying to have it that when a player goes into a room, or is near a Sprite3D, that a timer would start and when the Timer has Timed out, the Sprite would move. How do I do this? I’ve tried different things, but it all comes back to the Sprite not moving when the Timer times out.

:bust_in_silhouette: Reply From: dethland

I am not familiar with 3d, so my suggestion may not work. You could use the Area node to create a scanner. Use the “shape_enterd” or “body_entered” signal to check if the player is in the area. Then, connect the signal with the Timer. When the signal is on, start the timer. Use the “time_out” signal of the timer to trigger the Sprite. I don’t know the method you move your sprite, so here is a common way.

func _process(delta):
    if time_over:
        self.x += 10

Hello dethland,

Thank you so much for the help. At first, the animation wasn’t working, but now it is.

Danielle’sgames | 2021-05-12 03:42