random function
jacob717
Member Posts: 9
in Tech Support
Hey guys. So, I am trying to make my first game and I'm in iPhone portrait mode. I am trying to make it so that an obstacle spawns across the screen and there is only a small gap, the the screen is scrolling vertically. When I am choosing where to make this gap randomly spawn on the obstacle, the random function only gives me a min and max value option, and from watching other videos it seems like this min and max is in relation to the y axis, but i need to create the gap in between a set area on the x axis because the game scrolls vertically.. How can I do that? Sorry if that was hard to understand
Comments
@jacob717 So you're making a game where you need to avoid things flying at you by moving into the gap in-between shots?
Mathtap.com (Android) | Fridgemanager.com (Android) | Breakoutofspace.com (Android)
Yeah something like that
The random(a,b) function picks an integer between a and b. So random(2,5) would pick either 2, 3, 4, or 5. It has nothing to do with x and y positions. Of course, you can enter a random function into the x or y position field of a behavior. How are you currently using the random function with positions? What does your spawn behavior look like?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User