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

BOX2D games slow down after adding some bodies [on hold]

My practice game is working fine. But when I add bodies in the game (multiple times), game tends to slow down. As it gradually starts to see in slow motion. I am using below method to add bodies in ...
1
vote
1answer
26 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
35 views

Java - How to implement Graphics into a JFrame [on hold]

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
13 views

Java slick 2D error update

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
18 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
5 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
52 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
7 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
27 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
43 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
45 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
52 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
46 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
17 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?
-4
votes
0answers
46 views

Help with a game mechanic! [closed]

I need help with a game mechanic. How would I do this; when the player starts clicking/tapping, time starts to pass , when he stops tapping its game over.
2
votes
0answers
36 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
24 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
22 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
18 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
52 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
38 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 ...
0
votes
2answers
37 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
103 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
43 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
37 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
61 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
24 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
37 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
22 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
111 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
42 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 ...
2
votes
0answers
61 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 ...
2
votes
1answer
56 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 ...
0
votes
1answer
47 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
2answers
76 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(); ...
2
votes
3answers
212 views

2D - Smooth lighting with shadows for a tile-based game

for the last week or so I have been completely stuck on trying to implement efficient lighting. I've been researching and experimenting and I've looked everywhere that I have been capable of finding, ...
0
votes
0answers
24 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
49 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 = ...
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 - ...
1
vote
1answer
32 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 ...