2•5D for Construct 3
This is an example project showcasing a Construct 3 addon I developed.
Download the 2•5D addon from the Construct 3 Addon Store.
Purpose of the 2•5D addon
A new behavior for a very common requirement: handling the Z elevation of sprites in games with an angled top-down point of view, sometimes confusingly called 2.D games.
Sprites in such games can move in front or behind each other and this has to be adjusted dynamically. Attach the 2•5D behavior to all objects involved and they are arranged automatically.
The behavior works as expected with both Orthographic and Perspective projections, because it uses the screen Y, not the world Y, to calculate the Z elevation.
Parameters
Locked
Usually false, but you might want to lock items that do not need to update their Z elevation every tick. A typical example is static sprites in an Orthographic projection (don't lock items in a Perspective projection). Another use case is a sprite that's moving along the vertical axis but this does not represent a movement on the world plane but perpendicular to it, like a jump or a dive.
Image point
ID or name of the image point used as a reference for the object. This is usually a point representing the base of the portrayed object, e.g. the feet of a character.
Max Z variation
The Z elevation varies depending on the Y position of each object on the screen. Objects along the top edge of the screen get the max Z. Objects at the middle get 0. Object along the bottom edge get max Z with a negative sign. This is only relevant when using a Perspective projection, because larger Z variations translate into larger scale variations. If this value is too large, the sprites may end up being clipped out of view by the camera constraints. In order to get a consistent result, the Max Z variation should be the same for all 2.5D objects involved.
Hints
A straightforward way to use it is shown in the example project. Here we have a Family called 2.5D comprising all objects that require being rendered in a 2.5D way.
Status | Released |
Category | Tool |
Platforms | HTML5 |
Author | Mauro Vanetti |
Made with | Construct |
Tags | construct-3 |
Download
Click download now to get access to the following files:
Comments
Log in with itch.io to leave a comment.
nice work!!!!
i tried it in my own project, but i couldn’t get it to work properly…but this is my fault, not yours.
your example works really well.
Thank you Samuel!
Which problem have you met? I can help.
i think it was because i have some extra layers and they caused confusion. I thought that I had replicated everything, so it must be something else in my game that confuses things.
I see! In Construct, layers trump Z-elevation, which can break the perspective. In order for Z-elevation to work with perspective the objects whose Z-elevation you want to manipulate (with my addon or manually or in another way) have to belong to the same layer.
This gave me headaches so many times…!
cool!
Do you know what's really cool? This → https://villadelfina.itch.io/gincana
<3