Lightning in 2D (C# DX 9)

TheKill

Newcomer
Joined
Apr 25, 2008
Messages
1
Hello!
im new here so be nice. lol

anyway, im working on a game in C#, scrolled RPG based (like golden axe style, screenshot added), with DX9.

now i got a question.. this game is in 2D, and i want to add some lightnning effects (like when its night everything will be darker but there will be light source).
i need some directions, how would you do that??
i could just make everything darker and draw half visible sprites of half visible white light circles, but than things will "loss" colors and its a louzy effect.
i also thought about making things darker relevantly to their distance from light sources, but my terrain sprites are too big (256x128) and it will look too sharp. and i really rather not break my sprites.

so anyone got any ideas of how can i make some neat light sources effects in 2D?

thanks in advance
 

Attachments

Well to simulate the dark night is easy, u simply use the sprite.render method with customized color palette:

sprite.Draw(..., Color.FromArgb(255,60,60,80)

This will darken all ur sprites as well make them slightly blue (to better simulate the night light).

As for the light, like a torch in player's hand, well I think you would need two images, one rendered as night and another as day light, then you could mix them with some kind of mask applyed to the night rendered picture, which would be transparent in the middle to reveal a bit of day light... I really can't tell you how though... and I really don't know if it would work, but.. just a thought... The effect can be shown bellow

It would be nice also to have a separate sky layer so u could change the day clouds with some night stars, and also add some flickering to the light.

I hope this helps in any way.
 

Attachments

Last edited:
Back
Top