toggle menu
Categories
Discussions
Dashboard
Sign In
·
Register
Sign In
·
Register
Categories
Discussions
Dashboard
Sign In
·
Register
×
Home
›
GameSalad 101
›
Working with GS (Mac)
Generating a random number
Sheldon392
Member
Posts:
43
June 2011
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
mangaroo
Member
Posts:
419
June 2011
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
AppsRacK
Member
Posts:
346
June 2011
just use the random function in the attributes.
spawn actor
self.position.x = Random (actor. width/2, (screensize.width- actor.width/2))
Sheldon392
Member
Posts:
43
June 2011
thanks
Sign In
or
Register
to comment.
Comments
change position y to random(min,max)
min,max = lowest y position & highest y position - it will pick a value at random between those
spawn actor
self.position.x = Random (actor. width/2, (screensize.width- actor.width/2))