# Gives for creating Set Value random variable?

0 favourites
• 8 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
• I got a Global Attack Number = 0

Except that when I tap the "A button", I apply a "Set Value" in varible attack for it to be random from 0 to 4.

The number to leave the set value random, do a different attack when he collision with the target object.

Is to make it so? Or have another way to do this using variable?

• It's hard to understand what you mean, but here's some tips.

You can use the expression 'Choose(0,1,2,3,4)' for picking a value randomly.

Set position will make your object 'blink' to the position, so there'll be no moving effect.

If you want it, you can use bullet behavior, or custom plugin like "Move to".

• sharecast

I did the test here and it worked.

'Choose (0,1,2,3,4)' Just needed to know to do that.

Now I can create AI of enemie for balhata shift system.

Thank you!

• I would like to assign a value between 0 and 151 ...

• Use random(151) - this will return a number from 0 to 150.99999999999

So you if you want to round it to the nearest integer:

round(random(151))

• Thank you !

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• Use random(151) - this will return a number from 0 to 150.99999999999

So you if you want to round it to the nearest integer:

round(random(151))

And if I want to pick a number between, for exemple, 10 and 40?

• random(10, 41)

• 8 posts