• 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!

GameMaker [Solved] Applying a shader to tiles

K

KitKatKatu

Guest
I've made a shader that requires uniform variables. It works great with objects, and I can get it to work on tiles without uniform variables using layer_shader(), but i can't for the life of me get it to apply to tiles with uniform variables.

I tried to use layer_script_begin(), but found out you can't pass arguments to the script. So I put together an object that sets the shader upon creation and resets the shader upon destruction. The uniform variables are set in the draw event and they draw info from global variables so that they can be updated even if the shader object doesn't currently exist. The idea was that I was going to create this object and any tile drawn after would use that shader, but this doesn't even work with the objects that were previously working with the shader.

Wondering if someone might be able to point me in the right direction, because I don't know what I'm doing lol

Edit: The object I created wasn't working because it wasn't on the same layer as the tiles it was supposed to alter! You need to create a new shader object for each layer of tile you wish to affect as far as I know now.
 
Last edited by a moderator:
Top