Description

A lot of 2D games and typically 2D RPGs achieve the illusion of depth when players and characters move "behind" and "in front" of objects. The contents of this package allow you to add such a system to your game in Game Maker Studio 2.

HOW IT WORKS:

  • A ds_grid is setup with two columns: one for instances' IDs, and the other for instances' Y values.

  • We make all the instances we want part of the depth system a child of a "depth parent" object. We create an "empty draw" event to disable the instances' default draw event so that they are no longer drawing themselves.

  • A master "draw" object adds all the instances and their corresponding Y value to the grid. It then sorts the grid by the "Y value" column, so that instances with a lower Y (which are up the top of the room) come first in the grid.

  • The master draw object then loops through the grid and draws all the objects in order. That way, instances with lower Y values are drawn first, behind objects that have higher Y values.

HOW TO USE THE SYSTEM:

  1. There are two objects: obj_draw and obj_parent_depth. Add these to your project.

  2. Add obj_draw to your room in the same layer you keep your object instances. If you have multiple Instances layers, place it at the layer with the lowest depth.

  3. Make all objects you want to be included in the depth system a child of the parent object, obj_parent_depth.

CODE IT YOURSELF:

This video provides a tutorial on how you can code this system from scratch.

This video provides a tutorial on how to optimise the system, make it much simpler and faster.

End User Licence Agreement (EULA).

Age Rating: 12+

Version

GMS2 - Version 1.0.1. Published May 17, 2017

Loading, please wait

Package contents

Loading, please wait

What is the issue?

Loading, please wait

Back to Top