Java is both a popular 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
26 views

Pausing an animation in Libgdx

How would I pause an Animation from the LibGdx animation class? I've followed tutorials that teach me how to animate a sprite sheet but none to pause it. I'm trying to make an animation play once ...
0
votes
0answers
25 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
116 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
66 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
0answers
29 views

Architecture vs Performance [Java; Android game] [on hold]

I'm make a sandbox game on Android and can't decide how best way. Has is a significant difference in the performance in Example 2? ~800 tiles drawing on screen 60 times per second. Example 1 (6400 ...
-1
votes
0answers
27 views

Can't figure out why my sprite isn't moving

In my libGDX game I'm trying to make it so that the player character moves left and right depending on which side of the screen you press. However, when I run my code, I keep getting a null pointer ...
0
votes
0answers
37 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
16 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
27 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
0answers
52 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) { ...
2
votes
1answer
23 views

Collision detection between axis-aligned bounding box and bitmap (pixel perfect) terrain

Working on a Worms-type game, I have my objects in bounding boxes and they sit on the pixel terrain. Currently I am able to successfully do the collision detection for objects when they enter the ...
1
vote
0answers
60 views

How to make a sword swing effect

I'm working on a 2d java game on Slick engine and I always wondered how to make swing effects when striking with a sword? How to code something like this? ...
0
votes
0answers
30 views

Simulate juggling : how throw and grab objects with JBOX2D

There is an object which simulates a ball and another which simulates a hand (square).I want to be able to catch the ball and throw it with a projection force with the hand on JBOX2D. Any sample code ...
-1
votes
1answer
49 views

How can I implement input handling into my game?

I'm making a libgdx game where the player dodges falling objects. To move the player I have it set so that on desktop he moves left and right when you press A and D respectively. I am trying to ...
-1
votes
0answers
37 views

What should i use to develop multiplayer game online in browser on Java? [closed]

I'd like to develop a video game as a part of a learning process. I study JAVA. Previously I made one using Java applet. Somehow it works only on linux if you have installed IceTea Plugin and won't ...
0
votes
1answer
46 views

How to get used Resources by State/Map etc?

I'm now managing the Loading of my Resources and I got a Question in my mind. How does my Resource Manager know which Sprites,Sounds, etc. are used by the Map I want to load? First I thought of files ...
0
votes
0answers
66 views

3D Game Rendering (Educational purposes) [closed]

I've been programming off and on for a few years, and have made several 2d games in java. (I also know c# and a bit of c++). I was wondering where I should start off for rendering 3D scenes in java ...
0
votes
2answers
71 views

Basic 2d platform collision detection algorithm has a slight bug (Java)

I'm trying to implement collision detection between Player (the main character) and a Platform. They are both modelled as rectangles; when player hits the side of a platform he should bounce off it ...
2
votes
1answer
147 views

What version of OpenGL should I target for Steam?

I'm planning on developing a game (targeting towards PC and Linux) and putting it up on Steam in the future but I am not sure of what version of OpenGL to target so that the majority of steam users ...
0
votes
1answer
24 views

How can I render a simple lattice in LibGDX?

I have searched all over, but I can't find what I think will be a simple answer. I am using Opengl ES 2.0, and LibGDX. I simply want to use GL_LINES primitives to create a lattice structure. I have ...
0
votes
0answers
53 views

Steering problem in 2d game

I am creating a little 2D non tiled top down game. The enemy uses steering behaviour for chasing player or wandering around, but I do not think my code is working as it should be. My problem is, the ...
0
votes
0answers
28 views

how to make a game object increase/decrease speed each time it touches the x and y edges

i am trying to make an object to invert its speed (increase/decrease) each time it touches the edge of the screen on either the x or y axis with javafx. public void Strategy(){ if ...
0
votes
0answers
28 views

Is there a way to capture back button twice in same activity libgdx game

Can anybody tell me if there is a possibility to capture back button twice in same activity in libgdx. What i want to achieve is that if the user press back button once the game pause. if in the ...
0
votes
1answer
39 views

Animation fails due to a NullPointerException which I'm certain shouldn't be thrown (LibGDX / Java)

What the title says basically. I've been stuck on this error for a few hours I got it to work earlier but I honestly can't see why its failing now (ctrl + z'd back to the working stage). Here's my ...
0
votes
1answer
47 views

Update Loop in libGDX

I have a screen class in libGDX. In this screen, I want to change a sprite's texture a certain number of times before the screen changes to a different screen class. I tried having a for loop in the ...
-2
votes
1answer
35 views

How can I format the number of digits my stopwatch shows? [closed]

I have made a stopwatch that displays the time in seconds during my game in libgdx. At the moment it shows a bunch of digits after the decimal point as it runs. Does anyone know how to change it so it ...
1
vote
0answers
52 views

LibGDX scene2d good practices

I'm developing a game using LibGDX and in a part it has a pretty complex UI for profile selection and stuff. I have some general problems. I'd like to know good practices when generate good looking ...
0
votes
1answer
78 views

How do I efficiently deal with entities moving between chunks?

I am working on a game in which entities need to be stored in chunks. This is the basic chunk format: public static Entity [row][column][entities] chunkEntities; However, some of my entities move. ...
0
votes
1answer
87 views

FBO and VBO for performance

I discovered VBO's recently and changed my code to use them instead of immediate mode. Now I'm rendering 25000 squares and it's really slowing down my FPS. If I drew all the squares VBO's to an FBO, ...
0
votes
0answers
51 views

Cross component communication -Java

I am making my first simple game engine and decided to go with a ECS (Entity component system) from inspiration from Unity. I spent quite awhile online trying to figure out how to implement it. I ...
0
votes
1answer
38 views

Dragging an object and moving it back to it's original position on release?

I'm making a small game, and I'm trying to add this mechanic where if you click on an object and move it, then you release the object it will snap back to it's original position. Currently, each ...
0
votes
1answer
32 views

Rotate heading relative to agent's local space

I'm having a little trouble translating a point in my game's world space to an object's local space. I have a cannon in my game with a normalized heading vector that's always supposed to point in the ...
-1
votes
0answers
38 views

Problems with cube bouncing off walls [on hold]

I've been making a game for some time and I need help with the bouncing off walls and players. public class Ball extends Entity { private final int WIDTH = 8; private final int HEIGHT = 8; ...
0
votes
1answer
53 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 ...
3
votes
1answer
85 views

Texture loading: Everything at once OR un-/loading the needed assets? [duplicate]

Good evening. We've been developing quite a huge game for android on the basis of AndEngine. So we have a lot of assets to load, especially textures. At the moment everything (sound, textures etc) ...
0
votes
1answer
53 views

Can Java be used for developing games for Android in Unity3D [duplicate]

I only know Java Programming Language and no other. Can I develop games for Android in Unity3D using Java?
0
votes
0answers
58 views

drift/skid in topdown racer with libgdx/java

I'm trying to do a simple top-down racing game and is struggeling to get the steering right. At the moment I'm using a very simple steering and want to add some drifting to the car. I've read some ...
0
votes
1answer
30 views

LibGDX - Executing 2 different touchDown events in the same method

On the bottom left of my screen is a circle with an Arrow and on the bottom right is a circle with a gun. If the player is in jetpack mode and the Arrow "button" is clicked he flies like flappy bird ...
2
votes
4answers
363 views

Is it a good idea to make most actions in a game driven by simple tiny threads (in Java)? [duplicate]

I'm thinking of for example making the jump action of a character, that takes ~1s, a distinct runnable, so then other threads can read its state, with additional control over the action itself by the ...
0
votes
0answers
51 views

Minecraft Server - Get list of online players (Java)

My question is: How do I get a list of online players, not the count of the online players, in Java? //So I could call... String[] players = getPlayers("fnaf.hosthorde.net"); That is how I'd like ...
2
votes
2answers
215 views

How can I compute which chunk a coordinate is in?

I am working on a video game. Everything (terrain, entities, particles) is stored in 100 by 100 chunks. Here is the array structure for the chunks: public static final int chunkSize = 100; public ...
0
votes
1answer
29 views

switch between player camera/non-camera positioning

Sorry if this sounds ambiguous. But I am writing a traditional top down game. And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this ...
1
vote
1answer
44 views

How can I adjust my code to make the objects start dropping at a certain speed and then increase that speed over time?

I'm making a game in LibGDX where the player dodges falling objects. At the moment, my code makes each object (in this case 'DROPS') fall at random speeds. I'm wondering if anyone can suggest how to ...
0
votes
0answers
36 views

2D Platformer Pathfinding [duplicate]

First of all, I'm sorry, I know this is a really broad topic, but I've been trying to do this for days, I've looked at about a hundred different Google links, and I'm just not having any luck. ...
0
votes
0answers
21 views

How will i know if the Body is facing a the target angle [duplicate]

I want to know if the body of the car is facing the line on the picture
0
votes
1answer
21 views

On-screen counting within a certain time-frame

In my game the player can collect a 'virtual currency' - on the main menu I display the amount the player has collected. However, instead of simply displaying it, I want to count up from 0 to the ...
0
votes
1answer
33 views

Aligning Camera to Rectangle

I'm working on a game in Java, and I'm having some trouble with finding the correct camera position. I've already made a Rectangle that shows exactly where I want the camera to be, and at what scale: ...
0
votes
0answers
20 views

How to display armor/equipment on a character? [duplicate]

I've been working on an Online 2D RPG mostly for fun and for getting a basic understanding of Socket Communication, packets, and just basic game development. Like most RPGs there is some kind of ...
1
vote
1answer
78 views

Implimenting BADLAND like Body Movement in Box2d

I am trying to make a body (character in my game) move and behave in the same way as the character in the BADLAND Game with regards to rotation. The character does not have fixed rotation and behaves ...
-1
votes
0answers
46 views

Java LWJGL Rotating pistol with camera axis

I was writing a simply height-map based game and I wanted to add some range weapons like pistol. But I am stuck on the rotating part. My rotating on x axis was good. But problem starts when I want to ...