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

Tutorial Guy
YYG Staff
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