Skip to main content

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.

416 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
7 votes
0 answers
786 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 ...
BleedObsidian's user avatar
7 votes
1 answer
4k 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 ...
Allar Viinamäe's user avatar
6 votes
0 answers
315 views

LibGDX Rectangle not Scaling to ImageButton Instance as Expected

below is the class I wrote for a GameButtoninstance: ...
HoopsMcCann's user avatar
6 votes
1 answer
708 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 ...
OrangeHat's user avatar
  • 123
6 votes
0 answers
155 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 ...
Victor G's user avatar
6 votes
0 answers
185 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 ...
Arthur's user avatar
  • 61
5 votes
0 answers
252 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 ...
Maciej Dziuban's user avatar
5 votes
1 answer
2k 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 ...
Brandon's user avatar
  • 51
5 votes
1 answer
212 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 ...
Ruchir Baronia's user avatar
4 votes
0 answers
488 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 ...
V F's user avatar
  • 41
4 votes
0 answers
216 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 ...
Prakhar Londhe's user avatar
4 votes
0 answers
162 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 ...
Kenny Williamson's user avatar
4 votes
0 answers
798 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 ...
Gad Wissberg's user avatar
4 votes
0 answers
1k 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 ...
Gad Wissberg's user avatar
4 votes
0 answers
1k 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 ...
yat0's user avatar
  • 153
4 votes
1 answer
581 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 ...
user3558075's user avatar
3 votes
0 answers
322 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-...
cstr_'s user avatar
  • 31
3 votes
0 answers
2k 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-...
atanii's user avatar
  • 137
3 votes
0 answers
422 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, ...
user2963359's user avatar
3 votes
2 answers
5k views

Rendering Smooth Text in Libgdx

I am trying to draw text onto the screen but it always ends up being pixelated no matter what I try. A lot of people say that adding the Linear TextureFilter works or offer other solutions but they ...
chip_s11's user avatar
3 votes
1 answer
761 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 ...
zarawayun's user avatar
3 votes
0 answers
460 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 ...
Charanor's user avatar
  • 7,840
3 votes
0 answers
106 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 ...
Vagos Duke's user avatar
3 votes
0 answers
622 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 ...
M1LKYW4Y's user avatar
  • 131
2 votes
1 answer
46 views

How to organize game entities that are stored inside other entities?

In my GPS based game, there are certain structures the players can build that store units. For example, airbase structures store aircraft objects. Currently, the way I have this organized is the ...
user204468's user avatar
2 votes
0 answers
54 views

Synch clocks between client and server in Java

We're developing a simple boggle game in Java for a college project (purely academic purposes, so we're trying to keep it simple). Our application is composed by a client portion and a server portion. ...
IfLoveWasBornToDie92's user avatar
2 votes
0 answers
368 views

Having difficulty integrating flow field with flocking algorithm

I have been tweaking my path-finding in my game for a while now, and it's mostly functional, but there are some major issues that are holding me up. I have a flocking algorithm implemented to help ...
Darin Beaudreau's user avatar
2 votes
0 answers
577 views

Forge 1.14.4 Minecraft modding: Override vanilla loot tables

I cannot figure out how to override vanilla loot tables, I've been at this for hours, and I can't find anything online. Just very outdated tutorials. I added custom crops and seeds to my mod, now I ...
Athamas's user avatar
  • 121
2 votes
0 answers
64 views

Lighting not working in a 2D JavaFX game when using subtracting shapes?

So im trying to add lighting into my game. I'm using shape subtracting and unions to subtract circles (the lights) from a dark rectangle that covers the whole world. I think that its a problem with ...
Superhuman's user avatar
2 votes
1 answer
229 views

Handling User Input Based on the Current Game State

currently i'm developing a 2D game in my spare time and i'm confused on how to handle the input from the player. Currently my game uses the state design pattern, each game state is a different object ...
Grant Upson's user avatar
2 votes
0 answers
129 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 the camera and world differently. The world is moving when needed (when not in one edge, so it ...
Kerdo's user avatar
  • 65
2 votes
0 answers
2k views

Euler angles to directional vector

I wanted to implement a directional light system in my game, and instead of passing the direction to the light, I chose to use an angle, and only later convert it to a directional vector, so it is a ...
Bálint's user avatar
  • 14.9k
2 votes
0 answers
112 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 ...
Mindee's user avatar
  • 21
2 votes
0 answers
147 views

Fixed timestep periodical "lags"

I have fixed timestep code in my main thread, it looks like this: ...
johnyX's user avatar
  • 143
2 votes
0 answers
210 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. ...
Jose Gonzalez's user avatar
2 votes
0 answers
223 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 ...
steelfeathers's user avatar
2 votes
0 answers
1k 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 ...
user63204's user avatar
2 votes
0 answers
446 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 ...
Aiman Batul's user avatar
2 votes
0 answers
964 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 ...
grimrader22's user avatar
2 votes
0 answers
340 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 : ...
Kamalen's user avatar
  • 264
2 votes
0 answers
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)...
kirchhoff's user avatar
  • 388
2 votes
2 answers
5k views

keyPressed is not working after adding ActionListener to JButton

I have a serious problem while trying to build a menu for my game. I've added two JButton to a main JPanel and added an ActionListener for each of them. The main JPanel also contains the game JPanel ...
Yehonatan's user avatar
  • 121
2 votes
0 answers
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 ...
user29163's user avatar
  • 143
2 votes
0 answers
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 ...
Free Lancer's user avatar
  • 1,283
1 vote
0 answers
51 views

JBullet - Shoving around objects

Sometimes in video games the players can walk up to certain objects for example boxes and barrels and shove them around. How can I recreate this system? What function do I have to use to apply force ...
Nagy Lala's user avatar
1 vote
0 answers
62 views

LWJGL3. A strange graphic artifact of OpenGL 3.x

I work in java with lwjgl3. I came across a strange artifact, the source of which I have not been able to determine for a very long time. I'm drawing a large surface. When I approach this surface and ...
alfabouh's user avatar
1 vote
0 answers
259 views

Realistic bouncing ball physics

I am trying to implement realistic physics for my game plinko. As of now i only implemented the inversion of the velocity and the distance between both objects. ...
Jonasoos's user avatar
1 vote
0 answers
32 views

Android TMX library no tile animation

Did anyone use this library? I am wondering if this library has a possibility to display tile animation? When I try to show my "abc_main.tmx" map (created in Tiled application) the tile with ...
mnietuniema's user avatar
1 vote
0 answers
98 views

Animate buttons sliding in

I am developing my first libGDX game. I want to animate the buttons on the stage, so they transition into view instead of just popping into appearance. For example, each button should slide in from ...
Zerg's user avatar
  • 11
1 vote
0 answers
101 views

How to get the correct display mode refresh rate as a float in Java?

The following example prints 59 on my system, because the return type of getRefreshRate is int. ...
ceving's user avatar
  • 111

1
2 3 4 5
9