Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / varying light by time

Author
Message
tmu
7
Years of Service
User Offline
Joined: 2nd Feb 2017
Location:
Posted: 9th Jun 2017 20:58
Hello,

I am looking to create some lights on a 2D game screen, so I can change a game from daytime to nighttime and back. Set a few point of light that give light when dark, no specific points during daytime (so remove the extra light when not needed). Then possibility to fade from one to another (day to night and night to day). Also, I would like to have the effect impact most of the objects (sprites) drawn on the screen but not all (e.g., HUD elements do not go dark).

Was looking through the shader thread for something I could use.

This one from baxslash seems promising: https://forum.thegamecreators.com/thread/213453

But setting the ambient value on this does not work quite as I was hoping. Setting ambient values to 1.0 makes the whole screen white, except for the area around light sources. I would expect it to make the screen look like the background image with its normal (unchanged) colors. The code seems to use SetSpriteColor() but I could not find how to make SetSpriteColor take "percentage of normal colour" instead of absolute values. Also, like I said, I would like to see this on whole screen except the GUI elements on top (HUD or whatever one might call it). Not sure if SetSpriteColor does that other than for a single sprite..

Any ideas on how to make this happen?

Thanks,
T

Login to post a reply

Server time is: 2024-09-30 03:22:59
Your offset time is: 2024-09-30 03:22:59