• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Pixel Terrain Destruction. [Solved]

M

Mirofox

Guest
i build a system where it generates 32 x 32 balls close together that it LOOKs like pixel destruction, but i can't make it look pretty, only solid color, so how would i go making drawn terrain one object and having it be destroyed pixel by pixel?
 
D

DevNorway

Guest
draw_sprite_part(sprite, subimg, left, top, width, height, x, y) and some serious math.
 

NightFrost

Member
In a Worms-like game, explosions that destroy terrain are likely going to be circular, so draw_sprite_part is not going to help much in there.
 
F

farkraj

Guest
You can set up a 2 separate terrain sprites, one is a screen size rectangle of your texture, and second one is actual terrain but in black and white. Now, there are diffrent ways to approach this, you can for example, when grenade explodes you subtract white filled up circle from black and white terrain map in place where exposion happened and then draw your texture over the terrain only where there is white color (terrain) excluding black (nothing) using blending and surfaces or shader
 
M

Mirofox

Guest
You can set up a 2 separate terrain sprites, one is a screen size rectangle of your texture, and second one is actual terrain but in black and white. Now, there are diffrent ways to approach this, you can for example, when grenade explodes you subtract white filled up circle from black and white terrain map in place where exposion happened and then draw your texture over the terrain only where there is white color (terrain) excluding black (nothing) using blending and surfaces or shader
thats a nice concept that i have already tried. it looks rather ugly.
 
M

mariospants

Guest
Worms-like game maps aren't too large and there's usually not an awful lot going on, graphics-wise... if your target platform is reasonably powerful (and here I'm probably going to get some upturned noses for suggesting this) you could use the cheapest method, which is to arrange your destructible landscape bits as individual objects: small enough to be discretely fun to destroy, large enough not to require a bazillion objects. You can save some effort and memory by pre-drawing the underlying "completely blown-up state" on a background, and have the object leave a "pit" when hit near its center, or a pit between two objects if it's sufficiently close to the edges of two successive objects, etc. Throw in some particle effects and you'd have a pretty easy-to-program Worms-type game.
 
M

Mirofox

Guest
In a Worms-like game, explosions that destroy terrain are likely going to be circular, so draw_sprite_part is not going to help much in there.
which is why Per-pixel Destruction is where im looking to go, but have absolutely no idea how to do it. which is why im here on the forums xD
Worms-like game maps aren't too large and there's usually not an awful lot going on, graphics-wise... if your target platform is reasonably powerful (and here I'm probably going to get some upturned noses for suggesting this) you could use the cheapest method, which is to arrange your destructible landscape bits as individual objects: small enough to be discretely fun to destroy, large enough not to require a bazillion objects. You can save some effort and memory by pre-drawing the underlying "completely blown-up state" on a background, and have the object leave a "pit" when hit near its center, or a pit between two objects if it's sufficiently close to the edges of two successive objects, etc. Throw in some particle effects and you'd have a pretty easy-to-program Worms-type game.
that makes it look blocky, or with rounded objects looks chunky. thats the engine im using now and it does'nt look good...
 
D

Dengar

Guest
tiles? realy small tiles and a 2d array for identifying them
use a 2d array and a loop statement to both draw the tiles and save there id to the array grid. then when you need to destroy you can just use something like
Code:
 tile_delete(array[x/32,y/32]);
which in theory would use your current position to determine where on the array grid the id is for that tile and whala it deletes the tile. the example given is based on a 32x32 tile
 
J

JoltJab

Guest
This video talks about surfaces and he show off what looks like something you would see in worms. It's a little old, and would require you know what surfaces are, but could this be what you're looking for?


 
M

Mirofox

Guest
This video talks about surfaces and he show off what looks like something you would see in worms. It's a little old, and would require you know what surfaces are, but could this be what you're looking for?


this is exactly what i was looking for for like, 7 days, you are a hero!
 
J

JoltJab

Guest
Woo hero! Glad to help.


Edit:
Forgot to add, it says surfaces are in a version you need to buy but that isn't true in more recent versions.
 
M

Mirofox

Guest
actually weird, that one or more explosion on screen slows it down, when in the video he said it was "faster". o.o

30 fps with 1 explosion, 2 or more it goes down to 25, 8 - 10 explosions it goes to 6.

any idea how to fix that?
 
C

CedSharp

Guest
actually weird, that one or more explosion on screen slows it down, when in the video he said it was "faster". o.o

30 fps with 1 explosion, 2 or more it goes down to 25, 8 - 10 explosions it goes to 6.

any idea how to fix that?
which tutorial are you talking about?
 
C

CedSharp

Guest
Can you export your project and send it, I'll take a look for you :)
you can PM it to me
 
Top