Terrain layering

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Terrain layering

Post by zookeeper »

After reading the wiki and a considerable amount of experimenting didn't yield any results...

Is it possible to have a partially transparent terrain tile, with another tile/image underneath it that can be seen through the transparent parts? I've tried it like this:

Code: Select all

[terrain_graphics]
    [tile] # This is the foreground tile
        x=0
        y=0
        type=x

        [image]
            name=edge
            position=horizontal
            layer=1000
        [/image]
    [/tile]

    [tile] # This should be seen where the above tile has "holes" in it
        x=0
        y=0
        type=x

        [image]
            name=background
            position=horizontal
            layer=-1000
        [/image]
    [/tile]
[/terrain_graphics]
The aforementioned bit of code makes only the foreground visible, with the transparent parts of it drawn as black (the transparencies in my .png's are fine).

One of the reasons I'd very much like to do this with separate foreground and background tiles is that there will probably be need to change the background according to time of day etc. Also, the foregrounds are modified canyon tiles, so there would be a bit too many files to manually fix (for my taste, anyway).

Of course, if this is a fundamentally stupid thing to do or there's a more convenient way to achieve the effect, please feel free to tell about it.
Darth Fool
Retired Developer
Posts: 2633
Joined: March 22nd, 2004, 11:22 pm
Location: An Earl's Roadstead

Re: Terrain layering

Post by Darth Fool »

zookeeper wrote:After reading the wiki and a considerable amount of experimenting didn't yield any results...

Is it possible to have a partially transparent terrain tile, with another tile/image underneath it that can be seen through the transparent parts? I've tried it like this:
<snip>
The aforementioned bit of code makes only the foreground visible, with the transparent parts of it drawn as black (the transparencies in my .png's are fine).

One of the reasons I'd very much like to do this with separate foreground and background tiles is that there will probably be need to change the background according to time of day etc. Also, the foregrounds are modified canyon tiles, so there would be a bit too many files to manually fix (for my taste, anyway).

Of course, if this is a fundamentally stupid thing to do or there's a more convenient way to achieve the effect, please feel free to tell about it.
This is possible, at least in a backhand sort of way. The sunken ruin graphics depend upon this kind of effect. You could emulate this by copying that, but there probably is an easier way: placing items. See the bay of perls:

Code: Select all

                {PLACE_IMAGE misc/cage.png 4 38}
Of course this gets done in the scenario and would need to be in the prestart event. Hopefully that is enough of a clue to get you rolling again.

edit: Oh, and you could use events with the turn properly defined to make it change with the time of day...
Post Reply