Posted: 31st Aug 2011 22:34
I need some example of manual sprite polygon shape (setSpriteShapePolygon). I have some complex sprites and trying to figure if this command can help me.
Posted: 1st Sep 2011 0:29
Ok, I think I figured it out and I gotta say I don't like it one bit. You have to call SetSpriteShapePolygon for each point you want to add, making sure to add the points in order and keeping the number of polys the same:

SetSpriteShapePolygon(ball, 3, 0, 0, 0)
SetSpriteShapePolygon(ball, 3, 1, 20, 20)
SetSpriteShapePolygon(ball, 3, 2, 10, 40)

This makes a triangle.

What they NEED to do is allow passing of arrays, like the help documentation suggests, or do something like:

SetSpriteShapePolygon(ball, numPoints)
SetSpriteShapeVertex(ball, 0, 0, 0)
SetSpriteShapeVertex(ball, 1, 20, 20)
SetSpriteShapeVertex(ball, 2, 10, 40)

More lines, sure, but it makes a whole lot more sense.
Posted: 1st Sep 2011 0:37
A better solution would be:
SetSpriteShapePolygon(ball, numpoints, x1, y1, x2, y2... x12, y12)
Posted: 1st Sep 2011 3:21
Yeah I wasn't keen on this either. I have so far got away with just using
setspriteshape(sprite,3). Although for complicated shapes this seems not to be an option. I would much prefer an option to make it ignore transparencies myself.
Posted: 1st Sep 2011 3:36
etSpriteShapePolygon(ball, numpoints, x1, y1, x2, y2... x12, y12)


That's nice, but not the ideal solution if you want to create the polygon shapes dynamically or at runtime.