Changing a sprite

K

kmce

Guest
I am trying to make a sprite of one object change to another, but it doesnt seem to be happening. Not a programmer or that familiar with GM, so wondering if this should actually work

if (!instance_exists(obj_HipHop_WG_arms_punching) && distance_to_object(obj_john_torso_walking) < 10 )
{
sprite_index=spr_HipHop_WG_arms_punching
instance_create (200,500 , obj_HipHop_WG_arms_punching)
};

I am creating the object aswel for other reasons and its working fine, just the sprite change that is not working
 
A

anomalous

Guest
What object is running this code?
You are changing the sprite for the object you are currently running (above), is that what you wanted?
 
W

whale_cancer

Guest
I am trying to make a sprite of one object change to another, but it doesnt seem to be happening. Not a programmer or that familiar with GM, so wondering if this should actually work

if (!instance_exists(obj_HipHop_WG_arms_punching) && distance_to_object(obj_john_torso_walking) < 10 )
{
sprite_index=spr_HipHop_WG_arms_punching
instance_create (200,500 , obj_HipHop_WG_arms_punching)
};

I am creating the object aswel for other reasons and its working fine, just the sprite change that is not working
Do you have a draw event for the object running this code? Are you manually drawing the sprite in your draw event or using draw_self? That is the area I would assume the problem is in, as your posted code seems fine.
 
K

kmce

Guest
OK so apparently I have been giving myself so much extra working doing it this way, when i could have used instance_change, which i didnt know existed until now -_- . Thanks for the replies though :p
 
Top