Book Image

Gamemaker Essentials

4 (1)
Book Image

Gamemaker Essentials

4 (1)

Overview of this book

Table of Contents (16 chapters)

Parents


In many other programming languages, it is possible to have objects created with the same attributes as another. In GameMaker, this is called parenting. A parent in GameMaker is any object that has had another object parented to it. Once an object has been parented, it can use the same code as its parent without it needing to be re-written. An object that has a parent is often referred to as a child object. Any events within the parent object are the ones inherited by the child, causing it to behave the same way. If an event is added directly to a child object, then the parent's event is discarded. It is, however, possible to still inherit the event using the GameMaker Language code.

Making a parent

To make an object a parent in GameMaker, you actually need to open up the object that is going to be the child of that parent. In the object's properties on the left side, there is a button that says Parent on it.

By clicking on the blue options button to the right, a drop-down list will...