Layering sprites (SOLVED)


#1

How do you choose which sprite should display over the top of another, I tried messing around with the blend method but to no avail…


#2

You can adjust the z position. If you wanted a game where objects closer to the player were in front you could adjust z based on the y position for example.

Example here

Basically, you want to update the z position for everything you draw to be at the right “layer” - you can segment groups based on z distance, and have very fine changes for z distance for example 0.47573 …


#3

Clever, I thought the z coordinate was obsolete for 2D games


#4

Defold is a full 3D engine. The tools are 2D oriented now though.


#5

is there any way to view objects in 3D space yet?, or is the workspace viewport locked to 2D?


#6

Defold’s editor can’t (for now at least…), but you could make a level editor with Defold that could for building content. Keep in mind that z index in default rendering script doesn’t change the perspective scale at all it’s only used for layering, but you can modify the rendering script to do anything any 3d engine can.

I want make a level editor like this sometime…

Especially features like this


#7

I know that it have been 3 years but so the King is using Defold as a 3D engine but we can only use it as a 2D engine right?


#8

Nah, we are creating a 3D game with it. Works absolutely fine! King is not in any way using another version of the engine. It’s all the same.


#9

I’ve made a lot of 3D tests with Defold. If there’s a kind of 3D game you want to make with Defold make a thread and we can offer suggestions on how to accomplish it.


#10

Right now I don’t have a plan to create a 3D game with Defold but I read in somewhere that currently Defold editor only supports 2D then I wondered how to create a 3D game with it. If you know any tutorials about it if you can share with me, I will be gratitude.


#11

Defold is primarily meant for 2D dev in that most of the productivity tools it has were made with 2D gamedev in mind (so far) but the point still stands that it is actually a 3D engine.

Check out this example for a very simple base for a first person shooter https://github.com/subsoap/fps

I have some 3D materials here DefMaterial - A Collection of 2D + 3D Materials

Although the built in model material stuff has changed since then so if you are making something for production you’ll want to study those and make any necessary changes.


#12

The editor does support 3D now, though it’s very basic. Hold Ctrl and drag with the left mouse button to rotate the viewport camera. (And press . to reset it.)