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

How to update projectile trajectory point?

I am a new game developer, I am making a game, but I have a problem, I don't know how I can update my trajectory point in OnDraw method. Could anyone please help me? Thank you! Here is my code: ...
1
vote
0answers
62 views

Libgdx stops all sounds when there are lots of sounds

I'm making a 2D game for Android using Android Studio with Libgdx in Java. I have a class, called SoundPlayer, which holds an ArrayMap. The key is the name of the sound file and the value is the sound ...
0
votes
1answer
20 views

InputProcessor without stage

I have a GameScreen where I'd like to have a pause button. I've tried using an Image with a listener, but since my GameScreen isn't a stage, I can't use that in the inputProcessor. So my question is ...
0
votes
1answer
70 views

How to resize 2D Java game without “squeezing” it?

I am trying to make my second java game (2D) but i have run in a problem: The game will be in fullscreen, but how can i make it so it is scaled properly for each screen? While researching i found out ...
0
votes
0answers
31 views

TiledMap Safe Area for different screen resolutions

I'm creating a Tower Defense game using libGDX (w/ scene2d) and TiledMap. I've been reading extensively about viewports and how I can better manage various screen sizes. I want my Tiled Map to take ...
1
vote
2answers
57 views

OpenGL [LWJGL3] - Matrix4x4 not rotating correctly

I tried today to make my own matrix4f class because of that LWJGL 3 does not include a class for it. So I arrived at rotation and it does not seem to work. I tried using the old util from LWJGL 2 and ...
0
votes
1answer
50 views

Simplifying Object Factory

I'm making a game for Android using Libgdx with Android Studio in Java. In my game, I have a class called ObjectFactory which has a method createGameObject(int objectType) which receives an integer ...
5
votes
2answers
623 views

Main game objects as static

I'm making a game for Android using Android Studio with Libgdx in Java. In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til ...
0
votes
0answers
33 views

Defining camera/view space

Im working on expanding my camera class, but having trouble defining camera/view space in the manner of this diagram: What Im trying to achieve is to define the camera as a true object much like a ...
0
votes
3answers
104 views

How to scale bitmap font without having it pixelated

How do i increase the size of a bitmap font without having it get pixelated, in libgdx?
0
votes
0answers
20 views

AdMob Banner appears 960x150 instead of 320x50 in libGdx - what's wrong here?

I am a bit helpless with this strange effect from AdMob. AdView is instanciated in code and so is the relative layout and libGdx view. View view = initializeForView(Engine.createEngine(G....
0
votes
1answer
50 views

How create/draw faded circles in Java

How do I create some circle - like the one on the image - in Java, and in various colors? I would like to make more of these circles to fly from specific position to random direction.
1
vote
0answers
37 views

Best way to create defence(withdraw) algorthim libgdx?

I have created user body and enemy body. Enemy body uses the steering behavior created by gdx AI. User body have it own control inputprocessor. World doesnt have gravity. Enemy body arrives the user ...
1
vote
1answer
43 views

Collision Detection Unresponsiveness

I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive. The only problem is that the collision detection for when the player just touches the ...
3
votes
1answer
165 views

Simple way to serialize save game data whilst allowing for future features

Is there a simple way to 'serialize' the game data of my game, but protected it from being unloadable if I add new fields? I have all the data in a single class, GameData.java, and I want to avoid ...
0
votes
0answers
25 views

libgdx - Math reflection to the correct direction

I'm using a simple reflection system, but the game doesn't work how I want. How should this game work? The game has two boxes. A red side and a black side. The player should only sort the bombs to ...
0
votes
1answer
46 views

Libgdx Sprite rotation around specific point

I made complex dynamic body that rotates around other body that is static. It works perfectly, however I got messed up with sprite position on that body. Here's what I have now and here's what I ...
0
votes
0answers
52 views

Why is my tiled map moving when I move the camera in libGDX?

I use LibGDX. I have created a map with Tiled Map Editor and loaded it to the game. Everything else is working well, but when I move the camera, the map moves: it jumps or floats. My code: public ...
0
votes
1answer
66 views

SceneGraph in Entity Component System, Transformations

I'm recently learning entity component systems, and started implementing it into my test engine, however I'm having an issue integrating this with scene-graph, which I'm trying for the first time. ...
0
votes
1answer
38 views

Libgdx shaperender within a circle as limitter

I encountered a problem, where my small entities would be rendered out of the bounds of my radar. At the time I solved it like this: ensure, that the object would be within the circle, but, that's ...
1
vote
0answers
76 views

Java Libgdx Attaching Sprite to Box2D Body

So I am working on programming a java 2D platformer for fun on the side and I have a rendered TMX level and a box2d body (just a circle shape) that I am currently using as my player. All the controls ...
0
votes
0answers
53 views

LibGDX - black bars, FitViewport and drawing background

actually I'm creating game in LibGDX and i have few problems. I'm trying to solve resolution and aspect ratio problem by using FitViewport but i want to dispose black bars which occur when resolution ...
3
votes
1answer
147 views

How do I get A.I. that follows a list of movement commands to move smoothly in a tilemap based game?

This is for a school project so it's not intended to be sold/fun/or a complete game, rather just a demonstration of stuff we've learned without resorting to frameworks and stuff. My ai agents choose ...
0
votes
0answers
14 views

Move ball through a direction angle in android canvas [duplicate]

I am building a simple game in android. I am successful in first step where I draw a ball in canvas in touch point. Now I am trying to move it from an initial point A (center) through the touch point ...
0
votes
1answer
191 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. private Vector2 position; private Vector2 velocity; private ...
0
votes
0answers
39 views

How can I simulate a basketball throw in LibGdx box2d?

So I want to simulate a similar throw like in the game Bouncy Basketball. Do i need to create a body and attach another body on it that would be the arm and then how would I apply force/impulse to the ...
1
vote
1answer
32 views

Circular Movement

if (Keyboard.isKeyDown(Keyboard.KEY_D)) { if (i < 360) { setX((float) (groundState.getX() + groundState.getRadius() * Math.cos(Clock.delta() * i))); setY((float) (groundState....
1
vote
0answers
53 views

libGDX text doesn't appear in TextField

A game I'm working on has libgdx's TextField. They work fine in every instance I've used them, however on a play tester's phone he says no typed text appears in the box until enter or space is ...
0
votes
1answer
31 views

How do I know if the ad is open while the use pressed the back button?

I am trying to reward a user a point whenever they watch/look at an ad. I give the user the reward whenever they watch the ad. However, the user earns a point even if they go to the ad and click back: ...
0
votes
1answer
43 views

What does the TextureRegion.flip() method do?

I'm learning libgdx and don't understand the purpose of parameters passed to flip(boolean x, boolean y). For example, I have code like this: texture = new Texture(Gdx.files.internal("data/texture.png"...
1
vote
0answers
57 views

Slick2D fails to load small textures

I'm trying to load a small 32x32 png texture using Slick2D, however it doesn't seem to render correctly. What's odd is that larger textures do load correctly. The 32x32 texture I'm trying to load: ...
1
vote
1answer
59 views

Canvas doesn't draw

I've set app view on XML based layout: setContentView(R.layout.mlayout); with some views objects on it. Then, I added another view via: RelativeLayout layout = (RelativeLayout) findViewById(R.id....
0
votes
0answers
24 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
1answer
54 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
48 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. ...
3
votes
0answers
32 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
51 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
131 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
71 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 java.awt....
1
vote
1answer
87 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 (UP-...
0
votes
1answer
94 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
65 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
108 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
39 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
115 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
28 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
368 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
26 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
49 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 perspective(...
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 ...