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
0answers
14 views

Crash when setting a new screen

In my almost finished game I want to set a new screen on game over. I got my game over method: private void gameOver(Label score) { for (Body body : worldBodies) { ...
0
votes
0answers
12 views

Java (libGDX) - Inheritance problems

I'm having some issues with inheritance for one of my libGDX projects, I'm making a game similar to (very stripped down) Terraria or Starbound and I am using the TiledMap to load the world, ...
0
votes
0answers
28 views

Can anyone recommend a 24.8 or 32.32 fixed point library for java? [on hold]

As the title says - I can't seem to find any working implementations. I need it for a cross platform game where I need floating point calcs to be deterministic. I can't use strictfp etc. Thanks
4
votes
2answers
128 views

Could someone help me understand this game loop logic?

I'm learning Java game development and trying to dissect this game loop: // Game loop final int TICKS_PER_SECOND = 60; final int SKIP_TICKS = 1000 / TICKS_PER_SECOND; final int ...
0
votes
0answers
14 views

How to create a splash screen in open GL 2.0 for Android? [on hold]

I am kind new to android and opengl. i am trying to create splash screen for my game using opengl.
2
votes
2answers
93 views

Best 2d AI movement system

I'm creating a top-down rpg (no tile-based) using libgdx. Now I need to make enemies move on map with obstacles. What is the best approach to realize that? A*(I think, if enemy see player, he should ...
0
votes
1answer
28 views

dynamic body jumping out of water object

In my game I have my main object, a jetski, which will dive down into water, when the screen is touched. I managed to code the jetski diving down, with Box2d and some buoyancy forces. But when the ...
-1
votes
0answers
12 views

added more characters on the same map Tile with slick2d [on hold]

i have one problem, i don't know how to add more characters on the same map. I tried this but don't work. PS:I want to add enemy import org.newdawn.slick.GameContainer; import ...
1
vote
2answers
17 views

applyForce as long as display is pressed

In my project I have my main character body. I want it to move down on the y-axis as long as the screen is pressed. I tried it with public boolean touchUp(int screenX, int screenY, int pointer, int ...
0
votes
0answers
22 views

BOX2D games slow down after adding some bodies [closed]

My practice game is working fine. But when I add bodies in the game (multiple times using a loop) lets say 20 bodies at a single touch, game tends to slow down. As it gradually starts to see in slow ...
1
vote
1answer
30 views

libGDX fileHandle cannot readString()

I have created a text file called "useraccounts.txt". All I want to do is to read the file using the filehandle class but I always get this exception: Exception in thread "LWJGL Application" ...
1
vote
1answer
62 views

A* Path Finding Loops Forever

For, hours, I've been following these instructions. public PathFinder(IntegralLocation loc, final int dest_x, final int dest_y) { boolean found = false; final List<Node> open = new ...
-2
votes
0answers
39 views

Java - How to implement Graphics into a JFrame [closed]

Currently I have a class in Java in which I have a JFrame setup. I want to be able to implement Graphics onto the JFrame. How do I do this? My Code as of so far: package com.graphics; import ...
-1
votes
0answers
18 views

Java slick 2D error update [on hold]

i have an error in java game slick when i try to use sprites : Game.update() failure - check the game code. This is my code: import org.newdawn.slick.Animation; import org.newdawn.slick.BasicGame; ...
1
vote
0answers
24 views

Vbo 3d triangle opengl w/ LWJGL

So i am using lwjgl, took me about 4 hours of hard work to achieve triangle rendering and vbos, now i want to render a triangle in 3d space. I know you have to use projection matrices. But when i have ...
0
votes
0answers
7 views

Slick2d - How to change one pixel color with another from Image?

How would I replace one color throughout an entire image with another color in runtime? For example, replacing all red with green from an image. The only way I can think of is to loop through each ...
0
votes
0answers
18 views

Trouble texturing isometric tiles with tilesheet: OpenGL

I don't know if I am just... not seeing something here. I have been working on this for quite some time trying to get it functioning. I have used sprite sheets and texture coordinates before - so I am ...
1
vote
1answer
56 views

Greedy Mesh generation for a voxel-based game

EDIT: I have already found my problem and fixed it (but I cant accept my own answer for another 2 days) I'm currently making a 3D voxel-based game and now that I have started optimising some aspects ...
0
votes
0answers
20 views

Slick2D Java Applet

I created small game in Java using Slick2d library. I wanted put my game into webpage as java applet like here. I added my site to java exception site list. When i try to run page it is wrote: "An ...
0
votes
0answers
10 views

Using AWT with LWJGL on OS X

The VM argument -XstartOnFirstThread is required for LWJGL to work on OS X. Anything in the java.awt package freezes the JVM when used with the VM argument -XstartOnFirstThread. E.g. ...
1
vote
0answers
30 views

convert mouse coords to zig-zag isometric

I was wondering, how do I convert mouse coordinates to zig-zag isometric coordinates? I already know how to convert to isometric using the Diamond approach, so I just need to know about the zig-zag ...
0
votes
1answer
44 views

Rectangle moves faster to the left than to the right

I am using Slick2d to create a top-down game, however an rectangle than I am drawing to the display is moving faster to the left than to the right, and faster up than down. I am updating frames like ...
1
vote
3answers
50 views

OpenGL, GLSL, Modify Background Fill via Fragment Shader

I have noticed that fragments rendered by the glClearColor() method do not pass through shaders. However, I'd like to modify these fragments using my fragment shader. Is there any way of forcing them ...
1
vote
1answer
55 views

How do you know when you are ready for game programming? [closed]

I've been programming for a while now and I want to make games or game engines. But I don't really know how much of programming one does need to learn to have the proper knowledge to make games. My ...
0
votes
1answer
48 views

How to achieve a for loop without Unity crashing?

I want to make a for statement that repeats constantly until a stop variable becomes "1". But wherever you type a "for" statement in any way or even without anything in the statement, Unity just ...
1
vote
1answer
17 views

Can't give my pictures the right location in libGDX

I have this code here sb.draw(title, (PPlane.WIDTH / 2) - (title.getWidth() / 2), (float) (PPlane.HEIGHT / 10)); sb.draw(playBtn, (PPlane.WIDTH / 2) - (playBtn.getWidth() / 2), PPlane.HEIGHT / 2); ...
0
votes
1answer
18 views

How to check if an GameObject exists in Unity2D? (Javascript)

Im making an AI that checks if the player exists or not. How do I check if a certain object exists and put it in a boolean variable?
2
votes
0answers
41 views

Dialog/event system in Java/libGDX

I hope that I'm posting this correctly as I'm new to the site, feel free to correct me if I'm in the wrong spot. As for my issue: I'm working on an 2D side-scrolling platformer game in libGDX, and ...
1
vote
1answer
25 views

How to draw a BitmapFont every user click

Im starting learning the libgdx framework and I want to "clone" some games. I know how to handle touch with if(Gdx.input.isTouched()) But how do I render new fonts every time user clicks on the ...
1
vote
1answer
24 views

LWJGL not streching texture to quad

I'm having problems with texturing in LWJGL. The texture is not being stretched to a quad. As you can see, the texture is not being sized to the quad, marked with pink border. The problem doesn't ...
0
votes
0answers
19 views

libgdx html part in browser only shows libgdx logo

I am trying to run HTML part of libgdx. I followed its official guide https://github.com/libgdx/libgdx/wiki/Project-setup,-running-&-debugging I have installed GWT plugin, I did GWT compile and ...
1
vote
1answer
55 views

Box2d jetski on water

At the moment I am trying to code a 2d game in java, where a jetski is riding on water. If you press on the screen the jetski should dive down and jump back up on release. How do I have to do this in ...
0
votes
1answer
52 views

Inventory system does not behave correctly

I have a game with an inventory, you can pick up items by walking on them. When you walk on an item and if it isn't already in your inventory it is added to the next free slot. If it is already in ...
0
votes
0answers
51 views

How to make a free game popular? [duplicate]

I am developing a free online knowledge based game in Java, it's currently in early stage of development (alpha) and I would like to gather some players (community) and develop the game by player ...
1
vote
1answer
41 views

Linking maps in Java game

In my Java game, I've got a number of randomly-generated maps made of tiles. I'm struggling with writing the code to handle the entering/exiting of the maps. Originally, I only had Ascend and ...
1
vote
0answers
48 views

Setting Window Icon Using GLFW (LWJGL 3)

What's the best, cross platform, way of setting the window icon using LWJGL 3? I have a PNG image and would like to set it to the icon present in my dock (OS X) or the application bar (Linux).
0
votes
3answers
105 views

Java game Inventory problem

I have a game where you walk around picking up items. They are supposed to go into the next empty slot in your inventory, but when I pick up an item all the empty inventory spots get filled with it. ...
-1
votes
2answers
45 views

Removing default badlogic from desktop launcher [closed]

I'm making a game in java/libgdx. when I run the code in the desktop launcher it gives me a bunch of errors. All the errors are from the badlogic default package. My code: package ...
0
votes
1answer
38 views

Java Game How to change opacity of an image?

Hello I have a game where you feed animals. A few minutes after you feed them they do a poo. I want the poo to fade away after a few seconds. I want to know how to change the opacity on the image. How ...
1
vote
3answers
72 views

Collision response and delta-time problems

I'm working on a 2d top-down shooter game. At the time, I am trying to get the movement and collision right, but I have a few problems with this. First of all, I am making my game frame independent ...
0
votes
2answers
63 views

Libgdx coordinate system

I just started with libgdx and I'm still figuring out how the coordinate system work.The code below would draw the image at [0,0] without the Orthographic camera What I can't understand is why the ...
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
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); ...
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, ...
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
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); ...
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
25 views

JAVA: Unformed Sprite When trying to Read SpriteSheet

So Im a beginner experimenting with ImageIO. Can someone tell me why im getting this pixelated-incomplete sprite? Here's the code public BufferedImage getImage(String location) { try { ...
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 ...
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 ...