Hello Guest

Author Topic: tk2dParallaxCamera script + tk2dTileMap, z-index issue  (Read 4996 times)

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
tk2dParallaxCamera script + tk2dTileMap, z-index issue
« on: March 09, 2014, 03:31:46 am »
I'm attempting to implement the tk2dParallaxCamera script with tk2dTileMap. The problem I'm facing is that the parallax layer is drawing on top of all other layers (instead of behind), and I can't figure out why. I've followed the example parallax project and everything seems to be in order as far as I can tell.

My tile map is setup as such:


And my cameras:



Do you notice anything wrong? Is there something else I'm not considering? Thanks.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dParallaxCamera script + tk2dTileMap, z-index issue
« Reply #1 on: March 09, 2014, 01:35:25 pm »
The order with the parallax cameras is defined by camera depth parameter on each layers camera. Make sure they are in the order you want them to draw in.

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: tk2dParallaxCamera script + tk2dTileMap, z-index issue
« Reply #2 on: March 09, 2014, 04:02:25 pm »
I made sure that the main tk2dCamera has a depth of -1, and that the child parallax layer camera has a depth of -2, but now that layer isn't viewable at all in the game. Only when that camera has a depth of -1 (or higher) does that layer draw, but still on top of the the other layers. I've tried fiddling with the values in the same fashion but to no avail.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: tk2dParallaxCamera script + tk2dTileMap, z-index issue
« Reply #3 on: March 09, 2014, 04:10:39 pm »
Turn off the cameras one at a time to make sure they are all set up properly. You can try making sure you have 1 camera which does the clear and everything else just clearing depth. This is most likely because something is writing to z when it isn't meant to or not clearing it when it needs to. Hard to guess how you have it set up.

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: tk2dParallaxCamera script + tk2dTileMap, z-index issue
« Reply #4 on: March 10, 2014, 02:10:50 pm »
It seems setting the sort layer order for the layers in the tile map, along with fiddling with other properties, resolved the issue. Thanks!