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

1
vote
1answer
41 views

Libgdx - How to change GestureListener pan finger sensibility?

I implemented GestureListener in my Overlap2dStage to pan the camera when the player drags its finger over the screen. But I also have some actors that extend InputAdapter to detect when the user ...
-2
votes
2answers
97 views

Minesweeper number placement [closed]

My professor gave us a project: make a minesweeper clone. However, he said that he will give bonus points for the 3 fastest algorithms for board generation. I'm currently doing the algorithm that ...
1
vote
1answer
70 views

(Java) Trying to animate an arraylist of coins with a (working) animation class

I have a coin class which takes in an integer numOfCoinsand an enum LayoutType, which can be linear or curved. A linear layout displays the coins in a straight line one after the other - we'll work ...
1
vote
0answers
84 views

Using Box2D in LibGDX, is there a reason a fixture set to be a sensor would only -sometimes- detect a collision?

I am working on a 2D game in LibGDX. Currently, I am testing interactions between a player's weapon and enemies - in particular, a sword and an enemy monster. The player has a hurtbox and the sword ...
1
vote
1answer
186 views

How do I reverse this function?

I'm working on an isometric tile rendering engine and I need to reverse a function I used to translate the Cartesian coordinates into isometric coordinates. I've already written a function for this, ...
0
votes
1answer
133 views

Java Game How to find the x and y for a tile?

Hello I have a java game where you build houses I want to be able to dag my mouse form point a to point b and I want to fill that area with tiles when I release the mouse. What I cant do is get the ...
0
votes
0answers
73 views

Trouble with Raycast Selection using OpenGL

I am currently having trouble with a custom model editor in which I want to implement model selection (eventually featuring face selection to have something like "click-and-drag" to extend the cubes). ...
0
votes
0answers
76 views

Java Slick2D rotating a Shape using transform(Transform.createRotateTransform())

I have spent most of the day trying to debug this tiny piece of code, and I can't for the life of me figure it out. I'm making a pong game for the Mini Ludum Dare currently going on. I am programming ...
0
votes
1answer
82 views

LibGdx Table not firing touch events

I can easily add listeners to the actors within a table, and they will fire events, but if I want an entire to table to have 1 listener and do not care to have differentiated effects depending on ...
0
votes
0answers
13 views

Java how to fill a selected area with tiles [duplicate]

Hello this is my last try at asking this question because my other ones weren't great. I have a game where you build space ships. You can drag the mouse from one point to another and it will draw a ...
2
votes
0answers
50 views

OpenGL enabled Java game not detected by Fraps

Recently I found out that I could enable OpenGL hardware acceleration in my java game with the line System.setProperty("sun.java2d.opengl", "True"); Initial tests showed a big boost in performance. ...
0
votes
0answers
68 views

Dijkstra Pathfinding in Libgdx, some minor problems

I'm having some problems with my Dijkstra implementation in Libgdx. I understand that there are already AI libraries that can probably do this much simplier but this is a school assignment so i'm ...
-1
votes
1answer
121 views

What is the difference between .obj files and Collada files? [closed]

I am currently making a game in java using LWJGL 2.9 and I am wondering what the difference between the .obj format and .dae format is. Currently I can load .obj files and would like to load .dae ...
0
votes
0answers
14 views

get the closest points [duplicate]

Let's say I have a bunch of points: What is the best way to get a certain amount of closest neighbors. For example I wan't the 8 closest points for point no 57. This without using brute force. O ...
0
votes
1answer
212 views

JNI multidimensional array as return value

I have some C++ code that I wrote to generate voxel terrain and would like to access it in JAVA. you pass it three integers; the seed and the coordinates of the chunk that it is generating ...
0
votes
0answers
16 views

Stack matrix affecting shooting mechanics

I attempted to make a scroller game using parallax scrolling in LWJGL. Everything is fine but I'm having trouble with the matrix stack and the bullets. So basically when I shoot the bullet it moves ...
1
vote
1answer
49 views

OrthographicCamera and viewport not giving expected effect

I recently asked a question about this area that I think was too broad, so I will try a new approach. I have the following code I am experimenting with: batch = new SpriteBatch(); ...
0
votes
1answer
67 views

How can I split up a large model into an octree codewise?

For collision detection, I am attempting to split up a large model into an octree. If we take this black thing thing to be the ship (104,000 vertices): Then I would like to split up the faces I ...
0
votes
0answers
32 views

Can't perform normal jump after applying revolute joint

I have encountered the following problem: I have two PolygonShapes which I had connected with a RevoluteJoint. The first body is called square the second is called weapon, before connecting the two ...
0
votes
0answers
52 views

How do I make a Slick2D TextArea display newlines?

Whenever I press the Enter-key my Slick2D TextArea does not go to the next line. How can I make it do that? Here is the code that involves the TextArea: private TextField ta; public void ...
0
votes
0answers
26 views

LWJGL: getDisplayModes() on Linux with two monitors

When calling getDisplayModes() on a Linux machine with two monitors I only get one single resolution, that is, the current resolution set on the main monitor. However, calling xrandr directly gives me ...
0
votes
0answers
41 views

How to use Android Sensor, only in x axis

I have seen some tutorials but they are very complicated and they are about the three axes (x,y,z). So I want a code that moves an object or more (for example) to the right or the left when the ...
0
votes
1answer
54 views

java Move vehicle towards the mouse

Hello I have a game like asteroids and I have my ship on the screen and he points towards the mouse. I want to know how to move towards the mouse so if I press w I will drive towards the mouse and if ...
0
votes
0answers
8 views

Find fastest rotation left or right to face an object [duplicate]

