Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / About manual sprite polygon shape

Author
Message
Jeonkz
14
Years of Service
User Offline
Joined: 18th Nov 2009
Location: South Korean in Brazil, Sao Paulo
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.
Jimmy
20
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 1st Sep 2011 00: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.

Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 1st Sep 2011 00:37
A better solution would be:
SetSpriteShapePolygon(ball, numpoints, x1, y1, x2, y2... x12, y12)
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 1st Sep 2011 03: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.

Jimmy
20
Years of Service
User Offline
Joined: 20th Aug 2003
Location: Back in the USA
Posted: 1st Sep 2011 03:36
Quote: "A better solution would be:
SetSpriteShapePolygon(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.

Login to post a reply

Server time is: 2024-04-26 22:55:35
Your offset time is: 2024-04-26 22:55:35