Legacy GM [SOLVED] issue with "with" statment using ID

J

jr carey

Guest
I'm having some very strange issues while using the "with statement" heres my code:

with(info.up1)
{
action_sprite_set(spr_orbit_upgrade,5,0);
} // this code is in orbit_upgrade

the problem I'm having is its changing my path object lol, when its suppose to change the upgrade object ID`s sprite, that's what the "up1" is, because I'm creating an instance in the object "info".
but for some reason the with statement is targeting a different object that isn't even referenced, why is this? am I not understanding the ID system correctly? and if it helps my code for creating the upgrade is

up1 = instance_create(888,420,orbit_upgrade); // this code is in info
 
J

jr carey

Guest
lol its still doing the same thing, its just changing the wrong object, idk why its doing that
 
J

jr carey

Guest
okay I found out the cause of the problem, its because of the "action_sprite_set" I'm guessing that isn't suppose to be used for sprite changing, so I just used image_index and it works perfectly fine now, thanks for your suggestions though!
 
S

SyntaxError

Guest
So, up1 is a variable that holds that id of the instance that you want to use the with function on?
 
J

jr carey

Guest
So, up1 is a variable that holds that id of the instance that you want to use the with function on?
yessss, but for some reason the action_sprite_set was causing the ID to change the first instance in the room, which was very odd
 
P

ParodyKnaveBob

Guest
jr carey, where'd you get the action_*() function? $:^ J

GM uses it internally for the drag'n'drop actions. You probably just want to set the sprite_index variable to spr_orbit_upgrade. Try looking stuff up in the manual to see how the documented things work. $:^ ]

I hope this helps,
Bob
 
Top