• 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!

Legacy GM Collision event for Parent and Child

csanyk

Member
Let's say I have an obj_parent, and obj_child in my project. Object_child inherits from obj_parent

In another object, let's call it obj_collision_tester I create a collision event for object_parent, and define some behaviors there. I then add another collision event for obj_child.

I run the game, and test the collision with obj_child. Only the code in the Collision-obj_child executes; it appears to override the collision event defined for obj_parent.

In obj_child, I add a call to event_inherited(), and now the code in the collision event for obj_parent also runs when I collide with an obj_child.

What's weird about this, to me, is that normally event_inherited() will cause the event of a parent object to be called. That is, obj_collision_tester is calling event_inherited() -- shouldn't it be looking to the parent object of obj_collision_tester for code actions to be performed during a collision with obj_child? Instead, in the collision event, when I call event_inherited(), it checks to see what the parent object for other is, and runs the collision for the parent of other. This seems counter-intuitive to me.

If I had intended to call the code for the obj_collision_tester_parent in obj_collision_tester for a collision with obj_child, how could I do this?
 
Top