Jump to content


Photo

changing parent sprite


  • Please log in to reply
4 replies to this topic

#1 Fratrino

Fratrino

    GMC Member

  • GMC Member
  • 136 posts
  • Version:Unknown

Posted 03 March 2012 - 09:10 PM

i need an object to have a certain parent sprite, but is there a code to change the parent sprite? and then make it change back?

i want to have it so when I press down it changes the parent sprite and the actual sprite
and when I release down I want it to change back to the normal parent sprite. is this possible?
  • 0

#2 greep

greep

    Menaces with Spikes

  • GMC Member
  • 2398 posts
  • Version:GM7

Posted 03 March 2012 - 09:19 PM

Well I just don't really understand what you mean by this. Do you want to change the actual parent object's sprite? I think it'd be easier if you just explained the specific problem, I'm guessing you're asking something a lot simpler.
  • 0

#3 Fratrino

Fratrino

    GMC Member

  • GMC Member
  • 136 posts
  • Version:Unknown

Posted 03 March 2012 - 09:36 PM

if keyboard_check(vk_down){object_set_parent(ind,obj)}
if keyboard_check_released(vk_down){object_set_parent(-1,obj) //Use -1 to not have a parent.


im doing something wrong

i have this in the down key event

{object_set_parent(parent1,obj_player)}

Edited by Fratrino, 03 March 2012 - 09:37 PM.

  • 0

#4 Jakyl11

Jakyl11

    GMC Member

  • GMC Member
  • 3194 posts
  • Version:GM:Studio

Posted 03 March 2012 - 09:40 PM

changing an objects parent wont affect the sprites in the object you need to change the actual sprite with sprite_index=spritename
or the mask with mask_index=spritename

sprite_index=spritename;//changes the actual sprite of the object thats calling the code
mask_index=spritename;//changes the sprites bounding box to the indicated sprites bounding boxes.(look up masks in help file of GM)

i think thats what your asking?
  • 0

#5 Fratrino

Fratrino

    GMC Member

  • GMC Member
  • 136 posts
  • Version:Unknown

Posted 03 March 2012 - 11:04 PM

changing an objects parent wont affect the sprites in the object you need to change the actual sprite with sprite_index=spritename
or the mask with mask_index=spritename

sprite_index=spritename;//changes the actual sprite of the object thats calling the code
mask_index=spritename;//changes the sprites bounding box to the indicated sprites bounding boxes.(look up masks in help file of GM)

i think thats what your asking?


wow i was mixing up parent with mask
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users