Moving the opposite way

allaboutiweballaboutiweb Member Posts: 42
edited November -1 in Working with GS (Mac)
I am building a game thus. A player picks a number between 1 and 20, then the iPad picks a random number between 1 and 20. The 2 numbers are aded together which causes an actor to move either up or down the screen depending on who selects the highest number. If it is the player it moves up, if it is the iPad it moves down.

I created 2 Real attributes, player 1 and player 2 which remembers the selection so the movement (using the Move To behavior) is the two added together in the Y axis. But obviously that only moves the actor one way.

Are there any maths geniuses that can tell me how to move them the opposite way (ie as if the iPad has picked the larger number).

Cheers

Tim

Comments

  • AsymptoteellAsymptoteell Member Posts: 1,362
    If player 1> player 2
    Then. Move to (player 1+player2)

    If player 2>player 1, then move to -(player 1+player2)
  • allaboutiweballaboutiweb Member Posts: 42
    @Asymptoteell....I believe the technical term is WOOHOO!!!

    Thanks very much, spot on. Now all I have to do is work out a non-repeating random!!! Grrrrr
Sign In or Register to comment.