How to create lighting in libGDX - java

I have recently been making a platformer game with a shape as my player. The shape would be morphed into different shapes during the game: eg. square, triangle, etc.. Currently, the lighting system in my game is non-existent. I have a blur effect in my square.png texture currently. I just want to add a simple light effect in the current shape of the player without any external libraries (I'm talking to you, BOX2D!) or any other sprite assets or by using glsl. I find glsl a bit confusing, and I'm not using box2d in my game.
Thanks in advance!

Related

Libgdx painting game logic

i'm learning libgdx in purpose of building a realtime multiplayer painting game. Game will last in 120 second and 4 people with 4 different colors will race to paint more portion of the screen.
Now i'm trying to implement circular painting as player moves. As i made some researches, i saw that i can use pixmaps to implement such behaviour. As game updates, i will fill a circle at players x and y with radius r and draw a texture that scales the screen from pixmap( which is also game map). Is there a better way to achieve this?
And i must make it for all resolutions. 1024X1024 resolution versus 240x240 must be able to play. Can i do this by using lowest resolution pixmap and drawing a scaled texture from it? Thank you...
Thats the game im trying to do..
https://www.youtube.com/watch?v=EU8Eyh0tZOo&t=270s
You need to use Framebuffer for this kind of game. Pixmap is extremely slow for using every frame.
https://github.com/mattdesl/lwjgl-basics/wiki/framebufferobjects
And yes you can make all resolutions play together like this.

Libgdx Platformer 2d beginning adding enemies

I have read The guide to implementing 2D platformers
http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/
I want to develop the second way (Type #2: Tile Based (Smooth))
Collision is still determined by a tilemap, but characters can move freely around the world.
I have made a class Enemy with position and velocity.
How could I move the Enemy in the world when it is not visible in the screen yet? There is any GitHub example of this issue?
I am not using Box2D. I have started with the Super Koalio Example:
https://github.com/libgdx/libgdx/blob/master/tests/gdx-tests/src/com/badlogic/gdx/tests/superkoalio/SuperKoalio.java
My problem about rendering was solved using OrthogonalTiledMapRenderer

Game Collision detection libGDX

I can do 2d collision detection of boxes and circles ,but I have a question . How can I do collision detection in this situation (1,2).I am using libGDX game engine for creating games.
Fixture (1) in your world should most likely be a ChainShape. ChainShapes are determined by an array of Vector2 objects, the more you have, the smoother the ChainShape tends to be.
Without very tedious scripting, making a fixture from an image is done by putting vectors at relatively close points to make a shape that looks similar to the image.
Further information on how to create a ChainShape can be found here.

Fill a ShapeRenderer rectangle with an image(.png)?

I am new to libgdx. I am trying to write a basic android game with the libgdx framework
Is it possible at all to fill a rectangle drawn with libgdx ShapeRenderer with a given image?
If yes, how, and if no, is there any kind of hack or workaround?
Images to be put on the screen in Libgdx (and OpenGL) are known as "textures". The ShapeRenderer library does not support textures.
That said, the Libgdx texture and SpriteBatch APIs are optimized for drawing image rectangles. Check out the overview and tutorial here:
https://github.com/libgdx/libgdx/wiki/Spritebatch%2C-textureregions%2C-and-sprite

Libgdx create sky / environment in 3D

I am developing a 3D game using the Libgx 3D api. Now i want to add some environment (not the Libgdx Environment, but a real environment), like the sky or some background. I have heard about the so called skybox, and i understood, more or less, how it works.
This "skybox" is a Box arround your Gameworld. So you are inside this box. You add a Texture to all 6 faces at the inside of this box. Now you set your camera to the center of this box, but with the right view direction, and start the rendering, so you have always the same distance to the faces, but you can rotate arround at look at other faces. Then you set your camera where you really are in the world and render all the models, objects, whatever. Did i understand that right?
I could not find a tutorial on how to do that with libgdx. So my question is: How do i create a "skybox" in libgdx, how do i add my Textures to it and how do i render it as background/environment? Or are there other, maybe easier possibilities?
You can use big sphere which is textured inside around your world. If use blender, just create sphere object and unwrap this mesh. Then flip normals to see texture inside the sphere.
Another way is to create cubemap as you described above. I have made a class which works with cubemap. Just follow this link: LibGDX 0.9.9 - Apply cubemap in environment

Categories

Resources