random function

jacob717jacob717 Member Posts: 9

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

  • SummationSummation Member, PRO Posts: 476

    @jacob717 So you're making a game where you need to avoid things flying at you by moving into the gap in-between shots?

  • jacob717jacob717 Member Posts: 9

    @Summation said:
    jacob717 So you're making a game where you need to avoid things flying at you by moving into the gap in-between shots?

    Yeah something like that

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    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?

Sign In or Register to comment.