Y-sort background sprite problem

Thanks alot man i really appriciate the help i dont wanna be a nuisance but there is this problem i been struggling with a long time but i couldnt find an answer online if my characters collides with a collision the character begins the jitter or shake and i cant find an answer anywhere

1 Like

i ment the screen the character doesnt shake

Need more information. The relevant events, at minimum.

ok, then you have the camera locked to the player position somewhere. Try to smooth camera extension: Smooth Camera - GDevelop documentation

For context, there should be no material performance overhead, and it is the same number of clicks as modifying the z order and position (potentially less depending on the scenario), plus it will permanently be true rather than potentially having to modify the z order later if other objects are added.

Its also a single event (set position of camera on background layer to CameraCenterX/Y the base layer).

method 1

  • object setup
    • set z z-value of the object

method 2

  • scene setup

    • create a dedicated layer
    • set the layer order
  • object setup

    • set the layer of the object
  • runtime

    • sync camera
    • sync layer effects

Silver-Streak, this speaks for itself. You would have to concretely justify the claims of “potentially fewer” clicks and “potentially having to modify the z order later”.

Method 1 is zero events.

Sorry for the confusion

I was working off the info provided in the thread at the time I started writing the reply, including changing the origin point and with two background objects, once changing the origin was dropped, they’re roughly the same clicks.

Position:
1 - Drag bgobject1 to scene
2 - Click on instance
3 - In instance panel, click into the Z-order panel, then update
4 - Drag bgobject2 to scene
5 - Click on instance
6 - In instance panel, click into Z-order panel, then update

Layers:
1 - Click add a layer button
2 - Click the Default instance layer toggle next to new layer
3 - Drag bgobject1 to scene
4 - Drag bgobject2 to scene
5 - Drag new layer below base layer
6 - Click into layer name to rename, then update.

For context around the event, syncing the camera position will have no material overhead. You can have dozens of layer positions being synced at the same time and it won’t take enough render/processing time to even show up past 0.01ms (and will usually be 0ms) in the debugger.

As far as it being easier to maintain in the long term, if Dave ends up extending the background size in the future, it’s very possible that even -100000 isn’t enough just due to positioning as their character moves around the world, so they’ll have to go in and modify the z-order again to be elven lower. With the layer method it will always be below the base layer no matter how much it’s extended.

Again, these are all just minor differences, but since it is a common usage for layers it’s why I made that recommendation.

From my perspective this discussion is no longer useful. Hopefully there is already sufficient information here for developers to make up their own minds.

Agreed. Sorry for the potential derails, just wanting to make sure context was provided.

@Dave369 if you run into additional issues with the actual z-ordering and ysort again, feel free to update this thread.

Please make sure that your character sprite and background sprite are on different layer. The character layer is above the background sprite. This allow you to control the order in which they are provided.