Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Shade

Pages: [1]
1
first off, I've used the 2d toolkit in the past and it's a fantastic asset.

I'm trying to decide what the best approach for another project should be though. In a nut shell I'm trying to build a 2D destructible tile game. The question I have is based on the idea that turning on and off colliders is expensive, but is it more expensive than editing the auto-generated edge collider that tk2d will create? In order to understand the other solution I'm referencing, a picture is worth a thousand words:

https://gyazo.com/4a1c8502db32a176303135e9b40ba539

The idea here would be to generate a box collider for every tile, but as depicted, only those tiles that are on the edge would have their colliders turned on. Destroying an edge tile would make a call to at most 3 other tiles to have their colliders turned on. This seems a reasonable approach to me, but I'm not certain about the application.

While trying to implement the box colliders I noted that the auto-generated edge colliders exist within each chunk of data. I'm not certain of how to obtain the actual chunk object in-order to store the collection of box colliders on it.
Code: [Select]
tileMap.Layers[layerId].GetChunk(x, y); where x,y is the tile coord.
This seems like the right path, but GetChunk returns a tk2dRuntime.TileMap.SpriteChunk which I could find no documentation on.

I figured storing the colliders on the chunks would be an effective way to at least organize where the colliders are based on the mesh they represent, but I guess they don't have to be.

any insights would be much appreciated.

Pages: [1]