turnCharacter and spinCharacter


turnCharacter (thisCharacter, direction);

spinCharacter (thisCharacter, direction);


Both the turnCharacter function and spinCharacter function will turn thisCharacter to face a new direction. However, turnCharacter will make the character face in his/her new direction immediately whereas spinCharacter will make the character rotate on the spot until the new direction is reached (the rate at which this happens being the character's current spin speed). Valid values for direction are any number between 0 and 359 inclusive or one of the constants NORTH, NORTHEAST, EAST, SOUTHEAST, SOUTH, SOUTHWEST, WEST or NORTHWEST (which enumerate to 0, 45, 90, 135, 180, 225, 270 and 315 respectively).

If using turnCharacter to rotate a character, the current function will continue immediately. If using spinCharacter to rotate a character, the current function will be paused until the action is completed (pausing for a minimum of 1 frame).

Return value:

No return value.

See also:

Object Types as Characters