The Dink Network

Reply to Re: This symbol

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
December 6th 2005, 01:36 AM
anon.gif
toa
Ghost They/Them
 
&& 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.