In my opinion, the marked answer is incorrect.
It is actually quite simple to use box2dLights without using box2d if you don't want any shadows. The question was that if you could add some kind of circular light around the character.
I used two different approaches, only one used box2dlights.
The article in the marked answer describes a method using FBO. U really don't need it if you just want to highlight the area. U just need a sprite like this . Now put it somewhere on the ur screen, and when rendering, do the following:
batch.setBlendFunction(GL20.GL_DST_COLOR, GL20.GL_SRC_ALPHA); theLightSprite.draw(batch, parentAlpha); batch.setBlendFunction(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
At first, the mixing function changes, so we do not just visualize the sprite, but mix it in the background. After drawing it, reset the blending function will be normal, so that everything else after that will be displayed again. Here it is.
The second approach uses box2dlights. Yes, we need a box2d world object, but we donβt need to do anything with it. So what we do:
world = new World(new Vector2(0,0),false); rayHandler = new RayHandler(world); rayHandler.setCombinedMatrix(stage.getCamera().combined); new PointLight(rayHandler,1000, Color.BLUE,radius,x_position,y_position);
First, we create our world that simply does nothing. We only need this for the second statement, where we create our RayHandler, which computes our lights. In the third statement, we establish the ray handler matrix. In this case, I use scene2d, and thus using a cascading combo matrix. If you are using another camera, just use its combined matrix. The last statement creates a pointlight with rayHandler and describes the number of rays, the background color, its radius and its position.
All we need to do now is draw our scene or sprites in our render () method and call
rayHandler.updateAndRender();
after that in the rendering method. Pretty easy.