- Online Community Forums » Programming Questions » yet about destructable terrains

This thread is locked; no one can reply to it. rss feed Print
yet about destructable terrains
valdir salgueiro
Member #7,468
July 2006

i´ve read some threads about this subject, but i haven´t seen was how it was going to be in the code

i know that you draw a circle ow watever u wnat with 'magic pink' .. but where do i draw it? does it have to do with put pixel()? and getpixel()? i didnt get this point...

also ive seen some code snipets (thats why i didnt 'got' how it works :P, cause what ive seen is incomplete), and was wondering why is it necessary to have more than one backgrtound (usually foreground and background)


Member #6,152
August 2005

Using the pumping lemma, I can make enough assumptions to assume that you are using a regular language, however unclear it may be.

Sorry, just being an a**.

Anyway, I guess you mean a 2D landscape, yes? The magic pink that you refer to is makecol(255,0,255). This special guy is transparent. If you have a background bitmap with your...background, you can draw this to a buffer first. Then, you draw your foreground bitmap with the...foreground on to the buffer. Then buffer to the screen. The background will be completely solid (no magic pink) and the foreground will have magic pink where ever you want to see the background.

Thus, to have destructable terrain, you just put the magic pink down where ever you are blowing up the foreground, and you will then see the background behind this spot.


------------ | My Tech Blog: The Digital Helm

valdir salgueiro
Member #7,468
July 2006

yes its a 2d landscape, and it written using allegro and c, hope didnt forget about anything else :P

ok, but how do i 'draw' the magic pink, i prolly will use pixelmask as my library to do the pixel collision, but what i dont get is how it to change the actual shape of my background, so the colision would be different (there would be more holes)

Member #2,407
June 2002

circlefill(backgrtound, x, y, r, makecol(255,0,255));

sig used to be here

Member #4,069
November 2003

I fear that you'll have to give up using pixel mask unless you want to change the mask everytime you blow somethin up.

[My website][CppReference][Pixelate][Allegators worldwide][Who's online]
"Final Fantasy XIV, I feel that anything I could say will be repeating myself, so I'm just gonna express my feelings with a strangled noise from the back of my throat. Graaarghhhh..." - Yahtzee
"Uhm... this is Did you honestly think this thread WOULDN'T be derailed and ruined?" - BAF
"You can discuss it, you can dislike it, you can disagree with it, but that's all what you can do with it"

Richard Phipps
Member #1,632
November 2001

Go to: