I’m trying to create a torch item in my game, that will light bitmapsbitmap that are behind him in a circle shape (for example torch in terraria), so basically I’m trying to understand how to create a bright circle. example picture made in photoshop: http://puu.sh/evqet/4277f7e2c8.png
anyone has idea how can I do that?
2
Answers
There many ways to achieve this. One (fast) is to use the HSL color space and increase the L parameter foe example. I don’t know if you are working with RGB if there is an easy way around it.
I guess since you probably wont want to check every pixel in the circle you may need to add a second circle semi-opaque for example which will make the calculation easier for you.
You can simply use a transparent PNG sprite and draw it as a bitmap in your canvas at desidered position.
More info about how-to-do can be found here and here.