How do I make a collision polygon with separate parts?

Get help using Construct 2

Post » Wed Aug 10, 2016 6:35 am

I need to give this shape a collision polygon (see attatched image below).
http://imgur.com/a/twokX
The black parts will not have collision (the player walks through those areas). The parts that are not completely black need to have collision so the player can collide with them. How do I make a collision polygon with 4 separate boxes to cover those areas?
B
34
S
21
G
11
Posts: 9
Reputation: 8,576

Post » Wed Aug 10, 2016 7:51 am

PCIsSuperior wrote:I need to give this shape a collision polygon (see attatched image below).
http://imgur.com/a/twokX
The black parts will not have collision (the player walks through those areas). The parts that are not completely black need to have collision so the player can collide with them. How do I make a collision polygon with 4 separate boxes to cover those areas?


If its a single sprite then you can't as the collision mesh always have to be connected. A way to solve that is to have a collision mesh layer so to speak, which are separated from the actual graphic. So on this layer you only have collision objects that you can arrange so they fit with the graphic layer.

Another way, and maybe the most obvious choice seeing that you are using squared graphic objects, would be to use tile maps, as it would be faster and more performance friendly than using sprites.
B
44
S
11
G
2
Posts: 1,182
Reputation: 6,828

Post » Wed Aug 10, 2016 9:14 am

Use invisible sprites pinned to the original sprite. Each invisible sprite acts as its own "collision area".
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487

Post » Wed Aug 10, 2016 4:52 pm

nimos100 wrote:
PCIsSuperior wrote:I need to give this shape a collision polygon (see attatched image below).
http://imgur.com/a/twokX
The black parts will not have collision (the player walks through those areas). The parts that are not completely black need to have collision so the player can collide with them. How do I make a collision polygon with 4 separate boxes to cover those areas?


If its a single sprite then you can't as the collision mesh always have to be connected. A way to solve that is to have a collision mesh layer so to speak, which are separated from the actual graphic. So on this layer you only have collision objects that you can arrange so they fit with the graphic layer.

Another way, and maybe the most obvious choice seeing that you are using squared graphic objects, would be to use tile maps, as it would be faster and more performance friendly than using sprites.

I actually am using tile maps. I used a smaller tile map to create big 128x128 tilemap blocks, and with those blocks I can make levels much more quickly.
B
34
S
21
G
11
Posts: 9
Reputation: 8,576


Return to How do I....?

Who is online

Users browsing this forum: sublimate and 2 guests