# How do I add random pos

0 favourites
• 15 posts
From the Asset Store
• Hi i need to create an object every second who fall, i have done that, but i need to make my blue object to be created at just 3 positions, on the red, on the orange and onthe yellow position, but randomised, how to do that??

• You can use "choose"

For example: spawn object at postition y: value x: choose(value1,value2, value3)

So the system will choose one of the three values of the X-axis and the order will be random.

So the y-axis value is always the same

• whats the correct formula to use??

• What do you mean? If you want to create an object at the position y: 100 and random x: 100 or 200 or 300 you can do it like this:

every 1 seconds - system - create object at position y: 100 x: choose(100, 200, 300)

From the manual:

choose(a, b [, c...])

Choose one of the given parameters at random. E.g. choose(1, 3, 9, 20) randomly picks one of the four numbers and returns that. This also works with strings, e.g. choose("Hello", "Hi") returns either Hello or Hi. Any number of parameters can be used as long as there are at least two.

• i used random(pos1.X,pos2.X,pos3.X) but its wrong :s

• Try to replace "random" with "choose" instead and only use the number values. Not 100.x, 200.x, 300.x just 100, 200, 300.

So create object at:

Y: 100

X: choose(100, 200, 300)

And replace those values with the correct y and x values you want.

Hard to explain. Can be more specific when I'm home from work

• Oki i found :p

• Great, good luck with your project

• Well now i have another problem, the object is falling at randomized 3 positions, but the speed is not constant :s how to make the fallings object to allways have the same speed?

my object has a platform movement :s

• Try working with your platform settings.

gravity and max speed for starters... set your acceleration and deceleration to 0 as well...

• i have a problem with the formula spawn at "x choose(A.X, B.X, C.X) "

almost of time, my object spawn on the left or at the right side and almost never at the center (B.X) someone know why?

• .....if you insist on expression "choose" ..you can write choose(A.X, B.X, B.X,B.X.......C.X,B.X)

• thats oki now i would like to make this, the objects start falling very slowly and each 0.1s the speed of the falling objects speed up?

• Well now i have another problem, the object is falling at randomized 3 positions, but the speed is not constant :s how to make the fallings object to allways have the same speed?

my object has a platform movement :s

thats oki now i would like to make this, the objects start falling very slowly and each 0.1s the speed of the falling objects speed up?

You must be joking....

• ## Try Construct 3

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

Construct 3 users don't see these ads
• well, the problem is, i need the falling object taking more speed with time :s

• 15 posts