So i basically wanna make abutton that is always moving away as soon as your mouse hovers over it.
func _on_mouse_entered():
position = Vector2(50, 0)
thats how far i got. the button moves to given pos after hovering over it but i dont know how to continue it. The button stays at this position i also tried to do this:
func _on_mouse_entered():
position = Vector2(50, 0)
position = Vector2(20, 0)
but it obviously didnt work that way. I hope i explained my question relativly understandable.
Do you want the button to move between a set of specific coordinates? If so, use an array with those coordinates and keep a variable to track the current index in the array.
Then increase that variable each time the signal is received. Just remember to reset it to zero once it hits the size of your index.
If you want it to move relative to its current position instead, you can just do position += or -= to change its value each time, instead of using =. Again you’ll have to figure out what you want to do when it goes off screen, though.