Auto shadow / paint over tile

Hello,
I’m using Tiled to make a Spectrum Next game and I use to differently coloured tile sets to make level.
One bright, the other dark (both exactly the same tile set - just different palettes) where I use the dark set as a shadow.
So I will map out my level using the bright tile set (tiles 0 - 512 as an example).
I then need to go over this level map and replace some tiles with the darker version to give it a shadow effect (so it will be tile + 512 for example).
Is there a quick way to set up Tiled so that I can just draw over the tile set that is already down and make that area use the darker tile set?
I’m pretty new to Tiled and an artist (not a coder), but if there’s a way to do this it would save me hours of work and maybe even allow me to do slightly more detailed levels for my game.
Thanks for any advice,
Mike.

I don’t think there’s a built-in quick way ): To do this quickly, you’d need to write a script that adds N to all tiles within a selection.

Non-script ways:

If your “shadow” tileset is a separate tileset, you could make a copy of your base map and change it to use the shadow tileset as the base tileset by editing the TMX/JSON file. Then, you could copy+paste the parts you need into your base map.

You could use the Select Same Tile tool to select and replace instances of each given tile without accidentally affecting other tiles. This is so slow that I’d only recommend it if you have a fairly small number of tiles, and not 512 of them xP

Thanks for the info.
I’ll try taking a look at the scripting area and see if it’s going to be easy enough for me to get my brain around been able to do it.

Here’s an example of a tool that draws a tile rectangle:

It shows how you can build a preview of the change and then apply it. It does this based on the currently selected tiles, but it could also inspect the tiles on the currently selected tile layer instead.

Hi Bjorn,
Thank you very much for the code, but I’m not sure that is what I’m looking for (I’ve give it a try thou).
What I’m trying to do is once I’ve made the overall level, I want to go back and add shadows (tint) areas. If you look at the picture attached it will explain it better then what I can.
I’m trying to make a game for the Spectrum Next which is limited to 432 tiles (8*8), so all the tiles are split up into 16 palettes of 16 colours (think SNES) and one of the tricks is palette swapping the tiles so you can have darker versions without any extra tile map cost.
I do this in Tiled by simply recopying the tile map and changing the palette, so I end up with XXX bright tiles and XXX dark tiles. All I need to do then is make a new palette and draw the border tiles where the tiles meet.
What I’m looking for ideally is to be able to go into a shading mode and tell it every time I press the left mouse button over a tile, it will increase the tile number by X amount (or decrease it by -X if I use the right button) - ideally this number will be user alterable.
The border lines can be done manually.
I’ve been thinking of an easier way around it, but I’m stumped.
Even if it updated the entire layer, that would be ok as I could clone the layer, darken everything and erase the parts out I want to see as bright.
I was looking at Automap as a possible way around it, but the rules for >432 tiles would take just as long as doing the levels by hand I guess (even if that would work).

Again thank you for getting in touch, it’s much appreciated.

Cheers,
Mike.

Purple_Mockup_V1S_0B.png

Yeah, this is why I linked you to the example that implements a tool that modifies tile layers. Since you have your tiles organized such that you could adjust their shading by increasing/decreasing their tile ID, doing this with JavaScript should be a lot easier than setting up AutoMapping rules. Just ask if you have any questions.

Nice looking game, btw!

Thanks again for your help in this. I’ll pass the code over to the programer to look at. It will give him a good starting position to work from.
Also thanks for the nice comments about the gf/x. Couldn’t do it without Tiled.

1 Like