Java-Gaming.org Java4K winners: [ by our judges | by the community ]         
Featured games (67)
games approved by the League of Dukes
Games in Showcase (∞)
games submitted by our members



News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  Print  
  Worms-style damage to objects  (Read 275 times)
0 Members and 1 Guest are viewing this topic.
Offline ak-73

JGO n00b
*

Posts: 1



« on: 2011-12-09 13:26:18 »

Hi, first post here!

We would like to be able to do damage to terrain (objects) Worms-style in our game. We do have implemented pixel-perfect collision so far, now my question is: what is the best/most efficient way to make the "hit" object pixels become transparent, keeping in mind that different objects might look the same initially (they share the same image/texture).


We're using lwjgl + slick, I haven't seen a way to load the same image into seperate textures so far, so it's either doing that from scratch or duplicating texture on initial collision to avoid applying the damage to all objects sharing the same texture.

Would you be so kind to give me some pointers? Thanks.


Alex
Offline sproingie

JGO Strike Force
***

Posts: 902
Medals: 55



« Reply #1 on: 2011-12-09 15:44:55 »

Stencil buffer immediately comes to mind.  Render your explosions to that, render terrain using it.  The blown-up terrain is then not only transparent, it isn't really there at all (i.e. it'll be whatever background you had)
Pages: [1]
  Print  
 
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.076 seconds with 20 queries.