How do I prevent z sorting from breaking blend mode?

0 favourites
  • 6 posts
From the Asset Store
A master sorting Puzzle fun and addictive puzzle game! A challenging yet relaxing game to exercise your brain!
  • Hi,

    So I want to be able to have the player dig a hold in a top down style game. Rather than make a million different digging animations, I just wanted to have 1 and then use a block with 'destination out' to hide the lower part of the player, and as they continue to dig, just shift them down by a pixel at a time, essentially giving the illusion that they are digging into the ground.

    However, it appears that something happens when objects are sorted by z order, and it mucks up the hiding block so that it only works when the player's y value is lower than any other z-sorted object.

    After a little more investigation, it appears that 'sort z order' changed the object's layer in game which, as this hiding method requires 'force own texture' to be on in the layer properties, would explain why this stops working. Is there a way around this?

    Included a .cp3 of the issue: dropbox.com/s/r86rebxpmneen0h/hiding%20player.c3p

    Cheers

  • For Destination Out blend mode to work, both the block and the player need to be on the same layer, and the block needs to be above the player. However, since you have other objects (tree), which can be above or below the player, the block will also erase parts of the trees which are below.

    You probably need three layers - layer 1 for trees below, layer 2 for player+block, and layer 3 for trees above. Move trees between layers 1 and 3, don't change player's z-order.

    There may be other solutions, depending on your game. For example, when the player starts digging, use DrawingCanvas - paste player sprite on it and erase the bottom part.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks for the reply

    The three layer system sounds like it might be a major pain, especially when I do things like have multiple trees and the like overlaid on top of each... thinking it might struggle to accommodate for those types of scenarios.

    Never used drawingCanvas before, looks like it's time to delve into some tutorials :D

    Cheers

    -edit-

    er, so there's not a whole lot of information out there on how to capture a sprite and edit it in DrawingCanvas (at least if there is, I can't find it). If anyone has a link to how this is achieved, I'd love to see it.

    Cheers

  • gah! I got the drawingCanvas to work so that it takes the player's sprite away from the bottom when they're digging like I wanted, but now I'm having the issue that the drawingCanvas object won't draw as part of my depth system as it can't be added to the depth sorting family.

    So pretty much the same problem as the first method.

    :(

    Is there a way to add a sprite and an object like the canvas to the same family?

  • You can simply move Drawing Canvas in front of the Player on every tick.

  • oh wow, that was easy.

    Lol, thanks dop!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)