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

GameMaker [SOLVED] How do you get rid of a collision box?

A

anthropus

Guest
Hi all. In my game, when an enemy dies, the body stays on the ground. I do this by having the last frame of the death sprite (which is just dead body lying there) stay there. But I noticed that the dead body lying there still has collision--its dead body can block projectiles and such, which I dont want.

What I want is for that last subimage (of the dead body laying there) to not have any collision, to basically be a sprite only and have no impact on any other objects. I'm not using mask for the sprite (just default collision box that game maker automatically applies) and I dont want to make an extra object for a "dead body" instance, and I'd like to keep it that way if possible. But I cant figure out how to "remove" a collision from a specific sub image.

Any help? Thanks.
 

matharoo

manualman
GameMaker Dev.
When it dies, change its mask_index to an empty sprite.
Code:
mask_index = spr_empty;
Or if you're handling collisions through code, then do what jb skaggs said: use a variable.
 
R

renex

Guest
The best course of action would be to create a different object for dead enemies - this way you don't have to filter out unnecessary interactions.
 

Perseus

Not Medusa
Forum Staff
Moderator
The best way would be to create a sprite element on a layer, since GMS 2 permits you to put sprites directly onto a layer without performance cost as intensive as when using instances. When the enemy instance has completed its death animation, destroy it and create a new sprite element at its position using layer_sprite_create. Store the element ID it returns in a local variable, then set its animation speed to 0 via layer_sprite_speed and its image index to the desired sub-image via layer_sprite_index. Then you won't have to worry about hundreds of useless instances affecting the game's performance.
 
A

anthropus

Guest
The best way would be to create a sprite element on a layer, since GMS 2 permits you to put sprites directly onto a layer without performance cost as intensive as when using instances. When the enemy instance has completed its death animation, destroy it and create a new sprite element at its position using layer_sprite_create. Store the element ID it returns in a local variable, then set its animation speed to 0 via layer_sprite_speed and its image index to the desired sub-image via layer_sprite_index. Then you won't have to worry about hundreds of useless instances affecting the game's performance.
i guess i gotta start checking whether it's a gms2 thread from now on :/
yea its gms 1
 

JackTurbo

Member
Using surfaces for your backgrounds? If so you could always draw the dead sprite onto the background surface.

I kind of feel like this is one of those situations where there are many, many potential solutions and whats best will be dictated by how your game is set up.
 
Top