I want to overlay a sprite on the game itself to darken the screen, and then overlay light sprite on it, so like the dark sprite would be one black pixel that overlays the whole screen and then one other sprite which is white in the high level of light, and darker when it becomes darker, how would I be able to draw and blend it all correctly?
Here is what i got so far for my rendering code:
public void Render() {
// seting up camera position
//render game elements and background
....
batcher.setColor(1, 1, 1, .25f); // set alpha to .25f so it wouldnt be
//completely black
batcher.draw(Assets.shadow, 0, 0, 15, 8f); // drawing the shadow over
//the whole world (15 x 8)
batcher.draw(Assets.light, 4, 0, 8, 2.5f); //drawing the light sprite
....
//finishing rendering
}
i also tried adding
batcher.setBlendFunction(GL20.GL_BLEND_SRC_ALPHA,
GL20.GL_BLEND_DST_ALPHA);
to try and get "multiply" effect in there, but that didn't work, i placed it right on top of the batcher.setcolor()
.
I've also placed the code of light rendering after the character and world rendering so it would overlay on the character and affect its color, (well that was what i had in mind..)
this is Assets.shadow
: https://i.stack.imgur.com/kzXlI.png (literally one black pixel.. idk if you guys can even see it?)
assets.light
: https://i.stack.imgur.com/mNANb.png
i enlarge those pics, and set the texture filter to linear to get light effects.
if anything else is needed please tell me and ill provide it.
EDIT: here is what it looks like in the game:
In light:
in shadow: