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

Ads are loading, but not showing?

TL;DR: My interstitial ads in my game are successfully loading, but when I call .show() on them, they don't show up! I have followed these directions, and the ads load succesfully, but don't show ...
0
votes
0answers
38 views

Java multiple player objects/enemy objects?

NOTE: I'm a beginner and learning :D Alright, so in my game I have a class for the player (with the parameters of x, y, color, width, height, and health, same parameters with the enemy). But I have a ...
0
votes
0answers
43 views

How to fix my issue with movement?

I am making a 2D tile game in Java, and I am having problems with movement, could someone tell me what I am doing wrong please? I am having difficulty in "calling" the function vectorFromKey in main. ...
-1
votes
0answers
34 views

How to make character selection in slick2D?

I am trying to make the player able to select between two characters in slick2D, but I cant get the map class to use the variable holding which ever character the player selects. Map Class: package ...
3
votes
0answers
28 views

Calculate Relative Mouse Movements Regardless of position

Context I'm working on making a variant of the atari game Breakaway IV and I'm trying to improve my mouse input handling. I use the input of a mouse's motion left and right to move the bumper. ...
0
votes
0answers
45 views

JBullet is acting weird, what is causing these 'floating' rigidbodies?

I've been working on a 3D game engine in Java for a school project. The game engine had scenes containing game objects, these game objects contain components defining the behavior of each object. I'm ...
2
votes
3answers
122 views

Accelerated movement in a specific time to a specific point

I am trying to move my sprite in a specific time to a specific position while using frame-independent or time-dependent movement. My sprite is also accelerated every frame to simulate gravity. I know ...
1
vote
0answers
59 views

Texturing Cubes

How can I texture a cube that is able to rotate in x,y and z direction in pure Java? Here is what i have tried: package main; import java.awt.Color; import java.awt.Graphics; import ...
1
vote
1answer
55 views

How to handle two players playing on one keyboard with Box2D (LibGDX)?

I'm making a racing game with LibGDX and Box2D. I've been using this tutorial to implement the basic physics, and it works properly. My main problem is to implement two different sets of keys ...
0
votes
1answer
81 views

Why is my deltaTime in my GameLoop 0?

I have a question about my code. I wrote a basic GameLoop for an Android Game and while testing it I realized the deltaTime is always 0. The code looks like this: @Override public void ...
0
votes
1answer
36 views

LibGDX--constant high score in top corner

I'm currently programming a game using LibGDX and box2D. I have a sprite (player) that moves up the screen, kind of like doodle jump. I'd like to have my camera to be centered around the player at ...
3
votes
2answers
88 views

Designing ability interaction system

I am making a turn based game where player chooses a team of heroes with specific abilities for each of them. (ex. stun one enemy, deal 20 damage to all enemies, heal 10 HP to one ally,...) The design ...
0
votes
0answers
37 views

Storage and Lookup of Voxel Chunks

How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory? The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating ...
5
votes
1answer
103 views

On a 2D generated terrain what is the easiest way to pick tiles for the shoreline?

If I have a two-dimensional array with ones and zeros for water and land respectively how do I choose what shoreline tile to use according to the water and land tiles surrounding it? The shoreline can ...
0
votes
1answer
24 views

LibGDX - Bundling Files

I have 3 files. A JSON file, a PNG file, and a TXT file. Is there any possible way I can put all three inside a common file with a custom extension? (for example "fileName.abc") I searched the web a ...
3
votes
5answers
353 views

How can I make this day/night cycle computation repeat?

Here's my code for a day/night cycle. I have it set up so that when time (Statistics.duration) is the right number, the light levels switch. It works great, but I'm at a loss for how to make it work ...
-2
votes
1answer
25 views

What is the purpose of the second parameter to Array.removeValue in libgdx?

I have been wondering what the second parameter of the method in Array removeValue does. removeValue(T value, boolean identity) What does indentify mean and should I pass true or false?
0
votes
2answers
42 views

OpenGL perspective matrix far plane

The near plane clips at exactly the value I set just fine but instead of clipping at 1000 the far plane clips at 1. Here is the code for the projection matrix: public static Matrix4f ...
0
votes
0answers
14 views

DragAndDrop release with pointer on payload

When I am moving my payload all the way to the corner it remains on the stage and my mouse goes over it when I then release (on a valid target) it returns null as a target and thus does not drop ...
0
votes
0answers
41 views

How can I make an Actor repeat the action on collision in LibGdx?

I want my EnemyActor to do this SequenceAction when it collides with my bullets. I have already done the collision. Now the problem is that it only does the SequenceAction once when it gets collided ...
0
votes
2answers
52 views

how to add an onclick event to a button?

If I will draw a button with canvas with any programming language (java,javascript....) I want to know how to add the events to what I've drawn for example If I will draw a button piture then what I ...
0
votes
1answer
47 views

How can I apply effects to a character based on the tiles it occupies?

A mechanic of my game is that when a Character (Actor) steps on some specific tiles, they should be affected by status effects like slow, poison, burn, etc. These effects lasts only while the ...
-1
votes
2answers
62 views

How to lock the mouse cursor in the middle in a first person camera?

I want to get a first person camera (like Call of Duty or Minecraft etc.) but I don't know which is the best way to do it. I have some camera increase rotation methods (camera.increase ...
2
votes
2answers
50 views

Java: problem with 2D corner collision

:) It took me many days to create a working collision detection for a 2D java platformer... I am finally calculating the corners of my player but the system is still buggy and I hope that we can ...
0
votes
1answer
49 views

Frustum culling only working at certain angles

