Dynamic 2D lighting with Box2DLights
Lights have a huge influence on the final appearance of your game as they are always present in a person's day-to-day life. They enrich the visual interaction that the player receives by adding some dynamism to the scene and, therefore, catch his or her attention.
Box2DLights was created by Kalle Hameleinen relying on Box2D for raycasting, so it can understand the geometry and OpenGL ES 2.0 or above for rendering through shaders.
In this recipe, we will explore the library, explaining how to endow your game with a significant visual improvement.
Getting ready
The code for this recipe is concentrated on one single file named Box2DLightsSample.java
. Make sure that you add the following dependences to the build.gradle ...
Get Libgdx Cross-platform Game Development Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.