• 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!

GML Enemies made of smoke (how to?)

Mr Giff

Member
Hey guys, I'm making a new top down RPG rogue like / shooter. The enemy designs are kind of like... "smoke with eyes."

Making a sprite of this is easy enough, but I want to have it so that if you shoot at an enemy it will erode some of the smoke away... in other words, punch a hole through them.

I'm not sure how I would go about doing this, any suggestions?
 

pixeltroid

Member
I think you could just create it using sprites.

If his health is full he has the full sprite.

If he gets shot once, you give him a sprite with 1 hole punched through him.
If he gets shot twice, you give him a sprite with 2 holes punched through him.
And so on.

But since he's made of smoke, he might heal and go back to normal.

So another way is to make a sprite with 1 hole for his "hurt" state. Then after a second, it goes back to normal.

That's how I'd do it. :)
 

curato

Member
you could do it with swapping the sprites pretty easy or you could have a base sprite and use smoke particles that would be less if as they take damage.
 

Mr Giff

Member
These are what I thought of at first too. However I Was hoping for something a little more dynamic. For example a very large "boss" character could have multiple holes blown in him depending on where you shoot; that's what I'd like to do anyways.
 
T

teamrocketboyz

Guest
although not what you want. this is a video of some "fog/smoke" i was able to create in my very early days using objects.

its not what you want but i believe it could be given the right coding.

 

Yal

🐧 *penguin noises*
GMC Elder
You could have the enemy create a number of "smoke emitters" that create a smoke particle effect (while the enemy itself is actually invisible). Each time you damage the enemy, a random smoke emitter is destroyed (add their ids to a ds_list, shuffle it, and pick the zeroeth entry in the list).
 
Another way is to draw the full sprite to a surface initially and then when it gets hit: figure out the position on the sprite where it was hit, have some other sprite that represents the hole a bullet would punch, and then subtract that hole sprite from the hit position on the surface using one of the gpu_set_blendmode_ext settings (I can never remember which combination yields a negative area, but one of them does). If you draw that surface instead of the actual sprite, it'll end up looking like the original sprite has holes punched in it (the same method can be used for destructible terrain).
 

obscene

Member
There is a fluid dynamics asset on the marketplace which will do this. It will take some work and experimentation but it's the real deal.
 

Mr Giff

Member
Another way is to draw the full sprite to a surface initially and then when it gets hit: figure out the position on the sprite where it was hit, have some other sprite that represents the hole a bullet would punch, and then subtract that hole sprite from the hit position on the surface using one of the gpu_set_blendmode_ext settings (I can never remember which combination yields a negative area, but one of them does). If you draw that surface instead of the actual sprite, it'll end up looking like the original sprite has holes punched in it (the same method can be used for destructible terrain).
Hate to bump an old thread but as I return to this problem I'm just reading through these great responses. I think this is exactly what I'm looking for!

I like teamrocketboyz and yal's ideas as well, but I think this type of masking with some added Fx will be the most manageable and suitable.

Thanks a lot, gang!
 

Yal

🐧 *penguin noises*
GMC Elder
There's also been some new developments in the past 3 years that could be interesting, for instance Metaballs for fluid/slime simulation (to make the monsters more amorphous) and signed distance fields (you could draw sharply contrasting lines / pixels onto a originally-smooth SDF texture to add holes)
 
Top