Good morning if someone can help me I will be grateful
I’ve been trying to solve this problem for days and I’m not sure what’s going on
Basically, I’m trying to get the button to be activated only when the box is on top of it, but when I place the box on top of the button, it doesn’t change the variable.
(sorry if there is a typo, I’m not sure how to write in English)
Add an object variable to your button like activated = 0
Then check the collision between Box and Button when this happens change the button variable to 1
Condition:
If box is in collision with button
Action: Set button variable activated = 1
Other event to invert:
Condition: Inverted: If box is in collision with button
Action: Set button variable activated = 0
Try to change the foreach object from Button to Caixa. if doen’t work i’m going to need to see more of your other events in context to check whats going on.
Also check the collision hitboxes of both objects and the points in the Piskel related section.
I replicated your code and the Scene Variable works but not the Object Variable. Object Variable works only for 1 button from the group, even using “Repeat for each”. Don’t know why!
instance botao is inside a group named bts.
I tried “caixa is in collision with bts” in Condition
and
Change the Variable Ativado of bts in Action
No success!
I don’t understand enough about object selection to know why the extra variable check is needed, especially with a for each, but it does seem to work that way.
Edit: Actually, this works for me even without the for each:
Actually this is simplified and it works fine. We were missing conditions to pass the information to the text? Is it? Because the Scene variable works without need them.