Destructable Terrain


(Nirvan) #1

Hi,

I want to create destructable terrain like in worms, but I don’t know what should I use to it. For beginning I planning to use one big image for this. How can I create so detailed collision mask, with possibility to change it’s shape without too much calculations? With what can I make map image “destructable” with mask?

Thanks.


(azrafe7) #2

Probably the most efficient way to do it is by using Nape: take a look at the “DestructibleTerrain” sample over here http://napephys.com/samples.html

EDIT: Also this makes for an interesting read http://gamedevelopment.tutsplus.com/tutorials/coding-destructible-pixel-terrain-how-to-make-everything-explode--gamedev-45


(Stefan Langeder) #3

Bitmap collision is also be possible.

I’ve used this collisiondetection kit in the past: https://code.google.com/p/collisiondetectionkit/ . The library is pretty fast.

You simply check if two bitmaps collide, and if they collide you’ll get the angle and overlapping area. Performance is also great.

You could also use a mix of tile-based and bitmap environment if you plan to give some undestructible terrain.


(Nirvan) #4

Thanks, but Awww, I have no idea how can I connect this with flashpunk


(Alex Larioza) #5

How are you working destructible terrain into your game? I just ask there may be an easier way to do destructible terrain for your game specifically.


(Nirvan) #6

Only collision detection and destructing terrain I think only by sphere shapes will be needed and it should be good to use one image as texture and mask.