• 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 Instance Create and Depth

P

Pendragonz

Guest
So when my character gets hurt, he is instance layer create switched with a hurt version of himself, but the instance is a lower depth than the floor model so you can't see him... Does anyone know a fix?
 
R

Rosieu

Guest
You may be able to fix it by changing the depth of the 'hurt version' object? That may do the trick. Otherwise, if you floor is tile based or something similar, the depth trick of depth = -y may work. If your floor is one big object though, it probably won't (unless the origin is less that your obj, like at the bottom of the screen or something).
 
P

Pendragonz

Guest
You may be able to fix it by changing the depth of the 'hurt version' object? That may do the trick. Otherwise, if you floor is tile based or something similar, the depth trick of depth = -y may work. If your floor is one big object though, it probably won't (unless the origin is less that your obj, like at the bottom of the screen or something).
Ok but the hurt version doesnt appear until he gets hurt... Ill ty to figure out the second one.
 

Slyddar

Member
Why not just change his sprite_index to the hurt version sprite. If you are doing it because you have different controlling code in the hurt object, you could use states in the character to have that code only run when in the hurt version (state).
 
R

Rosieu

Guest
Sorry for the late reply! I didn't realise both objects were present constantly, in that case I would absolutely second what TheSly has suggested. If you google 'Solid State Machines' you'll get a primer on the theory behind them, and they are a super handy mechanism to be familiar with in many different situations. Best of luck! :)
 
Top