Canvas and Z order

This forum is currently in read-only mode.
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • I'm making a split screen game and I'm running into trouble with the canvas object. I want the 2 sprites (which are in the family object) to go behind the other if it's Y is higher, as you'd expect. However, I have no idea how to do this using the canvas object. I tried "For each 'Friendly' in order of 'Friendly.Y' Ascending" - "paste to canvas", but it would only paste one of the sprites and the other wouldn't even show up.

    Here's my .cap:

    The events in question are in "Layout 1 events"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Canvas is flat. The drawing order is important; the one you draw the last will be drawn over everything else.

    Reorder the drawing order by the Z order, should do the trick.

  • Any way I can do that? Like I said, I tried "For each 'Friendly' in order of 'Friendly.Y' Ascending" - "paste to canvas" but it only pasted the lower most sprite.

  • Set it up like this (indented lines are sub-events):

    + System: Always (every tick)
    -> Canvas: Clear to transparent
    -> Canvas: Set position to object Player1 (image point 0)
        + System: For each Friendly ordered by Friendly.Y Ascending
        -> Canvas: Paste Friendly into canvas
        + System: Always (every tick)
        -> Canvas: Set position to 80, 120
  • Thanks so much, that did the trick. Awww I love this forum, you guys are so helpful

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