What parameter should I use??

  • Hi,

    I have a ball(bullet) of 300 speed and an angle of motion to random of 360 degrees. This the entered parameter: random(360).

    What parameter should I use to make it randomly in 0 and 180 degrees?

    Thanks in advance. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Do you mean any value between 0 and 180:

    random(0, 181) or random(181)

    Or do you want to pick either 0 or 180:

    choose(0, 180)

    random(a, b)

    Generate a random float between a and b, including a but not including b.

    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'd also advise you to check out System Expressions in the manual.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks man!

    It worked well!

    Keep it up. <img src="smileys/smiley1.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)