Contents
How does inheritance work in GameMaker Studio 2?
Inheritance means that you can create a “parent” room then from that create a “child” room which will inherit all the parent room’s properties. This child room is essentially a clone of the parent, and everything in it is linked to the parent room.
What to know about the GameMaker Studio 2 room editor?
This guide is to introduce you to some of the most important features to be found in the GameMaker Studio 2 Room Editor.
How do you open tile layer in GameMaker Studio 2?
You can double-click on any of these items on the layer to open up the item properties. Tile layers are what you would expect, ie: a layer of images from a tile-set that are drawn to the room, but note that tiles in GameMaker Studio 2 are always snapped to the grid.
How to create a destroyed castle in GameMaker Studio 2?
In the child room you’d switch off inheritance for the tile layer (or even individual tiles) for the castle area and them move/add/delete tiles to create the destroyed castle look. When a player enters that room, all the instances from the parent room and all the tiles etc… will remain exactly the same, except for those of the destroyed castle.
How to create a parent object in GameMaker?
The first thing we need to do is create the actual parent object. This object will not need to exist in the actual game itself, because it will only be passing its code to objects that will exist in the game. Create a new object and name it parentEnemy. This object does not need to have a sprite.
How do you create a child room in GameMaker Studio 2?
You would create the initial room with everything as normal, then you’d create a child room which inherits the parent room layers. In the child room you’d switch off inheritance for the tile layer (or even individual tiles) for the castle area and them move/add/delete tiles to create the destroyed castle look.
How to overwrite an inherited variable in GameMaker?
To overwrite the inherited variable, all you need to do is re-initialize that variable after you call event_inherited. Each enemy has a different life variable, and is still a child of the parentEnemy object. For step events, and code that runs every frame, it can be a little different.