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).

Version 1.0.1. Published May 17, 2017

Age Rating: 12+

Average Rating

Your review

You can only review assets you've bought.


Gravatar

Anonymous 19 September 2018


Gravatar

Anonymous 17 September 2018


Gravatar

Anonymous 03 July 2018


Gravatar

Simon J 23 March 2018


Gravatar

Ivan D 20 March 2018


Gravatar

Carsten G 06 March 2018


Gravatar

Aktürk M 30 December 2017


Gravatar

Mike R 22 November 2017


Gravatar

Anonymous 15 July 2017

Smart, Fun and Educational

Friendly Cosmonaut is one of my favorite GM2 tutorial creators on YouTube :) She makes working with gml programming a million times more understandable & fun.

Thanks for making this source code available in Marketplace and all of your wonderful tutorials :)

Package contents

Loading, please wait

What is the issue?

Back to Top