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

2
votes
2answers
165 views

Android libGDX FreeTypeFontGenerator exception

I am working on a libGDX project for Android. Since I added the following code, running the game on my Android phone produces an exception: final FreeTypeFontGenerator generator = new ...
1
vote
0answers
56 views

Implement gpu based dynamic geometry lod with openGL

I'm currently working on my own game and for that I wanted to implement LOD, to boost the performance. I found a very nice tutorial on the internet: http://rastergrid.com/blog/2010/10/gpu-based-...
0
votes
1answer
60 views

How to apply Buoyant force to a Box2d body?

I have been following a formula to calculate the buoyant force needed to apply to a dynamic body to be able to simulate water. Fb = ρgV Fb - is the buoyant force ρ - density of the liquid g - ...
0
votes
1answer
377 views

problem adding bumpmap to textured gluSphere in JOGL

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in "res/planet/...
1
vote
1answer
115 views

LibGDX - How to export a texture as a .png onto, say, the desktop

I'm making a game in which I need to export a texture which the user has edited as a .png into a specified location. I'd like it if I could have the default saving window thing (like on other apps ...
1
vote
2answers
148 views

Getting the tile over wich the mouse cursor is

Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, ...
0
votes
0answers
24 views

Java - Issue colliding with more than one object

Ok, I am working on a simple 2D sidescroller game and having issues with the player (or any moving entity) colliding with another entity. My current method, (a box on north, south, east, and west to ...
2
votes
1answer
101 views

In JBox2d when dragging a Body, why is the direction is flipped vertically?

Why is it when I drag a JBox2d Body with the mouse, the vertical component is flipped? e.g. If I drag down-right, the Body moves up-right. Is this expected behaviour, a bug in JBox2D, a Mac ...
1
vote
0answers
30 views

Different Box2D bodies act differently and unexpectedly with same mass

I have a box2d body which is simply a rectangle (the spaceship). This ship flies around, affected by the gravity of planets (static circle bodies) just fine. I have tried changing the ship fixture ...
0
votes
1answer
150 views

Moving a Polygon based on Camera position

I am in the process of implementing TMX Maps (made in Tiled) for my game. In Tiled, I can create polygons, which leaves a tag, containing the points. Loading in these points to a Polygon (java.awt....
1
vote
2answers
411 views

LWJGL: Camera distance from image plane?

Let me paste some code before I ask the question... public static void createWindow(int[] args) { try { Display.setFullscreen(false); DisplayMode d[] = Display....
1
vote
1answer
71 views

When handling key input, I'm getting a negative timeout value in my thread. What's going on?

So I'm programming a game using Swing and AWT and I'm getting a weird error. As I check for input in my MenuState, which is just my Menu screen, it is telling me that the timeout value in my game loop....
1
vote
1answer
59 views

Problems managing collision filtering

I have my character fixture and body(is a tank), so when I press the screen it throws a rocket(which also has a body and a fixture) that the player can controlll touching the screen. My game also has ...
0
votes
1answer
142 views

Creating puzzle on libGDX

Good afternoon. Help me please to add the code for the game. This game is puzzle. Everything works good, but I would like to have not just ordinary puzzles with numbers, but also the puzzle with a ...
0
votes
1answer
46 views

keylistener and synchronization

i have this code: public final class PlayerInput implements KeyboardInputHandler{ public static final int INVERTED_AXIS = 0; public static final int NORMAL_AXIS = 1; private Sprite sprite; private ...
1
vote
1answer
40 views

Libgdx black rectangles problem

I'm working on a game for Android using Android Studio with LibGDX in Java. I recently found a weird problem when closing and reopening the game. When I first open the game, it works fine. If I click ...
3
votes
0answers
141 views

How to bundle JRE with game for Steam for Mac users?

Heyo! I have looked for a step by step tutorial everywhere and haven't been able to find anything so please be helpful and fairly slow. I am creating a game for Steam and I am using Java to write it....
1
vote
1answer
113 views

How to create 2D cameras in swing?

What is the best way to create a camera for a 2D platformer using swing, and I want to create a camera that moves instead of moving the background. This is because I'm going to have objects rotated by ...
1
vote
1answer
203 views

Java Reversi/Othello - Checking if Valid move

I've written a gameBoard class for a Reversi/Othello which is the following: import java.io.Serializable; public class GameBoard implements Serializable { private static final long ...
1
vote
1answer
49 views

Basic Animation Concept - Stuttering Sprites (Java)

The Problem I have some sprites animating across my screen (some spaceships). I alter their X coordinates (like -5, for animation) in my game loop. I want the animation to happen faster, however ...
1
vote
1answer
129 views

How to detect if two sprites are being touched at the same time?

I tried this: if(spr.getBoundingRectangles.contain(x,y)){ //do this } but how to detect if the other sprite is touched by the second pointer? Then I created two Vector3 for the pointer ...
1
vote
0answers
107 views

How to correctly implement 'layered lighting' with Box2D-Lights

How does one only allow Box2D-Lights to affect one and only one OrthographicCamera. After researching, I found the following answer. This answer goes into detail about how to prevent one camera from ...
0
votes
1answer
17 views

LWJGL version problems

Is it possible to create VAO's while my computer doesn't support openGL 3.0 or higher? I managed to create a vertex buffer object and draw a rectangle. But then I changed my lwjgl libraries to the ...
1
vote
2answers
92 views

Render terrains depending of the player position (Chunks)

Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered. The problem is ...
0
votes
1answer
20 views

How to change the way LibGDX scales images?

I'm using FillViewport and OrthographicCamera. LibGDX is scaling my images rather badly - jagged edges, visible pixels. How can I change the scaling method? by the way, I'm pretty sure the issue isn'...
1
vote
1answer
866 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 ...
1
vote
1answer
26 views

LIBGDX font.draw() makes letters blink on PC

I load Bitmapfont then try to draw it, but on PC(desktop) build screen blinks with frequecy that I can judge that backbuffer is not drawn. On Android all is fine, I don't see blinking. I simply do ...
0
votes
1answer
144 views

Is the standard collision detection in Slick2D too heavy for broadphase?

I was wondering two things about the built in shape detection of Slick2D. When executed on a lot of shapes, how performant are the intersects and containsmethods, and what kind of algorithm is behind ...
0
votes
1answer
195 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. private Vector2 position; private Vector2 velocity; private ...
0
votes
2answers
162 views

2D Platformer: add ability to jump on top of other character

I want to add ability to jump onto a head of other character/player, but still be able to go through them horizontally. There is one useful tutorial about one-way platforms, but that approach doesn't ...
35
votes
5answers
8k views

How can I give the illusion of height to a ball in 2D?

In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below: How can I achieve this?
1
vote
2answers
1k views

keyPressed is not working after adding ActionListener to JButton

I have a serious problem while trying to build a menu for my game. I've added two JButton to a main JPanel and added an ActionListener for each of them. The main JPanel also contains the game JPanel ...
0
votes
0answers
7 views

Should I boost run task via disabling TexturePacker?

I decided to create textures with keeping in mind that the largest screen resolution that my game will be working with is 1920x1080. So, menu background texture in my game will be always 1920x1080. ...
0
votes
0answers
30 views

Java .dae file loader problem

I am making a COLLADA parser in Java, and I have made a loader that reads a .dae file, and saves it's content in a string. But, when I load a specific file, it doesn't get read correctly. Specifically ...
2
votes
2answers
820 views

LibGDX - Rendering things in different classes

thanks for your time! I'm really new to LibGDX (and Java itself). Which approach should I use to render my different game parts? I want to show a background, the main character, a bunch of enemies ...
0
votes
2answers
304 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
votes
1answer
186 views

Java - LWJGL OBJ Loader with Materials not rendering

So I successfully loading my obj file but I obviously want to get materials on it. I added the vt(texture) to the OBJLoader and the Model.render but still rendering textureless. I have exported the ...
0
votes
1answer
88 views

How do you create a camera with target-focus behavior in Java?

After making some progress in my game, I was looking around for camera scrolling methods to use for my TDS game and found one that I thought would work well for it. This is an example of what sort of ...
0
votes
1answer
103 views

Map coordinates to camera coordinates

I have a tiled map which is 3 times higher than camera. When I press on a tile, I want an actor on that tile to show up. This works if camera is not moved. If I move camera a little bit up, so the ...
4
votes
2answers
354 views

Smooth 1D terrain generation

So I'm pretty happy with my terrain, and the progress on my game. I just want to figure out why the terrain is so steep sometimes. Right now to generate my random seed I use this: seed = (long)(Math....
0
votes
1answer
26 views

Sprite update issue

I'm currently implementing Box2D with LIBGdx and i'm having issue on update, as you can see on this video : https://www.youtube.com/watch?v=D3Nph6yftTQ whenever my player move or the camera move the ...
1
vote
2answers
257 views

Accelerometer problems

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 Scroller on the x-Axis though stops. ...
0
votes
1answer
198 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 ...
0
votes
1answer
31 views

How do I know if the ad is open while the use pressed the back button?

I am trying to reward a user a point whenever they watch/look at an ad. I give the user the reward whenever they watch the ad. However, the user earns a point even if they go to the ad and click back: ...
0
votes
1answer
249 views

Datastructure for infinite 2D map [duplicate]

I started a 2D Tilegame programmed with libgdx which needs potentially infinite tiles. That means when the player arrives the border of the map it should be possible to generate even more tiles. So a ...
1
vote
1answer
451 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 ...
1
vote
1answer
140 views

How to map texture to shape in Slick 2D

I need to map texture to shape. Texture: This is a example of shapes I need to map texture to: Notice that each piece in mesh has exactly 4 point to map texture. Logic is pretty straight forward:...
0
votes
1answer
39 views

Batching in Java (software rendering)

I've watched some tutorials on java game development and when they start using spritesheets all they do is get a subimage out of the spritesheet and create a new BufferedImage out of that. Does java ...
1
vote
0answers
17 views

Transposition Table/Alpha-Beta Implementation

I got the following problem. I have implemented transposition tables, which seem to work well or at least I can not see they are not working. Additionally, I wanted to implement some move-ordering. ...
1
vote
1answer
64 views

2D BoundingBox Collision Detection Problem

I implemented collision detection into my game (using Bounding Boxes) The character is floating above the blocks instead of standing on them. I know what is happening, but I can't figure out how to ...