Hi :),
You can also make use of a 2D-array for the “shadow”-tiles that you will draw over the scene.
In this array you can store the alpha-value for each tile (by default the alpha-value should be 1f).
Then you calculate (with the help of the light’s position) in which part of the array your light is.
After that you can decrease the alpha-value of the tiles next to your light and the tiles next to these tiles and so on…
Maybe like this:
if(tiles[x][y].getPosition() == light.getPosition()) {
tiles[x][y].setAlpha(0f);
tiles[x-1][y].setAlpha(0.5f);
tiles[x+1][y].setAlpha(0.5f);
tiles[x][y-1].setAlpha(0.5f);
tiles[x][y+1].setAlpha(0.5f);
// and so on..
}
When this works, you can try to create a recursive or even iterative algorithm for “the tiles next to the tiles next to the tiles and so on”.
Another possibility is to make the background-colour black and then you can decrease the alpha-value of your normal tiles (cf. this)