🔴Game Maker Studio 2 | Advanced - Surfaces - Light system

preview_player
Показать описание
This video tutorial shows you how you can make a light system in gamemaker studio 2. This code is based on the original yoyo site in the link below.

// this link has been removed by yoyo:

get the light system free here:

🎮 My free game Clunky souls:

💓 My assets:

👑 Support me and get fresh game art and game maker projects every month:

Follow me on:
Рекомендации по теме
Комментарии
Автор

Wow I've been trying to make something like this for 2 days. That was so much more straightforward.

poofydoofyvideos
Автор

Hello! If you want to make colored light sourses overlap properly, you have to make two surfaces: one to substract (white from black) and one to add (color).
In substract surface call "draw_clear_alpha(c_black, 0);" BEFORE drawing a rectangle, in add surface call it INSTEAD of drawing the black rectangle. This call will fill the entire space with empty pixels, so you will avoid strange behaviour when changing shadow alpha and going from room to room.
You can also make it with one surface, but it'll be complicated, as you will have to make all substract functions first and all additive functions second. Not swapping surface every time should be more efficient if you have a lot of light sourses though.
P.S. It's a good video, thank you.

myinnocentsoul
Автор

Wow this is exactly what I was trying to look for for a long time now since my game is in a dungeon setting with torches and other light sources and it looks so much better now and how I imagined it to be. 😁😁😁😁

Edit: Also I was having this issue where when I have 2 color tinted blends over lapping each other, it would create this glitchy black void between them and I was reading through some of the comments to find an answer to it but generally came to the conclusion that Gamemaker just isn't the best with real lighting to be able to do that, so I actually found a way to fix it if anyone is having this issue or wants an alternative solution if you have one already, and its really simple and effective. All you have to do is still keep all light colors in the light system object white and then create a new object (maybe adjust its depth equal to the light system depth or however you need the depth of the lighting to be) and then just draw the light circle sprite again exactly how you did in the light system object except without the blend mode and then you can choose the color of light you want it to be in the color part of of the draw_sprite_ext. The white blend mode light system object will perfectly clash with each other to produce the light and then the second "light circle" which is just the same white light sprite you used for the first is the color filtered light that doesn't interfere with the blending logic therefore it wont clash with each other to create the black void glitch. Hope this helps if anyone was having this issue. 😁

P.S Also remember to adjust the alpha on the color tinted light to make it relatively match the softer white light color unless you want it to be more intense, and also you might actually be able to do this in the same object instead of creating a new one if you code it outside the surface drawing braces, but I think personally anyways it feels more organized to have another object for it especially if you have a lot of things that will have light.

RYTHETRO
Автор

Keep the coming, love seeing these videos!

pauldolton
Автор

Nice! I m going to use this system NOW
:)

kiwanok
Автор

Great tutorial! I changed the "with" object to my player and it follows it around, do you know how I could toggle the light on and off?

Edit, I've also found it isn't persistent between rooms as it draws the rectangle in the room the player spawns in

pm_pm
Автор

I got some people where their light surface isn't working properly, so here is a link where you can find the a cookie cutter project or just the local import for a surface with a light cone/radial light:

Everything is totally free here, CC0 made by me.

upIndie
Автор

I've got it working but it only covers where my viewport is originally at, any idea how to either make it follow the viewport when the player moves or just cover the whole screen because I'm completely out of ideas.

yeast
Автор

Hello i have a game with moving camera as you in the video, but when my "Player" is moving and camera follows him the game will get darker and if i stop back to the normal. Where is the problem?

divyhonza
Автор

Hello, thank you for the amazing tutorial! Is there any way to make the rectangle not have to be black? I'd like to mix a little bit of blue in there, but when I change the color to anything but black it looks weird.

scrapbox
Автор

Hey, thank you for doing these tutorials.

benvictim
Автор

Help, whenever I try to use the light system it gives me the errorr message:

ERROR in
action number 1
of Create Event
for object DunLight:

Unbalanced surface stack. You MUST use surface_reset_target() for each set.

What should I do?

sledge
Автор

Thank you very much for the tutorial! WouId you mind if I used the Sphere sprite for a comercial game? I'm not sure how I'd go about making one myself, and I'm sure it would look the same anyway. Thanks in adavance!

daone
Автор

Hi there! Is there a way I can change the sprite transparency in order to match a different color in the surface. I want to draw a surface that is dark-blueish, not entirely black, but if I do the light sprite looks very weird, like a square instead of a circle because the transparency stops being covered. The color I am drawing my surface is rgb(0, 0, 20). I tried filling the corners of the sprite with this color to see if the square becomes a circle again but the result was worst. I hope I make sense.
Thank you for the video, btw :)

lianvelasco
Автор

Hey 1up! Love your tutorials, learning a lot! Just a question: the light I setted in my game passes through the wall. How can I get it not to do so?

leogutschow
Автор

is there a way to make the dithering effect on the light slower?

crimmerz
Автор

Hi!
I have a problem! if I did for oPlayer in Draw - Draw_self();
those lights don't work for him? how can this be corrected?

danb
Автор

Is it possible to have objects drawn so that the lighting effects apply? This works great for the tiles, but much of my environment consists of objects.

derekdavis
Автор

This is awesome! I do have a question though. In my day/night cycle, I have a black wall of darkness that moves across the screen to simulate the sunset. As it moves across the screen, I would want any light sources to be drawn one pixel at a time until it's completely covered by the darkness. At that point, the entire light would be drawn. How would I do this? Should I use draw_sprite_part and add to the x value over time?


Also, how did you create the light sprite exactly? Could you send the sprite?

EmoJoshSavesTheWorld
Автор

Than you man, this work on Game Maker 8.1? (sorry idnt speak english very well

uzibanana