Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Gamemaker Essentials

You're reading from   Gamemaker Essentials Learn all the essential skills of GameMaker: Studio and start making your own impressive games with ease

Arrow left icon
Product type Paperback
Published in Mar 2015
Publisher
ISBN-13 9781784396121
Length 154 pages
Edition 1st Edition
Arrow right icon
Toc

Depth

While working with objects in GameMaker, you may run into a few issues when it comes to one object going behind or in front of another. This is an issue caused by something called depth.

Depth in GameMaker is used to order objects from lowest to highest in a room. It can be seen much the same as a layer in an image editor such as Photoshop. By default, an object's depth is set to 0. If more than one object has the same depth value, then they will be ordered first to last, based on the order you create them in the room.

The higher an object's depth is, the lower it is drawn in a game room. So if an object with a depth value of one overlaps an object with a depth value of zero, then the object with the depth value of zero will appear on top of the object with a depth value of one.

Depth

Depth ordering

An object with a depth that is higher than another, will execute its code first. Oftentimes, this greatly affects the creation of objects in a room. For example, a button may need to appear...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime