Java is both a popular object-oriented programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

learn more… | top users | synonyms

0
votes
1answer
179 views

How BufferStrategy works

I've used this piece of code a lot in my games, but I still don't know exactly how it works. // Main loop while (!done) { // Prepare for rendering the next frame // ... // Render ...
1
vote
1answer
85 views

How to use mipmap with TextureAtlas and AssetManager

I searched on the Internet but couldn't find the way to use mipmaps with libGDX TextureAtlas. I want atlas instead of normal textures because as far as I know mipmap supports only 2^n width and height ...
0
votes
1answer
157 views

LibGDX - Accelerometer Problems

I got some issues. I'm using LibGDX. When I hit an object, my Fighter is supposed to fall to the Ground. BUT, because of the Accelerometer, i can still move it up and down eventhough it died. The ...
1
vote
2answers
133 views

Rotating a swinging sword in LWJGL gives wierd results

I'm making a 2d top down game in Java using LWJGL(OpenGL, essentially). I recently tried adding a swinging sword mechanism. My coordinate system is set to the bottom left FOR ALL objects. The rotation ...
0
votes
1answer
197 views

Mouse coordinate conversion Libgdx

I have a camera: //Map is a my object that wrapper of TiledMap class In the create method: this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap(); this.camera=new OrthographicCamera(); ...
1
vote
1answer
50 views

What kind of issues should I watch out for or avoid when using JOGL(OpenGL Java bindings)? [closed]

I am completely new to OpenGL, but have a very good basic foundation in Java. I've set up Eclipse with the most recent version of JOGL recently, having found it to be, of what I as a beginner ...
0
votes
1answer
148 views

How can I split my entity manager class into a gameworld class and gamerenderer class?

I currently have a libGDX game where I have an entity manager class which is called in the gamescreen. Instead, I would like to utilise it in a gameworld class and a gamerenderer class, but I cannot ...
1
vote
1answer
554 views

Multiple enemy array in LibGDX

I am trying to make a multiple enemy array, where every 30 secods a new bullet comes from a random point. And if the bullet is clicked it should disapear and a pop like an explosion should appear. And ...
0
votes
1answer
125 views

Slick2D: Animation not being parsed from spritesheet correctly

I have a 960x960 spritesheet with each tile being 192x192. I initialized my spritesheet and animation like so: spritesheet = new SpriteSheet("resources/spritesheets/player.png", 192, 192); ...
0
votes
1answer
54 views

Stop rendering hidden objects libgdx

I currently am hiding objects that are not in the frustums view. However, some objects are still being rendered that are in the frustums view, but are hidden. My goal is to not render objects that ...
0
votes
1answer
26 views

Processing through multiple shaders (LWJGL/Java/OpenGL)

Very simple question: Is it possible to process a vbo through different shaders? If so, how? What I want is sth like this: reflectionShader.bind(); //starts shader reflectionShader.load(some_values); ...
2
votes
1answer
24 views

LibGdx OpenGl prevent black part of Light mask texture from overlapping

I am using this masking texture for a dynamic lighting effect in my game: It looks beautiful until two lights begin to overlap: This is obviously because the textures are overlapping when I draw ...
1
vote
1answer
30 views

Scale smaller resolution to full resolution libGDX

Short question about the scaling in libGDX. At the moment i have a application with the resolution 480x320. I define this in the main method of the desktop launcher. My whole application is now ...
0
votes
2answers
4k views

How do I add an image inside a rectangle or a circle in JavaFX?

Suppose we have a rectangle called r Rectangle r = new Rectangle(40, 20); and an image called image Image image = new Image("...src for image"); How do I fit the image inside the rectangle? ...
0
votes
0answers
39 views

LWJGL 3 - Random Sprites Don't Blend

Some of my sprites don't "Blend" in with tiles behind them Z-wise. glEnable(GL_DEPTH_TEST); Depth testing is enabled and works. glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, ...
0
votes
1answer
334 views

