Drag And Drop Child Ojects Changing Because of Parent

Hey, I'm a beginner to GameMaker and I'm having some difficulty with two of my objects changing their sprite because of their parent object. I have the child objects (the boots) change their sprites depending on the direction the character moves. I have also set the parent object's (ship body) sprite to change when the player fires the gun. But when it happens, the boots will turn into the ship's sprite while firing. What can I do to prevent this from happening while still retaining the boots' ability to change sprites based on direction while firing the gun?



Nice art.

Disclaimers, I don't use drag and drop and without posting the code (which you can do in GMS 2 at least even with drag and drop) it's hard to say for sure. However, my first question is why are the boots a child object ship? This seems unnecessary to me. Removing that might be the easiest solution.

However, assuming it is important for some reason, child objects don't automatically carry over the parent's object's sprite. So I'm assuming there must be some event in the parent object which sets the parent object sprite which the child object inherits. This would happen either because the child object doesn't not have that event type, in which case it inherits automatically, or because you are specifically calling event inherited. In either case the solution is the same:
  • create an event in the child object of the same type of event that sets the sprite in the parent's sprite
  • if you want the child object to use the parent objects code call event inherited. If not you're done.
  • If you use event inherited reset the child object's sprite to what you want afterwards.
Again, I'm sorry I can't tell you how to do this in drag and drop.


When you set the sprite in the ship (assuming it is obj_ship), DO NOT attempt to set obj_ship.sprite_index, and DO NOT apply the action to the object obj_ship. Use the set sprite action and apply the action to self (which is the default).

Also, parents in GM are "A is a B" relationships, not "A belongs to B" or "A uses B" relationships. If there is no reason for the boot to be counted as a kind of ship, then you should not make the boot object a child of the ship object.