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.

Filter by
Sorted by
Tagged with
1
vote
2answers
59 views

Calculate aim angle dead zone range

In my top down 2D shooter game the player has a shoulder mounted gun which rotates and aims automatically at enemies - that part is all working fine. Since the player can rotate as well, the gun is ...
0
votes
1answer
45 views

Flat shaded triangles using the ModelBuilder?

I decided to give the ModelBuilder a try but I cannot get rid of the smoothing of my terrain. So what I tried: Create each triangle individually with there own ...
11
votes
3answers
2k views

Fastest 3D collision detection between two oriented bounding boxes (OBBs)

I am at the point in my game where I need to add a collision system. I tried jBullet, and while it did work, it wasn't what I was looking for. I just want a simple way to test if two oriented bounding ...
0
votes
1answer
44 views

Prevent Wall Clipping with Bouncing Shape

I'm currently working on a demo-type program involving bouncing objects. Currently, I have a rectangle that can bounce around the screen. When the rectangle bounces against one of the walls ...
0
votes
2answers
45 views

Class Not Found Exception on Class.forName()

Edit: Solved, for some reason my For each loop was getting out of bounds for the Starfish class, so I did a little null check and it worked out fine. I am having this exception on title. I have been ...
1
vote
2answers
8k views

Drawing Lines on android with matrix

Can a matrix be used when drawing lines and paths on android? the DrawBitmap mathod takes a matrix as argument, I cannot find anything similar when drawing lines.
0
votes
1answer
207 views

How to get collision area within a circle in libgdx

I have a ball inside of a multi-colored circle, the ball will hit the inner area of the circle like this bellow circle image And the Circle will be rotated clockwise or anti-clockwise based on user ...
0
votes
0answers
60 views

Unknown error when trying to register a Minecraft ArmorItem

The error in question is [Inferred type 'I' for type parameter 'I' is not within its bound; should extend 'net.minecraft.item.Item'] on the following snippet of code ...
2
votes
1answer
126 views

Potion effect never wears out

I am writing a mod for Minecraft (in Java, duh) and want to apply a random potion effect like this: ...
0
votes
1answer
107 views

I am having trouble with gravity in my game

I am trying to detect if the player is on an object with a tag "canHoldWeight". But the detecting if the player is on an object isn't working. falling code called every tick: ...
1
vote
1answer
278 views

LWJGL3 shader code doesn't work

So I made a program to draw a simple cube with colors at each vertex. The program worked fine until I added shaders. It was using vbos and indicies and it did draw a colored cube like it should. So ...
0
votes
1answer
206 views

How can I track two fingers?

Im trying to make make game which is intended to be played with the phone in landscape mode, and the player uses their thumbs to control the movement. The game controls look like this: On the left ...
2
votes
1answer
133 views

Need instructions for my AI racing car game

I'm having a school project to create an 2D AI racing car game, but nobody know where is the destination, and the map is randomly generated. But to avoid the dead end, we must teach the car not to ...
2
votes
2answers
3k views

Cover Screen with Snowing Effect in Libgdx

Oddly enough I cant find clear instructions on this theme (I only found rain and the method is very particular) so I ask, how do I implement a whole-screen snow-falling effect? The methods i can ...
1
vote
1answer
29 views

How do I prevent buffered image size fluctuation when rotating?

As you can see in the GIF, as the car rotates, as the Car rotates, the size appears to change to fit the determined height and width, what would be the best way to change these in conjunction with the ...
0
votes
1answer
1k views

What is a good approach to dynamically change actor Position?

