GameMaker [Solved] Platformer Lighting Mask

Anixias

Member
Hi all, I am developing an open-world 2D platformer right now. I'm about to finish getting all of my basic world stuff (solar system simulation to accurately display the sun and moon, moon phases, eclipses, etc.) and am getting into the lighting aspect now.

My dilemma is simple: I want the lighting to not affect the parallax backgrounds or foregrounds, only stuff in the plane the game takes place in. Think of Terraria but instead of block lighting, I'm using surfaces and images of lights.

What is a good way to create a mask of everything the lighting should affect? I thought of redrawing every object with a shader that colors them solid white onto a surface, then multiply the lighting onto that but I am also using tiles in the room editor, which need to be affected by lighting. As far as I'm aware, I can't render the room tiles in code onto a surface without using matrix functions to offset the tilemap to the view coordinates. Does anyone know of a better method?

Thanks, Anixias.
 

Anixias

Member
Hey, thanks for that. I managed to somewhat create a mask from the tiles using simple draw_tilemap functions, but it doesn't work super well since my views are at floating point coordinates. I'll give your method a shot, keeping the areas light should not affect totally transparent on the application_surface. Maybe that will solve some of my issues?
 
Top