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

[SOLVED] GML Parenting question

D

Dreadshadow

Guest
Hello everyone.
So I found some time to start playing around with this sweet engine.
I can say that Shaun has got excellent tutorials on youtube.
So I was watching the one for the beginners, that we create an asteroids clone.

On the fourth video, he demonstrated parenting.

Comparing GML to Java might sound stupid, but it makes some sense to me and made me understand GML easier, since I have some Java background.

What I understand is that objects here are like classes in Java.
Thus an instance is well... an instance of that class.

Now parenting, seemed to me like a way to do inheritance.
You know, like abstract classes that other classes belong and extend.

So I saw obj_asteroid_s inheriting everything obj_asteroid had to offer.
I also saw that we can create an event on obj_asteroid_s to override the specific event on obj_asteroid.

What I am curious about is this:

Assume I have obj_asteroid instances on screen and also some obj_asteroid_s instances too.
Let's say I destroy ALL obj_asteroid instances.
Does an obj_asteroid_s instance count also as an obj_asteroid instance, because of the inheritance?

Thanks for your time people. :)
 
D

Dreadshadow

Guest
Well look at that!
I reached the 7th video and this guy is teaching newcomers VERY NEAT STUFF.
He actually answered my question with a conditional example of exactly what I had in mind. :p
This is incredible.
And also, @BeastyBoy, thank you for your rapid reply mate.


For people reference, around 05:47 there is the answer to my question.
 
Last edited by a moderator:
Top