Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBacterius

Posted 12 August 2014 - 06:06 PM

In code, you can do this using the bitshift operator as well instead of using pow or something, courtesy of binary:

n = 5 << (level - 1);

Watch out for overflow though. Of course, if later on you want to have partial levels, e.g. level = 2.5 somewhere between level 2 and level 3, then just using pow is the better solution, since you're using floats anyway.


#2Bacterius

Posted 12 August 2014 - 06:06 PM

In code, you can do this using the bitshift operator as well instead of using pow or something, courtesy of binary:

n = 5 * (1 << (level - 1));

Watch out for overflow though. Of course, if later on you want to have partial levels, e.g. level = 2.5 somewhere between level 2 and level 3, then just using pow is the better solution, since you're using floats anyway.


#1Bacterius

Posted 12 August 2014 - 06:04 PM

In code, you can do this using the bitshift operator as well instead of using pow or something, courtesy of binary:

n = 5 * (1 << (level - 1));

Watch out for overflow though.


PARTNERS