Overview


Setting a collision box for a sprite is done via the Image Editor.

Image Editor Collisions.png
Editing the collision polygon of a ball.



Storage


Collision polygon coordinates are stored as ratios in the XML. So for example, if you have an animation with two frames, frame1 is a 32x64 image, and your bounding box coordinates are (0, 32), (0, 64), (32, 64), and (32, 32) -- eg, the lower half of your sprite, then the XML will store these values as (0, 0.5), (0, 1), (1, 1), (1, 0.5). Frame 2 however is 32x128, twice as tall. If you right-click and apply the original bounding box to the entire animation, frame2's bounding box will be *twice* as high as frame1's bounding box.

Collision Storage.png



It should be noted that image points are stored internally the same way. This is exaggerated for purposes of explanation.

Collision Irregularities


It is possible to introduce subtle bounding issues when you factor in things like toggling pixel rounding, or if a frame's height changed from an even value to an odd value.

These issues can arise when a developer does not use fixed dimensions for images (or possibly allows Construct to crop transparent edges) and then assigns a single bounding box on the first frame of some given animation in a sprite which is applied to an entire set of animation's frames.