Target multiple objects with same variable?

Hi,
I want to make a custom cursor that switches to a hover animation when it is hovering over a clickable object. I want to do this using variables (any object with a certain variable will be classified as clickable and will make the cursor switch animations). Is there anyway to do this?

I think the way to do it is :

  • Give the clickable objects a text object variable named “CanClick” with default value = “Y”.
  • Add the clickable objects in a group called “Clickables” (or whatever you like).
  • Use Clickables.Variable(CanClick) = “Y”, along with Clickables.MouseOver as your conditions.

I’m pretty new to GDevelop so I’m not 100% sure what you meant on the last one. I took it you meant this:


But then how do I make it switch back to normal animation when its not on anything clickable?

Thanks for the help btw

Make another event that has “The cursor/touch is on Clickable” and then invert it. Right click on the Condition, and select Invert. A little red circular arrow icon will appear by it, this effectively means “when the cursor/touch is NOT on Clickable”. Then have the Action be to change the animation of Mouse to the non-hover animation.

I tried that earlier. When multiple objects are in the Clickable group, for some reason it never switches to the hover animation in the first place. I have no clue why.

There are a few ways to do it. One, which is flexible to later code change and additions, is to have a scene variable, say MouseAnimationNum, and set it to 0 when you set the mouse cursor and light positions. Then, in the actions of the red box box in your image, set this variable to 1 (remove the set mouse animation action). After this event add another event with no condition and set the mouse animation to the MouseAnimationNum.

Nope, I’m still getting the same problem where it doesn’t switch in the first place. This is really weird :confused:

Can you provide the code that you’ve got for it?

Wait nvm xD. I did it wrong now it’s working.

Thanks so much for the help.