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
1answer
17 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 ...
0
votes
0answers
13 views

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

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

Libgdx particle effect to show one after being updated the position

I have made a game, to draw the effect every circle. Every time i will update the particle effect position and redraw it. My function is here: effect = new ParticleEffect(); ...
0
votes
1answer
43 views

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

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
2answers
98 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 ...
0
votes
0answers
51 views

HTML in Cyber Space! [on hold]

Using html and java can i make a box and spin it around in cyber space, i remember years ago there was a code. I have built may pages now and look forward to learning more of html. Or may I be more ...
1
vote
2answers
117 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
27 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 ...
0
votes
0answers
31 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
30 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
133 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
72 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
30 views

Architecture vs Performance [Java; Android game] [closed]

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
28 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
19 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
28 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
72 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
31 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
64 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
31 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
47 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
67 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
87 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
150 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
25 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
54 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
29 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
48 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
36 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
1answer
60 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
81 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
88 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
53 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
54 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
86 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
55 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 [duplicate]

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
364 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
30 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 ...