In my card game there are 2 players with each player having a hand(a ListArray of of Cards.In this case its ...
0
votes
1answer
27 views

LibGDX How to adjust mouse aim angle calculation when screen is resized

I'm starting with a screen resolution of 1280 x 960 and that is the default resolution where mouse aiming is calculated thus: ...
0
votes
1answer
33 views

Extending the camera vs CameraHelper class vs camera field

I am following an eBook called "Learning Libgdx Game Development" In it, the author implements a CameraHelper class that implements ...
1
vote
2answers
585 views

Problem with animating in Android, using batcher.draw in LibGDX

I am having a problem with the last part of the GameRenderer class. I call batcher.draw() and receive this error: The method ...
0
votes
1answer
103 views

Pause updating but keep rendering

I am creating an implementation of Snakes and ladders and I run into some issues.The game is updating too fast and I want to limit the framerate kinda,or make a pause so that the move is actually ...
0
votes
0answers
20 views

Efficient method for Sprite Stacking in LibGDX

What would be a very efficient method for creating a suede 3D effect by stacking sprites much like the game like NIUM in LibGDX I find it easy to create a rudimentary system that stacks textures in a ...
0
votes
2answers
626 views
0
votes
0answers
88 views

I need a custom launcher for my Minecraft server

I am creating my own Minecraft server for my friends and I (and then publish it). It uses Thermos for MC 1.7.10, with mods and plugins. My friends don't know how to install Minecraft Java Edition, ...
3
votes
2answers
1k 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 ...
3
votes
3answers
699 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 ...
0
votes
1answer
16 views

Incorporating HttpSession into libGDX communication

I wrote my server-side code prior to learning libGDX and writing my client-side code. Gdx.net provides for the http get communication I designed for, except for session authentication. I say that ...
0
votes
0answers
21 views

How to change the border color of a button in libGDX?

How to change the border color of a button. I know how to change the background, but I don’t know this, although I reviewed the entire documentation. And is it possible to find out whether the button ...
0
votes
1answer
50 views

Parts of OpenGL rendering area missing/transparent until resize

I am having a weird transparency issue when running my game in windowed mode. Parts of the window, left and top parts in normal window mode, right and bottom when in maximised window, become ...
0
votes
2answers
207 views

Cannot find folder when building game to .jar LibGDX

Whenever I run my game from my IntelIJ IDEA the game runs fine. It finds every folder and every asset in there. But whenever I build my game with :desktop:dist and ...
0
votes
2answers
107 views

libgdx - Problem occurring after collision detected

I have just implemented collision detection in my little 2d rpg-like game. I'm using Tiled for the maps, mechanism is simple - I have one layer called 'collision' in my tiled map, and while loading ...
0
votes
1answer
269 views

How do I pack my game LWJGL game into a single executable JAR with Maven?

I am trying to use Maven to manage building my LWJGL projects. The entire project needs to be packed into a single executable jar, dependencies, natives and resources included, so that can be easily ...
0
votes
1answer
36 views

Positioning ropes equidistantly on a landscape display

I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display. How can I proceed? My screen is 1920*1080, at 420 dpi. Is there any way that I could link the ...
0
votes
1answer
62 views

How to launch Libgdx cross-platform (Android, HTML, Desktop) multiplayer client with socket?

So i'm struggling with making my cross-platform client side to work, specifically on HTML part. I have java server that is responsible for all the controls and events, and I control it via netty-...
0
votes
1answer
78 views

In a top down game, once I have detected collision, how do I prevent it?

I'm making a top-down game in Java. I watched some videos, and this is the code I currently use when the player is colliding with an object: x += -velX y += -velY ...
0
votes
1answer
46 views

Weird black lines when rendering in my Java Game Engine

I have an issue regarding weird horizontal and vertical lines that occur in my game engine. The lines is in the background color. It occurs when I draw a lot of tiles in this way: ...
0
votes
1answer
25 views

Android Game - Screen Flickers When an Entity Removed From The List

I am using Canvas in my android game. When I remove a no longer displayed entity in my entity list, all other entities are flickering for a brief time. When it's not removed, there is no such problem. ...
0
votes
2answers
339 views

Project organization for a multiplayer client-server game

I'm programming a game 100% in Java but I'm having some issues concerning the final games architecture. I plan on having two separate projects: one that will hold the client side of communication ...
1
vote
1answer
91 views

How to add lighting to a 2D Tile-based game in JavaFX?

I'm making a 2D roguelike tile-based game with Java and JavaFX. I'm currently working on adding lighting and darkness to the dungeon, but whenever I try running it, it takes a very long time to load, ...
0
votes
0answers
66 views

Game server multiplayer architecture

I'm planning to build a big browser multiplayer game with gameplay very similar to agar.io but rpg. Game will be containing rooms as It's done in agar.io. 50-100 players max per room. Realtime. 10ms ...
0
votes
1answer
74 views

InputListener not working on a custom Actor

Right now I am working on a UI for my game. I'm adding my own UI elements to a group and adding that to a stage. But the listeners I'm adding to the actors are not firing off at all. I have looked on ...
1
vote
1answer
410 views

Calculating World Unit or Pixels Per Unit values

Is there a formula to calculate world unit or pixels per unit values in LibGdx? Most of my objects fit into a 32x32 or 16x16 frame. When the objects are close to 32x32, and I use ...
2
votes
1answer
19k views

How do I decompile Minecraft?

I'm trying to get started modding Minecraft. I opened up the minecraft.jar file in Eclipse, but it doesn't contain what I expected. In this tutorial the presenter ...
1
vote
2answers
271 views

How can I store my 2D map in JAVA?

I'm working on a 2d adventure game where the player can explore a random generated map. It's working perfectly if I set it to be about 3000x1000 blocks (my array is 3000x1000x2), but this is TOO SMALL....
3
votes
2answers
507 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:...
2
votes
2answers
220 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 ...
1
vote
1answer
174 views

Handling mouse input depending on selected unit and clicked tile

I am making a turn-based tactical game (think something like X-Com) and I am currently trying to figure out how to handle mouse input in a clean way without a mess of if-statements. I have a lot of ...
4
votes
2answers
2k 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 ...
0
votes
1answer
48 views

Java application chokes - when using MySQL

If I use localhost - XAMPP, my application runs without problems. Once I try to use real MySQL databases: db4free.net, freedb.tech. Applications begins to choke and freezing, resulting it is nearly ...
5
votes
1answer
3k 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 ...
3
votes
1answer
568 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 ...

1
2 3 4 5
67