expression for random number

Get help using Construct 2

Post » Mon Dec 12, 2016 10:07 am

For example
i have 3 global variables
-A
-B
-C

A is clicking counter
in B system will randomize numbers from 0 to 9
C show which number should not be picked


when global variable 'A' is less than 2
i click LMB and
i set global variable 'B' to int(random(0,10)) without number typed in 'C'
'B' should never display C number or automaticaly random again to avoid display 'C'

when global variable 'A' is more than 2
i click LMB and
i set global variable 'B' to int(random(0,10))
B
25
S
8
Posts: 212
Reputation: 2,167

Post » Mon Dec 12, 2016 10:43 am

While B = C: randomB(10)
Image
B
107
S
24
G
18
Posts: 1,361
Reputation: 22,770

Post » Mon Dec 12, 2016 7:41 pm

@TELLES0808 thanks
tell me in C2 is expression 'is rotating' ?
when i rotate everytick sprite
B
25
S
8
Posts: 212
Reputation: 2,167

Post » Tue Dec 13, 2016 11:22 am

Depend of what behavior you're using to rotate. It's a physic element or you're rotating it by the object directly?

If you're using the physic it will work, else, every time you rotate your object directly, it will not notice the rotation, because it will happen exactly in the moment of the action and only on the next tick will happen again, so, your "is rotating" will not detect it.

To avoid this situation, use it as a sub-action of the same condition:
Condition: "Some condition":
* Action Rotate Object;
* Action: "Do something else"
Image
B
107
S
24
G
18
Posts: 1,361
Reputation: 22,770


Return to How do I....?

Who is online

Users browsing this forum: tarek2 and 55 guests