DarkGDK Programming Wiki
Advertisement
Dbwrapvalue

This command will return a value that does not exceed a range of 0 - 360.

Syntax[]

dbWrapValue( Angle );

Usage[]

If the Angle given exceeds 359, the command will wrap the value around to bring it back within the range. This command is best understood by using the number of a clock as a mental picture of how a number wraps. If the clock hand points to 11 and is then advanced 2 hours, the number has to wrap from 12 around to 1 to keep the cycle going.


For example:


dbWrapValue ( 90 );


will return a value of 90, but


dbWrapValue ( 361 );


will return a value of 1; the angle has come complete circle from 360 to start back at 1. This command can be very helpful when used in combination with dbRotateSprite.

Advertisement