Move Box2D body towards mouse click

In a top down game using Box2D, I would like the player's Box2D body to rotate towards the mouse click, and then move to a point on mouse click (move, not teleport). I have worked out the rotation ...
0
votes
1answer
119 views

LibGdx - How can I correctly handle tile transitions / connected textures?

So I am making a tiled game and I need to connect textures correctly based on whats next to it. With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ...
1
vote
1answer
70 views

Correct way to integrate scaled axis angular velocity into a quaternion

Across my travels on the internet I have came across to ways of integrating a scaled axis angular velocity into a quaternion. The first way converts the angular velocity into an axis angle quaternion ...
0
votes
2answers
333 views

Libgdx box2d crashing

im making a game in libgdx which i having a bunch of circle bodies floating around in space and when the player's body crashes into another body, that body deletes and creates two smaller bodies ...
1
vote
1answer
113 views

Laggy empty project at 60FPS

@Override public void create() { batch = new SpriteBatch(); img = new Texture("badlogic.jpg"); } @Override public void render() { Gdx.gl.glClearColor(0, 0, 0, 1); ...
0
votes
2answers
116 views

Gradual rotation of an object in Java

I'm using Java to learn some movement algorithm. I would like to implement the "wandering" algorithm, but in order to do it, i should understand how to rotate an Object gradually. Actually, my Player ...
0
votes
1answer
262 views

Grid collision - finding the location of an entity in each box

I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which ...
2
votes
1answer
43 views

Using USB sound input for an android game - is it possible?

We are brainstorming ideas for an app, for a major project using Android Studio, and writing in java. My major is game development, so I intend on trying to build a video game based off the use of an ...
0
votes
1answer
52 views

Java: How do I cycle through a BufferedImage array of images and display them?

So, I'm coming from Python and Pygame here, porting most of my code because I didn't like the performance. A lot of the syntax is similar, but I've been having some trouble with a few things, namely ...
1
vote
1answer
41 views

libgdx - Check if body is touch

I have some bodies around the screen(Ball[] balls), and I would like to delete them when user touches them. Also, I have an Image as userData of the bodies. I dont want to make a function to all ...
2
votes
1answer
57 views

Isometric 3D grid - what order do I render elements in the grid?

I'm trying to create a screensaver, so strictly speaking this isn't for developing a game, but the subjects discussed on this SE site are a better match than any of the other sites, and I think the ...
3
votes
0answers
69 views

How can I compress resources into a single file in Java?

Today I've finished my game, but there's a problem. There're more than 500+ images in my resources folder and I want to compress them into a single file, like other games do (for example put ...
1
vote
2answers
77 views

How to make sprite move in any direction?

I have an arrow sprite that rotates based on where my cursor is pointed, I can only make it move up,down,left and right.How about in a diagonal way? //this is the rotation nt x=Gdx.input.getX(); ...
0
votes
0answers
30 views

GLFW - Event Polling System

I need some help on design. I'm making an event polling system, where a window is notified of events as they happen. I handle events at a system level in my GLFW backend, by using callbacks. ...
1
vote
2answers
52 views

How can I add extensions to libGDX

I had a problem with my Font in a game I am developing in libGdx. After some googling I was instructed to use the following code: private void createFonts() { FileHandle fontFile = ...
2
votes
0answers
30 views

balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping?

I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push ...
1
vote
2answers
146 views

Libgdx: different speed on different devices

I am running a simple Libgdx app that I have wrote, on my Android phone and Android tablet and I am getting the unexpected result of having different velocities when a body is moved. To move the body ...
1
vote
1answer
37 views

How do I query a LibGDX Box2DLights “light” and “dark” regions?

I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered. How can I find which areas are lit or ...
1
vote
1answer
34 views

Scene2D: How to use Image.setDrawable()

I'm trying to change the texture of an Image actor on my Scene2D stage, however I can't seem to get it working. It seems like setDrawable() doesn't really do anything. For example, this will make ...
0
votes
1answer
38 views

android canvas rope swing

I'm creating the code, where a player swinging on a rope for the moment I got this double angle = Math.atan2(player_y - center_y, player_x - center_x) - Math.atan2(end_y - center_y, end_x - ...
0
votes
3answers
119 views

Procedural generation of stars in the background with given random seed

I want to generate stars (actually a 2d vector) in the background. The player is moving left and right endlessly. When the player moves the stars, which aren't in sight anymore, should be deleted from ...
0
votes
1answer
93 views

AI for Minesweeper like game

I am currently developing a Puzzle/RPG game which works a little bit like Minesweeper. You have a Field of Tiles and 2, 3 or 4 different colors from which you can choose. Now you have to uncover tiles ...
0
votes
1answer
48 views

glGenArrays - This functionality is not available

Whenever I call glGenVertexArrays(), I get the following exception: Exception in thread "main" java.lang.IllegalStateException: This functionality is not available. at ...
2
votes
1answer
76 views

(Minecraft) MoveHelper for custom entity not updating

I'm trying to create a shark mob for minecraft 1.8 (using Forge 1.8). Since it's a water mob, the movement functions need to be edited to allow it to path correctly in water. However, after ...
0
votes
1answer
64 views

Getting positions of static entities in a Tiled Map

I'm creating a 2D game that uses a Tiled Map with an underlying 2D array to store where entities are in the world. At the moment, I'm just creating one instance of an entity, assigning it a number, ...
0
votes
0answers
19 views

Java how to wrap text

Hello I have a game where you hack into computers(not real ones :P ). You can type the command ping and it pings to your address in real life. It returns something like this: Pinging 192.168.6.1 with ...
5
votes
2answers
5k views

Problem to match font size to the screen resolution in libgdx

I'm having problems to show text on my game at same size on different screens, and I did a simple test. This test consists to show a text fitting at the screen, I want the text has the same size ...
1
vote
2answers
74 views

How can check a collision between 2 non-axis aligned boxes?

I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return trueor false, no physics involved. I started working and couldn't find an algorithm that ...
0
votes
1answer
18 views

Triangle data structure not working for LoD algorithm

I would like to implement a LoD algorithm to my 3D game in order to simplify meshes at certain distances from the player. My meshes are created / loaded using a VBO, so the vertex data is stored in a ...
1
vote
1answer
46 views

How can I add a transparent overlay to a UI in libGDX?

I am attempting to use the following code shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); shapeRenderer.setColor(3,3,3,.3f); shapeRenderer.rect(0,0,gameWidth,gameHeight); ...
1
vote
1answer
26 views

LibGDX viewport touch coordinates transformation

I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me. I have a game window of 840x480 units with ...
7
votes
1answer
199 views

Tiling perlin noise seamlessly, but without repeating to generate an infinite 3D world

I have been working on a 3D game in java using LWJGL for a while now. I am trying to make procedurally generated infinite 3D terrain that is generated around the player. So far I have: 3D terrain ...
1
vote
0answers
65 views

Libgdx performance on old devices

I'm developing a game in Java for Android, using LibGDX. I'm using Nexus 5 to test my game most of the time and it works great (Minimum FPS it gets is 57 out of 60). Recently I ran my game in Galaxy ...
1
vote
4answers
63 views

OpenGL calls from a different thread?

I understand OpenGL is not thread-safe, but at the same time, Google seems to be giving me mixed responses. I have a LibGDX game that functions normally, UI/rendering/logic on the same thread, ...
0
votes
0answers
23 views

GLFW/LWJGL black screen flicker issue

Im having a problem with creating a borderless fullscreen window in LWJGL using GLFW. It creates the (in this case black - as intended) window, however when the focus changes (f.e. tabbing int/out), ...