Moving the opposite way
allaboutiweb
Member Posts: 42
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
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
Then. Move to (player 1+player2)
If player 2>player 1, then move to -(player 1+player2)
Thanks very much, spot on. Now all I have to do is work out a non-repeating random!!! Grrrrr