AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.Shape Property

Sets the current 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. If you select no shape (psNone) then hit tests and collision will return False, and physics will move but not collide the sprite, resulting in it passing through everything.

Syntax
Pascal
property Shape: TAgkPhysicsShape;

This property lets you define what type of bounding box the system should use to detect collisions. Circle (psCircle) will create a perfect circle centered on the sprite's rotation point and big enough to enclose the sprite's visible pixels. Box (psBox) will create a box around the edges of the sprite, without regard to whether pixels are visible or not. Polygon (psPolygon) will create a close fitting convex polygon around the visible pixels of a sprite, with a visible pixel being defined as one with an alpha value greater than 128. 

This property will not work for dummy sprites as there is no image to use when calculating a shape, in these cases shapes must be specified manually using SetShapeBox, SetShapeCircle or SetShapePolygon

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

Copyright (c) 2012. All rights reserved.