sin formula, start position

sin(|game.time|speed)distance+|start position|
How make RANDOM |start position| in this formula?
(+random(min, max)) does not work correctly

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @gamesalad2016

    what do you mean by start position? The position on the scene or the starting angle?

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2018

    (+random(min, max)) does not work correctly

    It works correctly, it's probably just not doing what you want it to do.

    . . . . . . . .

    How make RANDOM start position in this formula?

    If you are after a random starting angle (?) the formula would look like this . . .

    sin((game.time*speed)+random(0,360))*distance+start position

    If you are after a random start position the formula would look like this . . .

    sin(game.time*speed)*distance+ random (A,B)

    (use whatever values you like for A and B to set the range for the random value)

Sign In or Register to comment.