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
38 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
71 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 ...
0
votes
1answer
57 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
2answers
249 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
177 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
43 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
73 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
41 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
68 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
82 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
66 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
49 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
133 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
122 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. ...
1
vote
1answer
108 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
91 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
49 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
44 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 ...
0
votes
1answer
110 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
98 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
91 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
100 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
392 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
91 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
236 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
32 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
59 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
37 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
22 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
26 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
47 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
22 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
109 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
vote
1answer
77 views

Use Slick2D for standard application instead of game

I was wondering how well Slick2D would work when used for a custom rendered GUI in a standard application? A standard application not being a game. More like a text editor or 2D level editor that ...
0
votes
3answers
99 views

Drawing sprites only under certain conditions - alternatives to using 'if statements'?

Within my game (which is Java/Android), I wish to draw a sprite only under certain conditions, so up until now, I've been using if statements to accomplish this. Something like so: if ...
0
votes
0answers
36 views

how to detect collision with libgdx and tiledmap [duplicate]

As you see , it's a picture from my game map , i have to create a 2d rpg game when a character can do many things. Currently i'm looking for a solution to handle collision between the character and ...
0
votes
0answers
91 views

2D GLSL Lighting and Sprites

I'm trying to make a 2D game engine, and I really want to support ambient light as well as multiple point lights that you can define the color, intensity, radius, etc from uniforms in glsl shaders. ...
-2
votes
1answer
115 views

How can I get “Good enough” collision for entities? [closed]

I am developing a Pirate ship fighting game. It's a great concept: Ships firing cannonballs, sinking each other, having to work as a team to complete the mission... But.. I've tested it with about ...
0
votes
1answer
92 views

Trying to add a feature to my (basic) level parsing algorithm - not sure how to (JAVA)

Right now this method goes through a list of GameObjects (e.g. JetPack, Platform) with their respective x and y positions in a text file called level1.txt: platform 840 280 platform 1130 280 coin ...
0
votes
0answers
73 views

Fake Lighting 2D Space Java

I have an image that I want to be used as the light. The white are should be drawn, the black should not. I need the light to be tinted to whatever color I pass to the light object. I have code ...
0
votes
0answers
30 views

VBO - Update Vertex data

My game will be a 2D Sidescroller and I'm working on moving objects around. Since I want to animate and move my sprites around, how do I update the vertex data? This is my current class for GUI ...
0
votes
0answers
45 views

manipulate textures in real time using GPU

I'm looking for some way (tutorial, library or build in option) to draw texture on JMonkey in real time. So I have 2 images one a normal texture that is fairly big(4000x4000) and another much smaller ...
0
votes
1answer
55 views

Jmonkey loading texture from fails

I have the following basic code: public void simpleInitApp() { Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); Texture cube1Tex = assetManager.loadTexture( ...
-1
votes
1answer
49 views

Java Game not rendering properly

Hello I have a game that you can play(duh). When you start the game a loading screen pops up and on the loading screen I display an image of an eye I drew. In paint.net they eye looks perfect but in ...
-1
votes
1answer
45 views

Java game loop delta not working

Hello I have game loop where I can change framerate. But when I change framerate to other, delta time not working fine. For example when framerate is lower everything is faster. Here is game loop: ...
0
votes
0answers
23 views

Java JBullet rotating rendered rigidbodies

Hello I wan't to rotate object I wrote some piece of code but that don't won't to work. Here is this code: glPushMatrix(); float[] matrix = new float[16]; ...
0
votes
0answers
24 views

mouseWorld Coordinates Box2D

I have one simple question in Box2D: if you want to get the world coordinates of mouse, this is the function you gonna use in Java: void update(int x, int y) { if(mousejoint !=0) ...
1
vote
0answers
19 views

Java JBullet models not colliding [duplicate]

Hello I wan't to do model collsion in JBullet but that don't won't to work. Models look like have some invisble holes. Here the code for creating collsion shape: int triangles_count = (int) ...
0
votes
2answers
174 views

Libgdx box2d crashing

im making a game in libgdx which i having a bunch of circle bodies floating around in space and when the player's body crashes into another body, that body deletes and creates two smaller bodies ...