So how I'm doing this is a little sketchy but I plan on changing it to either AABBs or spheres once I get it working. So the problem I'm having right now is that the frustum culling I've implemented ...
0
votes
0answers
17 views

JBullet & LWJGL Rendering objects with jbullet transform

I tried to render objects with jbullet matrix transform. Its something like that: get float array where is stored matrix then put it to floatbuffer and load to Matrix4f using load() function. Use ...
1
vote
1answer
38 views

How to get the position in an actor inside a table with LIBGDX?

Well the title says it all, I want to get the position of an actor inside a table Button button = new Button(bs); table.add(button).width(50).height(50); table.top().center(); By using ...
0
votes
1answer
45 views

Game Server Mechanic [closed]

Hey guys :) Im currently developing a little rpg duengon crawler. I really want to implement a local and an online multiplayer function, i know how servers are working and how to make them using ...
0
votes
1answer
36 views

keylistener and synchronization

i have this code: public final class PlayerInput implements KeyboardInputHandler{ public static final int INVERTED_AXIS = 0; public static final int NORMAL_AXIS = 1; private Sprite sprite; private ...
0
votes
1answer
30 views

Libgdx + Box2d working with 2 cameras

Recently I have read that you can work with 2 cameras whenever you involve Box2d, which only works in meters. In my Renderer class, I receive all the entities in the game and then draw them. I work ...
0
votes
0answers
25 views

Collision logic with Animations Java

Im trying to code a tile based platformer game with slick2d. While handling the collisions, Im facing with this problem. I could fix it for only that situation but I guess there must be a better way. ...
0
votes
1answer
69 views

How can I make an actor fire a bullet on touch?

I created a Jet and a Bullet, and when Jet is touched, the Bullet is fired. Now I want to know how can I make the Jet fire again when touched after it has fired the first shot? public class ...
0
votes
0answers
42 views

LibGDX - Player Movement Flickers

So, I was programming a very simple LibGDX game, so I decided to include a player class into the program. Once I did that, the players image started to flicker/stutter while I moved it. Here's the ...
0
votes
2answers
43 views

Detecting position within a circle

I need to detect the position of a knob on a touchpad. I need to detect if it is in particular areas and if so, which one. The sections, of course, being the colored parts. I know that the black ...
0
votes
2answers
100 views

How can I move an object around a canvas in a random direction at random times?

I am currently trying to move an object (circle ball) around the canvas in a random direction. I have already written the code for the wall collisions so the ball bounces back into canvas when the ...
0
votes
0answers
60 views

Implementing BaseGameUtils with LibGDX for Google Game Services

I'm developing a game for Android in Java using Android Studio and LibGDX. I'm trying to implement the Google Game Services inside my game but I'm having trouble using the BaseGameUtils. Every time I ...
-2
votes
1answer
40 views

How to get system date? [closed]

How do I get system date like: month, day in libGDX? I want to add to my game events that happen on specific date but I don't know how to receive it.
1
vote
1answer
45 views

Java - Adjusting the speed of an object during movement

I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object. xPosition ...
0
votes
1answer
63 views

dual contouring concept and term translations

I am working on a 3D sandbox mmo with destructible terrain, using Java and LWJGL. I looked at most options to achieve this and found that dual contouring would probably be the best option for me. I've ...
0
votes
2answers
64 views

Render terrains depending of the player position (Chunks)

Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered. The problem is ...
1
vote
1answer
64 views

How could I implement destruction of bases in Space Invaders type game?

What approaches could you use to implement the the gradual destructions of bases/shields in a top down shooter type game similar to Space Invaders? The simplest approach could be to use a series of ...
0
votes
0answers
37 views

Box2D top down car weird spasm

im currently programming a 2d top down racing game with box2d and libgdx. i have a car body to which there are 4 wheels attached. these 4 wheels are attached with RevoluteJoints ( for the front ...
0
votes
1answer
46 views

Ball can double jump in Jumper Game

I wrote a game that has a ball which can only jump (like in most jumper games) to avoid incoming obstacles (only, I haven't integrated the obstacles part yet). Right now, it's just a ball that can ...
5
votes
2answers
942 views

AI multithreading [closed]

MMO game. ~5000 (fake) players should be controlled by the server. Many of them have different classes -> different behavior. They should make some random pauses while doing some actions (~500-1500 ...
-3
votes
1answer
24 views

OpenGL ES 2 inheriting issues [closed]

I am Having an issue where one of my classes will not inherit the other ones variable value. In the class which is inherited. It shows the value of the float just fine. But when I go to the Class ...
1
vote
1answer
45 views

Player moving back and forth when moving with camera LIBGDX

I have a problem. When in libGDX my player moves across the screen and the camera is moving after him the player jumps back and forth a bit. Player still moves forward but it looks goofy I'm moving ...
0
votes
1answer
37 views

Frame Rate Independence for Non-Linear Increases

So while working on my game, I decided that I would have a speed variable increase in the fashion speed += 1/speed; with the goal being that in the beginning it increases fast and then it increases ...
0
votes
2answers
47 views

Hide building roof & Hide faces/vertices depending on world location

I'm currently developing a small game for my own enjoyment and I've ran into a problem. As you probably know many third person games (such as Runescape and XCOM, for example) hide the roofs when you ...
0
votes
0answers
38 views

Multithread OpenGL to Upload Meshes

My game is rendered in dynamically generated chunks, each of which has its own mesh. Every time I generate a chunk and upload its mesh, there is a huge lag spike. Is there a good way of eliminating ...
0
votes
1answer
34 views

GlViewport-code doesn't work in one specific screen?

I am currently working on a small game using LibGDX and Java. However, I have found one oddly specific problem. I want the game to resize so that it never has to be cropped and so it never has to cut ...