Is it possible change the Z of a sprite like a 3d box? Any tricks?
You can change the Z order of any sprite (to have one sprite show above another). There is no depth axis in Gdevelop (2D is height or width), so if you want to simulate an object moving away or closer to the camera, you need to increase or decrease the scale, based on this imaginary “z” position, which you could store in a variable.
You may need to also make sure that objects with lower or larger (up to you really, whatever makes good sense in the project) “z” position get a larger zorder (so that they are displayed in front).
Of course you won’t really get 3D (you can’t see from the sides of the object, as there are no sides to be drawn) but you could scale things up and down to simulate objects passing in-front or below other objects. Even without scaling, you can simulate this by changing zorder (so that one object is drawn above or below another).
P.S. Maybe you could give some more information on what kind of idea you have? Maybe this would help get a more helpful reply than this one.
Edit2: There’s actually a 3D box object in Gdevelop native mode. Only for boxes, as far as I know.
The scenario is that I have all the 3d boxes having a -250 Z and I found out that the walls of the boxes seem to overlap the sprite even when the z-order of the sprite is higher.
I found out the problem and solved it. Thanks guys.
You can also use parallax scrolling, by having different images on different layers. Then go to actions and set a slower scrolling rate for a layer the farther the images on the layer are.
In Actions>Layers and Cameras>Effects>Camera center X position:
New layer 1
This makes the objects on New layer 1 (which is farther from the front) scroll slower, faking a depth effect. (10% slower compared to the Base layer speed)