Generating a random number

Sheldon392Sheldon392 Member Posts: 43
edited November -1 in Working with GS (Mac)
im making a game where an actor needs to appear at a random Y axis cooridinate but i dont know how to make a random number, can anyone help with this.

Comments

  • mangaroomangaroo Member Posts: 419
    when you get the expression editor, there is a drop down box on the right hand side and there is 'random' in the list

    change position y to random(min,max)

    min,max = lowest y position & highest y position - it will pick a value at random between those
  • AppsRacKAppsRacK Member Posts: 346
    just use the random function in the attributes.
    spawn actor
    self.position.x = Random (actor. width/2, (screensize.width- actor.width/2))
  • Sheldon392Sheldon392 Member Posts: 43
    thanks
Sign In or Register to comment.