Skip to main content

News

Topic: map layers and transparency (Read 5982 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
map layers and transparency
i wanted to have some nice water FX and i thot i could play with layers to get there

the idea was an opaque 'ocean floor' layer, with a partially clear paralax layer right over that, then a partially clear scrolling layer on top. these three layers would then be under a ground layer that u walk around on.

when i fill a layer with tiles that have transparent and opaque pixels, the engine renders a black layer behind that tile, and u cant see thru it to the tiles below... i think


  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: map layers and transparency
Reply #1
If you fill the bottom most layer with transparent tiles, you'll see into the back buffer, which is black. As a rule of thumb only layer 1 and on should have transparent tiles. As far as your description goes, Sphere can do all that. If you use the older editor and go into the layer properties (by right clicking the layer in the layer list), you can choose for a layer to parallax.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: map layers and transparency
Reply #2
To build on what Radnen said about the bottom-most layer, there will also be visible tearing in most camera movement if you use transparent tiles in that layer.

  • DaVince
  • [*][*][*][*][*]
  • Administrator
  • Used Sphere for, like, half my life
Re: map layers and transparency
Reply #3
If transparency reached all the way to your bottom layer, you're going to be seeing a mess - things might be black, as Radnen suggested, but they could as well be whatever was displayed the frame before (like a previous map, or the map's picture before any scrolling happens). So make sure your bottom most layer is always filled with opaque tiles.

That said, you can fill the bottom-most layer with a semi-transparent tile, and the opaqueness of said tile will fade away that mess I just mentioned. You can get some crazy effects like that, but it would really have to be a conscious choice (like if you were trying to make some Yume Nikki type game or something).

Re: map layers and transparency
Reply #4
i guess wat was happening was i was having troubles with the tileset.... when i was testing stuff out i forgot to save the new tiles... it was causing a crash

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: map layers and transparency
Reply #5
Oh in that case you should almost always use my new editor. It always saves tilesets separately to stop that from happening.
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here