• 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 Unique Object Collision

I have a Collide event with the character that swaps the sprite of a flower to an animated sprite. Problem is when the character triggers that one flower then ALL the instances of that flower object change sprites. Can you point me in the right direction to fix it so just the one flower reacts?

CHARACTER
(collision event)
Code:
oEnvWeeds.image_speed = 1;
FLOWER
(create event)
Code:
image_speed = 0;
(step event)
Code:
if (image_index >= 10)
{
    image_speed = 0;   
    sprite_index = sEnvWeedsDed;
}
 
G

Guitarmike

Guest
I think you are confusing the object and the instance of the object. A single object can have many instances. In a collision event, the keyword "other" returns the specific id of the instance that has been collided with. Change your collision event to something like this:

Code:
other.image_speed = 1;
PS - a question like this probably belongs in the "programming" forum, not this one.
 
I think you are confusing the object and the instance of the object. A single object can have many instances. In a collision event, the keyword "other" returns the specific id of the instance that has been collided with. Change your collision event to something like this:

Code:
other.image_speed = 1;
PS - a question like this probably belongs in the "programming" forum, not this one.
Mike you are a Gentleman and a Scholar! Thank you. And I wanst sure were to post. Apologies all. But That did in fact work. Thanks friend
 
Top