AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetShapeBox Method

Overrides the current auto generated shape for use in collision detection, hit testing, and physics. Sets the shape to a box.

Syntax
Pascal
procedure SetShapeBox(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. 

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 top left corner 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,-Weight/2. You may also specify an angle to offset the box relative to the current sprite rotation. 

Setting a shape removes all other shapes assigned to the sprite and replaces it with this one.

Copyright (c) 2012. All rights reserved.