How to choose random color of objects? For example, I have a square on the screen and every time I click on it it changes its color.
-Native platform has the action “Sprite ==> Effects ==> Global color”, it affects a sprites global color.
-A color is a string “R;G;B”, where R,G and B are integers representing Red, Green and Blue with values in the range 0-255.
-You can get a random number in the range 0-n with the function Random(n)
-You can turn integers into strings with the function ToString(integer)
Thanks! But is it necessary to create a sub event? I just put the condition “The cursor is on Cube” in the first event.
No, it isn’t. But sometimes it’s good for clarity’s sake.
Right, I don’t know what do you want. But if you put all in a single event: if you hold down the left click and move the mouse on the Sprite and outside it, the conditions are fulfilled
Aaaand, I think it has better performance since to check the trigger once, only needs to check the mouse button.
Thanks for explanations! Just don’t want blindly follow instructions, need to understand how it works and why.