Lighting in the darkness
Hi and welcome to this week of programming 1.1.
This week I was going to work with something I dreaded and was excited to learn from first choosing colossus core as our Concept the lightning where we wanted it to be dark except where we light up in the game to see where we are looking or effects from things as secondary weapons such as missiles, lasers or even our time bomb.
We will also use our lights to show how much damage our ship has taken and when we are exploring the caves we will happen upon old ship parts from previous ships (not previous runs) and they will blink I think.
The colossus core concept had a dynamic lightning system where the light collides with objects and don’t show up behind but as I was looking upon guides to see how it was made I found some who was plausible and I took what I learned and discussed it with one of our graphic students in our group named Oscar. We decided we shouldn’t implement dynamic lightning and decided on a static lightning where it won’t collide with the surroundings because it was easier and removed a lot of work from our graphic designers too.
Now to begin with I decided to make everything dark I made a sf::RenderTexture and a sf::Sprite in a class for the darkness then I used .create (Screen width , Screen Height) and then I set the texture but I had to Sprite. Get Texture for it to work. By this time It was time to work in main where I prototype where I cleared the texture of the render texture then this is where I have to draw out the lights it out before the clear of window then I had to draw out the darkness.
Now it was time for my light class to begin with I added sf::Texture and sf::Sprite then I began by setting the texture I was going to use for my experiment and fixed the colors at 255,255,255 and the transparency at 255.
Now something I still have some problems with is I have to use Blendmode::BlendAdd to work which is needed to make it see through the darkness but I will burrow through to and hope I can succeed.
For I will only make a single object instead of a vector for our lights since I only want to try how it works. Now I will draw it out before I display it on the black canvas.
If you want the link for the tutorial from this work just pm me.