The manual states it possible to load a sprite using "Load image from URL". But can I control that sprite's collision polygon as well? Lets say the sprite image is of a triangle, will the sprite assume a triangle shape, with an appropriate collision polygon? Is is possible to invoke the Collision Polygon editor in runtime? Or even set the the polygon at runtime based on values downloaded from another source, like a socket connection to a server.
Ideally I would like to load a sprite from a server including data which defines its collision polygon.
Hi Gez That sounds like it should be possible, based on the same mechanics that enable Construct 2 to guess the guess the polygon shape. Does anyone know if this is already possible or whether it needs a plugin?
Thanks for the reply hundereddfold,
I had a hunt in user plugins and there is one called polygon which shows how to define a collision polygon
this.collision_poly = new cr.CollisionPoly
I will have a go at creating a new plugin
Develop games in your browser. Powerful, performant & highly capable.
You could pin the sprite with the new image to another (invisible) that holds the collision polygon you want, then use that for collision checking.
Colludium Yes, that would work, but only if you know the shape in advance. I believe a plugin that can "work out" the shape from the image would be of more use.
hundredfold, ah - yes, I see. Some way of ensuring it is not given a default rectangle on import.
Colludium yes, just like the "guess the polygon shape" feature works.