AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.AddShapeBox Method

Adds a new box shape to the sprite, in addition to any it already has. These additional shapes only apply to physics sprites and must be added after a sprite has been set to use physics.

Syntax
Pascal
procedure AddShapeBox(const X1: Single; const Y1: Single; const X2: Single; const Y2: Single; const Angle: Single = 0);
Parameters 
Description 
const X1: Single 
The X coordinate of the top left corner of the new box in sprite space. 
const Y1: Single 
The Y coordinate of the top left corner of the new box in sprite space. 
const X2: Single 
The X coordinate of the bottom right corner of the new box in sprite space. 
const Y2: Single 
The Y coordinate of the bottom right corner of the new box in sprite space. 
const Angle: Single = 0 
(optional) The rotation angle of the box in radians. 

The box is defined by specifying its top left and bottom right coordinates in sprite space, relative to its current offset. 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. 

This will recalculate the sprite's mass and center of mass values.

Copyright (c) 2012. All rights reserved.