Perpendicularity & Height Off Ground

Perpendiculatity and Height Off Ground (also called ZDepth) is an important consideration when creating custom objects in Enter the Gungeon- most expressly applicable when it comes to creating custom objects for rooms, such as traps or decor.

Enter the Gungeon is not a 2D game. In fact, it is secretly rendered in 3D space in order to natively allow complex layering. A laser beam can pass through an enemy, above a table, and behind a pillar without any special rendering code thanks to being rendered in 3D space.

Both Perpendicularity and Height Off Ground are properties of an object's tk2dSprite component.

Perpendicularity

What is Perpendicularity?

'Perpendicularity' refers to whether or not a sprite is rendered as perpendicular- that is, standing up straight or laying down flat.

In the above image, you can see that the Sarcophagus is 'Perpendicular' (standing up straight) while the shadow of the sarcophagus is laying down flat. In fact, most shadow objects in Enter the Gungeon are not perpendicular.

Rendering a sprite as perpendicular, as in the Sarcophagus example, ensures that whether other objects are rendered in front of or behind it depends on where they are standing relative to it. Below, you can see that the player is obscured when standing north of the sarcophagus gameobject, because the sarcophagus sprite is secretly standing up straight.

Shadow is disabled for clarity

Now, we can make the Sarcophagus not perpendicular. See below how it is now sitting flat against the floor.

Again, Shadow is disabled for clarity

Now we can look at how that changes how the sarcophagus is layered relative to the player. The convict looks the same when standing below the sarcophagus, but when moved above, they're still rendered as above the sarcophagus, because it is still laying flat against the floor.

With this in mind, the perpendicularity of a sprite should depend on how you want it to appear. Should it be consistently rendered above or behind objects no matter where they stand? Or should the layering depend on orientation?

Adjusting Perpendicularity

Changing the perpendicularity of a sprite is extremely simple, as it is controlled by the IsPerpendicular bool on the tk2dSprite component of an object. The below code is enough to make the sprite of a hypothetical thingy gameObject perpendicular. Making a sprite flat is as easy as setting IsPerpendicular false once again.

thingy.GetComponent<tk2dSprite>().IsPerpendicular = true;

Height off Ground

Last updated

Was this helpful?