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

Image index and global variables[SOLVED]

♛W♛

Guest
I'm have an issue getting variables to add or subtract during a collision.
I have the collision check if the image index, of the other object, is equal to global.state and this works fine when it come to destroying the instance however when it is equal it's supposed to add to global.score and when it is not equal its supposed to subtract global.health but none of these variables are changing.
I'm using mostly drag and drop but if i have to execute a script i will, i just need it to work.
Someone Please Help!!!
 

matharoo

manualman
GameMaker Dev.
You can use this code in the collision:
Code:
if (other.image_index==global.state){
    global.score += 1;
}
else{
    global.health -= 1;
}
You may change the numbers to your liking.
 
Top