Polymorph — Now for sale in the Scirra Store!
<p>Edit collision polygons during runtime - insert the shape AsJSON from an array or a data string from the included Editor capx. </p><p>This behavior can scan a sprite image to determine a collision shape using image alpha values. It also allows you to inject an AsJSON shape into the sprite to change the collision polygon during runtime. It is compatible with normal collisions in C2 but has not been tested and should not be assumed to be compatible with any of the Physics behaviors (standard Physics, Box2D+, Chipmunk).</p><p>This download also includes an editor capx, which is ideal for setting collision shapes on large and/or complicated images. The editor is more convenient than the standard image editor and you can save the shape in AsJSON format or copy it for pasting directly into a project. </p><p>The AsJSON format is compatible with a C2 array object, so you can use an array of positions and upload them into a sprite to change its collision shape during runtime. Each vertex position is as a fraction of the width or height, measured from the midpoint. The example capx demonstrates this.</p>
Use this topic to leave comments, ask questions and talk about Polymorph