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

place_meeting not working?

C

corwin22

Guest
This is the code I am using and both objects have a mask
if (place_meeting(x,y,obj_orb))
{
hp = hp - 1
}
but it doesn't work at all
the strange thing is that the orb with almost the same command
if (place_meeting(x,y,obj_Wall)) {
instance_destroy()
}
and it works so i am pretty confused?
 

NightFrost

Member
Could be that the orb's code runs first. It checks for collision and destroys itself. Then the wall checks - nope, no collision because the orb no longer exists.
 
J

Jdown79

Guest
hp = hp - 1
Also, not related to your issue directly, but change this to
Code:
hp -= 1;
Or more preferably,
Code:
hp --;
The second code will minus one just the same, and the first one is the better way to write it if you ever subtract more than one, for example
Code:
hp -= 5;
 
Top