my object moving before I triggered it, but that only happened when I started another scene before (the play button and the red box are in different scenes)
it should to be like this. (Doesn’t move if I don’t trigger it with the left mouse click)
here is my events and object variables
is it a bug or something?
In the first scene (with the play button), have you created an action to “Change the scene” on the condition of “Left mouse button is pressed” and “Cursor/touch is on play button”?
yes, I made it like that.
can you explain why it like that?
I mean, why it moving before i trigger it
It seemed that the actions for the second scene were getting triggered as soon as the game started. To deal with this, we used the “Change the scene” action which starts the desired scene only after the corresponding conditions (Left mouse button and Cursor on play button in our case) are true.
I used “change the scene to (the scene with red box)” if “the cursor/touch is on the play button” and “the left mouse button is down” in the scene with play button. But the result is after the play button scene changing to the scene with the red box, the red box is already moving before i triggered it.
I dont want the red box moving before i triggered it. How to fix that?
You should use the “Left mouse button is released” condition instead of “Left mouse button is down”. The problem is that when you click the left mouse button the scene changes. Now because the click is still down, the action of red box’s movement gets triggered as soon as you change the scene.