Overrides the current auto generated shape for use in collision detection, hit testing, and physics. A shape can be set without turning physics on, and by default all sprites are set to use the box shape, which is the fastest to setup. The box is defined by specifying its top left and bottom right coordinates in sprite space, relative to the offset of the sprite, by default this is the center of the sprite. For example if the current sprite offset was 0,0 the top left box corner would be 0,0, but if the sprite offset was the middle of the sprite (default) the top left corner would be -width/2,-height/2. You may also specify an angle to offset the box relative to the current sprite rotation.

By default, setting a shape removes all other shapes assigned to the sprite and replaces it with this one. You can set shapes individually by specifying a shapeID greater than 0. Shape IDs start at 1 for the first shape, with 0 meaning delete all existing shapes before creating a new one at ID 1. This command only changes existing shapes, by default all sprites have a base shape at ID 1. You can add additional shapes by using the AddSpriteShape commands.


SetSpriteShapeBox( iSpriteIndex, x, y, x2, y2, angle, shapeID )

SetSpriteShapeBox( iSpriteIndex, x, y, x2, y2, angle )