• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Modifying contents of a tile (colour and shifting)

SymbolShift

Member
I've searched the manual and forum and I'm unable to find an answer to this one, however the answer may be a flat out "no can do". I've attempted to visually simplify what I'm trying to achieve in GML (with GMS 2.3.6.595)

Assume I have an 8x8 tile (as illustrated):

example.png

1) Is there any way to change the colour (or a specific colour) of the tile?

2) Is there any way to shift the contents (or grab a specific area) of the tile?

The original tile remains unaltered, but the modified output would need to be displayed on the screen (either directly, or via a buffer). I know that I could create multiple tiles for each colour, or shift, and switch to that tile (with the tilemap_set tiledata parameter) to give the illusion of change, but this seems a highly inefficient way of doing it, and a huge waste of graphical tile space, for something that should be done "on the fly" in code.

I believe the tile_set_blend() function would change the colour, but is now obsolete. I also believe the tile_set_region() function would have worked to shift the tile, but is also obsolete. It's annoying to know that something was possible in GMS1, and has taken a step backwards in GMS2. Game-making languages from over 20 years ago could perform these basic tasks.

For changing colour, I am aware that using sprites and image_blend can do this, but I need a solution for tiles. I am creating levels where using multiple sprites for this would not be practical. Also, using Shaders could be an option, but seems way over complex for something so simple.

Any advice or help would be appreciated!
Thanks.
 

TheouAegis

Member
1) With a shader.

2) With the inefficient method you said.

As for the two functions you mentioned, they were very, very inefficient functions. Tiles were very, very inefficient in old versions of game maker. As somebody who was very vocally adamant against changing over to gms2 and still has qualms with some aspects of the tile system in gms2, it is a much better and more efficient system than gms1 had. Seriously, the old house system that you are referencing was garbage and needed to go.
 

SymbolShift

Member
1) With a shader.

2) With the inefficient method you said.

As for the two functions you mentioned, they were very, very inefficient functions. Tiles were very, very inefficient in old versions of game maker. As somebody who was very vocally adamant against changing over to gms2 and still has qualms with some aspects of the tile system in gms2, it is a much better and more efficient system than gms1 had. Seriously, the old house system that you are referencing was garbage and needed to go.
Thanks TheouAegis, I was afraid that would be the answer. That's a fair point about GMS1. I actually skipped GMS1, and started GM on GMS2, so I never experienced the pain with GMS1 tile functions. I'm thinking more of languages such as BlitzBasic dating back to the 90's. They could perform some very powerful blitter operations on graphical elements, thanks to the Amiga era. GMS2 tile functions are good, don't get me wrong, but just seem to be lacking a few things to make them amazing. I keep hoping they will add new functions for tiles in every new version, but development seems to be focused elsewhere.

As far as shaders, I need to look more into this solution. Any example I find seems to be over my head. If anyone knows of a straight-forward shader example, that can change a tile colour, I'd love to see it.
 
Top