Collision Polygon Point

Get help using Construct 2

Post » Sat Jan 25, 2014 4:45 am

Hi, is there any way, even if its hacky, to get a point of a collision polygon at runtime, like we do with imagePoints? eg: Sprite.colisionPoint(0)?

If not, somebody know of a plugin? I need this for the GGJ, Ill use the collision points in the tiles of a tilemap to project shadows using Canvas, but the tiles dont have imagepoints.

Thanks
B
39
S
8
G
3
Posts: 440
Reputation: 6,903

Post » Sat Jan 25, 2014 4:50 am

I'd say just create imagepoints at each of the collision poly points. But since you want to do it with a tilemap, that won't work.

Instead, try an array. Along the X Axis is each tile in the tileset. Along the Y Axis is each point in the polygon. Then the Z Axis is the X and Y position of said point.

It might take a bit of typing but that's how I would go about it.EncryptedCow2014-01-25 04:51:17
B
47
S
14
G
7
Posts: 603
Reputation: 8,151

Post » Sat Jan 25, 2014 1:14 pm

Thanks @Encryptedcow but I really need to use the polygon masks the tilemap object creates: first, theyre optimized polygons, so less garbage in the memory, second this method you describe wouldnt permite ramps or slopes to be illuminated.
Is there any way to expose the positions of the points in the collision polygon @ashely?
B
39
S
8
G
3
Posts: 440
Reputation: 6,903

Post » Sun Jan 26, 2014 9:12 pm

It would work for any polygon. The array would just be storing the X and Y position of each point in the polygon of each tile. It's just that you can't get the coordinates of the image points with events, so you have to look at the numbers with the editor and put them in yourself.
B
47
S
14
G
7
Posts: 603
Reputation: 8,151


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests

cron