Checking sub image of sprite [SOLVED]

♛W♛

Guest
I'm wondering if there is a way to check the sub image of a sprite, from one object, upon the collision of another?
If so could some please help me figure it out.
Basically when my player collides with an obj, I need to check the sub image before it will or will not add to a variable.
It would be greatly appreciated if somebody could help me with this. I have been testing things and digging around on the web(and the community) for 2 hours now.
 

sp202

Member
Code:
other.image_index
"other" is a keyword for the other object in a collision, image_index refers to the subimage.
 

♛W♛

Guest
Thank you. I was also wondering, if when i check the image_index, could i check to see if it is equal to a global.variable?
 

JackTurbo

Member
Thank you. I was also wondering, if when i check the image_index, could i check to see if it is equal to a global.variable?
Yes, yes you could.

For example you could check if its greater than or equal to it, like this

Code:
if (other.image_index >= yourGlobalVariable){
    do_stuff;
}
 
Last edited:

♛W♛

Guest
Thank you so much, that really helps.
I just tested the collision based off of the variable and it worked!!!
 
Top