Z Ordering

0 favourites
  • 4 posts
  • ok, so, im currently saving up for a licensed copy and am using the free version w registration i.e. 50 events instead of 30.

    so i know with the paid version theres wonderful features, such as the ability to add more than 2 layers, and that handy little z order list; however, i dont yet have those, and am looking for a temporary workaround.

    what i have currently is working up until i added my scenery object, so it may just be too much going on, sorry for the lack of capx, but essentially i have an autorunner.

    if player x >=400 set player x400 - this keeps him in the middle of the screen and all gameplay at x 400

    the player essentially stays at 400, and all scenery moves 180 degrees when right is pressed.

    i have sets of emitters, one for a tree sprite, with several large tree backgrounds, a second emitter for single tree sprites, 2 more emitters for a ground path sprite, and a fifth emitter for scenery such as rocks, bushes, random plants.

    the idea was to use disneys style of 3d layering, to create an almost living environment.

    currently, my event sheet says

    On Right Key Is Down > tree bg,tree bg2, groundblock,scenery - move speed angle; Groundblock,Treebg2,Treebg - move to bottom of layer

    -sub event - player - on collision w scenery, if player y>= scenery , scenery ,player, groundblock, treebg2,tree bg - send to bottom of layer

    this makes it so that the objects move when you hold right, and whenever youre moving they rearrange and correct their z order

    the problem i've been having, is i'm trying to make it so that if the player sprite is in front of an object so to speak, their z order is higher, and they show in front of the bush etc, but if their z height is lower, placing them higher on the screen, behind the scenery, it would show up in front of them, blocking part of your view.

    it seems to work about 50-55% of the time.

    all of the background trees and ground paths function fine, but i can be at the bottom of the screen and still show up behind some objects.

    anybody have an easier way of ordering objects z layer other than constantly sending things to bottom/top of layer as theyre spawned or creating multiple layers (as im capped at 2 layers atm)

  • why dont you have the player always on the lower layer and all objects that should be behind him are on his layer

    then objects that are supposed to be in front of the player spawn on the top layer.

    so you can check:

    if player overlapping another object

    AND

    object.layername = "toplayer"

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • why dont you have the player always on the lower layer and all objects that should be behind him are on his layer

    then objects that are supposed to be in front of the player spawn on the top layer.

    so you can check:

    if player overlapping another object

    AND

    object.layername = "toplayer"

    this would work however i only have access to 2 layers, the top of which would contain the HUD and controls. however, as the game is mostly contained in 800x800 pixels, it may work to just have hud always on top of z order.

    also, objects are randomly spawned, so i suppose i could say on created if sprite y => player y send sprite to top layer; the issue with this is that thats essentially what i have, except instead of changing the layer ive been reordering z order. ill play around a bit now that ive some free time and see what i can manage.

  • I was also having this problem, I use the Rexrainbow Zsorter plugin

    https://drive.google.com/open?id=1EuaIY ... odSuhKoPVV

    How to Install Add-Ons in Construct 3

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