We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [java]

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.

376 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7
votes
2answers
973 views

Libgdx black rectangles problem

I'm working on a game for Android using Android Studio with LibGDX in Java. I recently found a weird problem when closing and reopening the game. When I first open the game, it works fine. If I click ...
7
votes
2answers
3k views

Matrix rotation wrong orientation LibGDX

I'm having a problem with matrix rotation in libgdx. I rotate it using the method matrix.rotate(Vector3 axis, float angle) but the rotation happens in the model orientation and I need it happens in ...
6
votes
0answers
477 views

How to correctly implement 'layered lighting' with Box2D-Lights

How does one only allow Box2D-Lights to affect one and only one OrthographicCamera. After researching, I found the following answer. This answer goes into detail ...
6
votes
1answer
265 views

Java game LWJGL input doesnt work properly

Im making a game in LWJGL 2 and Slick2d. Im trying to add an item to my inventory by releasing a key (the inventory system works ...
6
votes
2answers
594 views

Android libGDX FreeTypeFontGenerator exception

I am working on a libGDX project for Android. Since I added the following code, running the game on my Android phone produces an exception: ...
5
votes
0answers
182 views

LibGDX Rectangle not Scaling to ImageButton Instance as Expected

below is the class I wrote for a GameButtoninstance: ...
5
votes
1answer
953 views

LibGDX: Is it necessary to set a stage as an input processor when creating a touchpad?

I mean, I've been searching it, they always use set a stage as an input processor after they had added the Touchpadto the Stage ...
5
votes
0answers
122 views

balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping?

I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push ...
5
votes
1answer
2k views

Drawing fonts with LWJGL3 with OpenGL

I'm very sorry if this question has already been answered, but since I've been struggling with this for many days I thought I'd give it a shot here. My goal is to somehow render some text on the ...
5
votes
0answers
159 views

Why is my OpenGL enabled Java game not detected by Fraps?

Recently I found out that I could enable OpenGL hardware acceleration in my Java game with the line System.setProperty("sun.java2d.opengl", "True"); Initial ...
5
votes
1answer
1k views

libGDX using Stage and Actor produces different camera angles on desktop and Android Phone

libGDX using Stage and Actor produces different camera angles on desktop and Android Phone. Here are pictures demonstrating the problem: http://brandonyuh.minus.com/mFpdTSgN17VUq On the desktop ...
5
votes
1answer
179 views

Fixing the size?

My app isn't compatible with all screen sizes. When testing on a small size, my textview overlaps with my button. So, as suggested on the Android Documentation, and many stack overflow pages, I ...
4
votes
0answers
183 views

Implementing rubber rope

I'm using LibGDX to implement rubber rope in which player can fly and launch. I know I could use Box2D as physics engine and I'm going to one day, but I'd like to learn it myself for now. I've ...
4
votes
2answers
1k views

Libgdx Scene2D Table background not showing up

I am using Libgdx's Scene2D API to build my UI and everything has been working as expected until now. I created a Skin and a ...
4
votes
0answers
168 views

Why aren't my pieces rotating on my chess board in Java?

I am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All ...
4
votes
0answers
133 views

How can I connect multiple explorable regions into one large map?

I am planning a 2-D science fiction game involving spaceships. A major thing that I am having trouble figuring out is how to create a 2-d array of smaller maps that the player can explore. My ...
4
votes
0answers
670 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 ...
4
votes
1answer
575 views

Spawning enemies in four different positions with a fixed trajectory in android game

This is my first android game, I appreciate all the help. I want to define 4 spawning zones starting from out of the screen (left, right, up and down). Enemies coming from this areas have a fixed ...
4
votes
1answer
490 views

How do I detect if two sprites are being touched at the same time?

How do I detect if two sprites are being touched at the same time? I was able to detect one sprite, but not if another sprite is being touched by the second pointer. ...
4
votes
0answers
934 views

Libgdx performance on old devices

I'm developing a game in Java for Android, using LibGDX. I'm using Nexus 5 to test my game most of the time and it works great (Minimum FPS it gets is 57 out of 60). Recently I ran my game in Galaxy ...
4
votes
0answers
987 views

LibGDX's HTML project doesn't show anything in Browser

The question is self explanatory, when I run my demo-html project as a Web Application and I open Chrome with the provided link by eclipse, my browser doesn't show the image it is supposed to show in ...
4
votes
1answer
448 views

Java Slick2d lighting using Raycasting

I am trying to make a top down view game in java using the Slick2d library, for lighting I wanted to do something like this : http://www.redblobgames.com/articles/visibility/. I was wondering if there ...
3
votes
0answers
41 views

Strange normal mapping artifacts - OpenGL / GLSL

I have been following a few tutorials to learn some graphics programming with OpenGL, and recently implemented Normal Mapping. It works well for the most part, especially for objects with normal-...
3
votes
0answers
520 views

ray-casting, floor-casting part fails

I'm currently working on a ray-casting engine in Java and I can't figure out what's wrong with my code. For the learning and theory I use: The permadi tutorial: ( https://permadi.com/1996/05/ray-...
3
votes
0answers
207 views

Weird libGDX BitmapFont Color Change (And Alpha) Bug

I want to change the color of my libGDX BitmapFont, but it can't change it. The font is generated with Hiero v5 (Lastest as I Know) but the color of the font doesn't change. Here is the example code, ...
3
votes
0answers
294 views

Moving all the particles in effect LIBGDX

I have a few particle effects that I would like to be in a circle shape in libgdx i.e. not a cone shape. I have done this by setting the direction of the particle effect from 0 to 360. The problem is ...
3
votes
1answer
97 views

How to find the ideal path done inside a given shape in LibGDX?

I'm trying to make an android/libgdx game in which for every level you have a different shape as a png, and you have to drag your finger inside the shape and try to be as close as the ideal path ...
3
votes
2answers
373 views

Strange LibGdx box2d body.ApplyLinearImpulse(); behavior

I have been working on this game NinjaThief and when I apply linear impulse to player body it just keeps on moving. Some of the functions are still unfinished so it looks a bit messy. Here is my code:...
3
votes
3answers
611 views

libGDX - How to rotate with a specific duration

I want to rotate my player to 90° for a specific duration. I know scene2d provides this, but I don't want to use it for my players. With how much to rotate every frame, so after x seconds the ...
3
votes
0answers
185 views

Get mesh height at position

Me and my friends are creating a simple 3D game in LibGDX and are currently trying to implement simple collision detection with the terrain (ground). For this I thought the best way would be to simply ...
3
votes
0answers
87 views

External gui within a render loop

I was wandering how easy is to interface existing Java programs/GUIs inside a game loop. Sorry if my question is a bit vague. I'll try to explain. I am currently designing a simulation environment ...
3
votes
0answers
429 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 ...
2
votes
0answers
87 views

Bullets moving with the camera, not the world, Java 2D

I'm building a simple 2D Top-Down shooter game in Java. I simply cannot get this to work: I'm moving camera and world differently, world is moving when needed (when not in one edge, so it gives nice ...
2
votes
1answer
490 views

Moving sprite using the accelerometer in LibGDX?

I don't know how to use accelerometer in LibGDX; how could I use the the motion sensor? I'm working for a top down game with the motion sensor. I'm new to this framework. My sprite image is already ...
2
votes
0answers
577 views

LibGDX - Viewport unproject is not working

I develop a small Idle-Clicker Indie-Game but ran into a little problem. I have a Toast in the middle of the Screen, when the Toast is clicked, there should be a number flying up at the position of ...
2
votes
0answers
117 views

LibGDX TexturePacker line problem

I'm trying to use a TextureAtlas for all my textures for better performance. Every time my game starts all my tiles are packed into one texture atlas. I have put following code into my DesktopLauncher ...
2
votes
0answers
104 views

What heuristic should I use for A* pathfinding?

So, I've successfully implemented A* pathfinding (java) (http://www.cokeandcode.com/main/tutorials/path-finding/) in my game, but that pathfinding doesn't work as I wanted it to work. I don't know ...
2
votes
0answers
106 views

Fixed timestep periodical “lags”

I have fixed timestep code in my main thread, it looks like this: ...
2
votes
0answers
191 views

Sprite animation in Android view

I'm looking for a way to have different sprite animations in individual Android views. I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation. ...
2
votes
0answers
210 views

(Minecraft) MoveHelper for custom entity not updating

I'm trying to create a shark mob for minecraft 1.8 (using Forge 1.8). Since it's a water mob, the movement functions need to be edited to allow it to path correctly in water. However, after ...
2
votes
0answers
833 views

Using Box2D in LibGDX, is there a reason a fixture set to be a sensor would only -sometimes- detect a collision?

I am working on a 2D game in LibGDX. Currently, I am testing interactions between a player's weapon and enemies - in particular, a sword and an enemy monster. The player has a hurtbox and the sword ...
2
votes
0answers
396 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 ...
2
votes
2answers
199 views

Understanding HingeConstraint in jBullet

I'm using the java port of BulletPhysics engine jBullet. I'd like to make a joints between 2 triangles so that one edge of the first and one edge of the seconds act like a hinge. But I don't ...
2
votes
0answers
861 views

LibgGDX drawing two separate Textures in FrameBuffer

So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the ...
2
votes
0answers
324 views

Incorrect click event when resize on libGdx

I want to use scene2D, in libGDX, to detect click on object. I have this simple Game sample : ...
2
votes
0answers
2k views

Libgdx ParallaxScrolling and TiledMaps

I implemented ParallaxScrolling for my SideScroller project, everything is working but the tiled map (the most important part!). I've been trying out everything but it doesn't work (see the code below)...
2
votes
0answers
1k views

Rotation of viewplatform in Java3D

I have just started with Java3D programming. I thought I had built up some basic intuition about how the scene graph works, but something that should work, does not work. I made a simple program for ...
2
votes
0answers
1k views

AndEngine Making Chase Camera Follow Player

I am playing around with the AndEngine Race Game example. I am trying to make the camera follow the car as the player moves around. The Tile Map is larger than the player's screen but the camera ...
1
vote
0answers
46 views

How to structure tic tac toe game loop (or equivalent simple turn based game)?

I'm developing the simple Tic Tac Toe game in Java and got stuck on the game loop architecture. The game must support local, remote and automatic players. The graphical interface is based on JavaFX. ...
1
vote
0answers
28 views

Moving with rotating in 3D world in Libgdx

I'm trying to create a first person system in my game which consist of a big cube with grass texture , so the problem happens when I move and try to rotate the camera the world rotate and I'm not on ...