Reply to Re: This symbol
If you don't have an account, just leave the password field blank.
December 6th 2005, 01:36 AM

toa


&& and || are logical operators, & and | are bitwise. (There are many articles on the net which explain the difference better than I can.)
% is modulus. It's most often used as a limit-check since the result of C=A%B will never be greater than or equal to B (C is always less than B).
So what the expression is doing is:
half-strength + (random amount less than half-strength) + 1
This will cause damage to sprite i (the first argument) in the range strength/2 to strength.
And the + 1 at the end just ensures that at least 1 point of damage is done.
% is modulus. It's most often used as a limit-check since the result of C=A%B will never be greater than or equal to B (C is always less than B).
So what the expression is doing is:
half-strength + (random amount less than half-strength) + 1
This will cause damage to sprite i (the first argument) in the range strength/2 to strength.
And the + 1 at the end just ensures that at least 1 point of damage is done.