Skip to main content
Known Participant
May 12, 2009
Answered

rotation positive and negative numbers

  • May 12, 2009
  • 1 reply
  • 1077 views

Hi all,

I am creating a roulette type game that calculates the winning number based on the rotation of the main wheel. I am using if/else statements to determine the winning number based on the rotation. I am tracing the rotation in the output panel. I would like my rotation to go from 0-360, but the output panel traces 0-180 then it starts counting from "-180-0"

The wheel can spin multiple times. Any idea how to keep the numbers positive from 0-360 and not have to write my if else to accomodate the negative numbers?

Thanks!

This topic has been closed for replies.
Correct answer kglad

var rot:Number = (whatever._rotation+360)%360;

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 12, 2009

var rot:Number = (whatever._rotation+360)%360;

wwscoperAuthor
Known Participant
May 13, 2009

Thanks Kglad! That worked!

kglad
Community Expert
Community Expert
May 13, 2009

you're welcome.