im working on a competition where i am creating an AI for a game that the host has published and made for this event, i have two commands for turning my car and that is left and right, spinning on the ...
-1
votes
2answers
60 views

How to make a proper cache on user computer?

Currently when launching the client of the game, it connects to the server and loads all the cachedata in a normal form (= folders, .txt files and .png files). However I don't like that the players ...
1
vote
2answers
162 views

LibGdx - Move sprite in the direction of other sprite

I'm kind new to LibGdx and I'm still learning. I'm working on a small game project to learn this nice framework. However, I'm having some issues with my game. My game is a top down shooter. There is a ...
0
votes
0answers
25 views

Libgdx. Sprite won't stop moving;

I can't stop a sprite from moving. Here's my code: boolean moving; Gdx.input.setInputProcessor(new Input(){ public boolean touchDown(int screenX, int screenY, int pointer, int ...
1
vote
1answer
138 views

How do I make my main character move towards an object? LibGDX/Java

What I want to happen is for my player to bounce from spring to another. For example take the illustration below: Here's my code (what I've tried to do so far). This gets called in an ...
1
vote
0answers
139 views

Libgdx simple movement with velocity [closed]

Ok so this is driving me nuts. I've followed 3 tutorials now and I'm trying to get simple velocity to work and it just doesn't want to work for me. I have an open space and I want the character to be ...
1
vote
1answer
138 views

LibGDX Android Application only running once

I'm having trouble trying to figure out why my LibGDX game only runs successfully once on Android. Assuming the game has not been installed on the device, when I run the application from eclipse the ...
0
votes
0answers
100 views

Images not scaling properly in LibGDX when using “batch.setProjectionMatrix(camera.combined);”

I am trying to put Assets into my game but when i put in the line of code "batch.setProjectionMatrix(camera.combined);", which from my knowledge scales the Asset to the size of the window it appears ...
1
vote
1answer
54 views

LibGDX/Java - Trying to find the vector from one object to another

I want to add springs in my game that work like the ones in sonic - i.e. if you can't get over an obstacle you have to hit a spring which sends the main character flying towards another spring that ...
1
vote
2answers
144 views

How to build an AIManager class

I'm trying to figure out how to write a good AIManager class in Java in order to manage the AI of all the objects in my game. From another post of mine, an user has suggested to do the following: ...
0
votes
2answers
187 views

LibGDX - Best way of scrolling background

I'm new to LibGDX and i'm trying to implement a screen where i have a guy running and the ground under him scrolling to give impression he is really running in a sidewalk for example. The ground ...
0
votes
1answer
108 views

How can I store tile maps as PNG images?

I want to let players of my top-down game save, load and share worlds as PNG images. How do I read the colors in a PNG file or change them? I imagine something like this: BufferedImage mapImg = ...
1
vote
2answers
143 views

Help with Resolving Pixel Perfect Collision

Hi I'm having trouble resolving "Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain on a Worms type game". (Read previous question to find more information about ...
0
votes
2answers
77 views

Delay in bullets

I made my character shoot but the amount of bullets he shoots is way too much. I'm trying to add a delay between bullets. I've tried this: int shootTime = System.currentTimeMllis(); public void ...
0
votes
2answers
98 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 ...
-1
votes
1answer
50 views

Sprite movement only works the first time, can't figure out why [closed]

In my libGDX game I have finally managed to get the sprite to move the way I want him to but for some reason my desired outcome only works the first time I run the code. If I try to run it again, he ...
0
votes
1answer
70 views

How does one write a wrapper for a game server? [closed]

From what I gathered, wrappers mimic the game server in question, receiving packets from client and sending them to the server (and vice versa). It acts like a bridge between the client and server, ...
0
votes
3answers
211 views

Where the physics should be put

I'm studying a book of artificial intelligence applied to games. It shows several algorithms for each argument (movements, path finding.. ecc). Unfortunately (but obviously) it does not explains how ...
1
vote
2answers
251 views

Are shaders the only way to implement 2d lighting?

I'm working on a 2d top down game with libgdx and I think i got the basics. No want I want to implement lighting, I don't know anything about lighting. I want just to have some light sources and ...
0
votes
0answers
39 views

Box2D replace Fixture not working as expected

I am using box2D to develop a simple game, and I am using the Physics body editor by Aurelien Ribon to load the fixtures into bodies. I have written the following method which should scale my ...
1
vote
2answers
113 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 ...
2
votes
4answers
196 views

How can I avoid sending the full game state so often?

I'm making a real-time 2D MMORPG in Java. Currently data all surrounding NPCs' and players' data is sent so frequently that the client crashes—it can't handle the data quickly enough. I'm sending data ...
1
vote
2answers
178 views

Breakout Collision Detection: Ball gets trapped inside block

I'm writing a breakout clone where blocks to hit can be of various sizes and the projectile can move at different speeds, and I seem to be having some trouble getting the collision detection perfectly ...
0
votes
1answer
114 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 ...
0
votes
0answers
135 views

save and view snapshot image from android device

I'm having a problem with saving image into an android device this is what i did My java class : package com.test.app; import com.unity3d.player.UnityPlayerActivity; import android.os.Bundle; ...
0
votes
0answers
36 views

Partitioning a Tiled map

In my 2d platformer with libGdx, my maps are quite large (eg. 200x200). The player character is only 2 tiles high. I use Box2d for collision, so in my tiled map I have layers for terrain, ...
0
votes
1answer
101 views

How to resolse collision between moving and static AABB?

What I have is a map represented as list of Rectangles and player's rectangle. Also I have function to determine depth of the collision: Point TestAABBAABB(Rectangle a, Rectangle b) { ...