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.
3,437 questions
0
votes
0
answers
13
views
Adding extra octaves for note blocks in Fabric 1.21.1
How would I extend the range of note blocks in Minecraft? I'm using a Fabric mod template for 1.21.1.
I only started coding about a week ago, so I barely have any idea what I'm doing; as much ...
0
votes
1
answer
25
views
How to destroy/remove Texture after collision in java box2d
I'm coding a simple Arkanoid/Breakout game and have problems with removing the bricks. I'm able to destroy the body but the texture is still there. I'm a beginner so is there a simple way to remove it ...
0
votes
0
answers
37
views
Nullpointer loading texture in LibGdx [closed]
Im trying to load a tile map created with tile.
It contains a tileset which uses a png image.
Loading the map throws a null pointer exception.
0
votes
0
answers
23
views
LibGDX Model not rendering
I've been trying to learn libgdx's 3D functionality, because I want to make a turn-based game set on a 3D hexagonally tiled sphere.
As a simple starter project, I decided to try to create a simple ...
1
vote
0
answers
37
views
How to make a Minecraft Villager walk to a Location?
For Minecraft, utilizing the Bukkit/Spigot API, I have a LivingEntity Villager that I would like to path, or "walk" to ...
4
votes
1
answer
2k
views
Player sprite becomes smaller during attack animation (Java)
I'm developing a 2D game in Java using Java Swing, and I've run into an issue with my player character's attack animation. The player has both movement and attack animations:
Movement sprites: 16x16 ...
1
vote
1
answer
31
views
LibGDX TiledMap - get embedded objects from TextureMapObject
Is there a way of getting embedded objects defined within Tiled's collision editor from TextureMapObjects?
It'd be great if I could place texture objects around on an object layer and also include ...
1
vote
1
answer
95
views
How to implement proportional guidance in 2D
I would like to preface this by saying I am not a dedicated game developer.
I am trying to implement proportional navigation in order to create a missile class that receives the target location every ...
0
votes
0
answers
148
views
How do I fix java.lang.ClassNotFoundException: org.lwjgl.glfw.GLFW
I have not used Java in a while and thought I might try LWJGL with OpenGL and GLFW.
I am using Apache Maven as a Build System.
It lets me compile the program, but when I run it, it says:
...
0
votes
0
answers
98
views
Collision avoidance and perching behaviour for Boids in a Voxel game
I am currently trying to figure out how to efficiently detect collisions in combination with a boid simulation in a 3D Minecraft clone written in java.
For single entities i already implemented a box ...
0
votes
1
answer
54
views
Connecting bodies together in jbox2d
Im trying to connect bodies together to make some sort of a "building" system or more specifically im trying to make multiple "blocks" connect to eachother but Struggling to figure ...
0
votes
1
answer
104
views
Comparison of 2 different quaternion axes
I am trying to compare the Z-axis and the X-axis of two different quaternions in a way that would give me the Euler angles about the X and Y axes to line up the two different axes. In my program, the ...
0
votes
0
answers
27
views
How to setup position of an image overlayed another in a stack libgdx
I have tried to change the position of the image bagitem[i]( which items are covered by a green border square; it only used method debug() to appear the border) to center in many ways but have not ...
0
votes
0
answers
44
views
PIxels drawn every other pixel
Like the title, I have a program drawing some cubes on screen, the problem appeared after I switched computers, from desktop to laptop (Which has a bigger resolution).
I'm using the half space ...
0
votes
1
answer
70
views
Back-face culling not working
I'm trying to figure out back-face culling, with little results.
My code, from what i've gathered:
...
1
vote
2
answers
192
views
Making a game loop to run multiple threads
I'm having a really hard time understanding Threads and their contents.
What I'd like to have is a main game object (which I have) and a loop, where I can measure the time it takes for two threads to ...
0
votes
0
answers
39
views
Black screen when sizing JFrame/JPanel with Toolkit.getDefaultToolkit().getScreenSize()
I am working on a game engine.
...
0
votes
3
answers
70
views
Reduce processing time of image to shape
I'm making a simple game engine using Java and have found a major issue.
To create accurate collision detection I decided to convert a transparent image into a ...
2
votes
1
answer
100
views
Skill Class design : How to deal with multiple criteria
I'm planning to make a Class for RPG game's character skill.
But the problem is that the skills need to be classified by multiple criteria.
Below are the criteria for skills.
Independent / dependent
...
0
votes
1
answer
60
views
How to save score without resetting to 0 between Game Scene and Pause Scene?
I'm currently working on a LibGDX Java Game Project inspired by the Space Invaders game where I have created 2 Scene Classes: LevelScene and ...
0
votes
1
answer
231
views
How to to make KeyListener do an action only once per press, even if the button is held down?
I'm trying to make a turn-based game where my character is allow to move in any direction, but only by as much as the dice rolled allows him.
My problem is with how I'm using ...
1
vote
0
answers
55
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 ...
2
votes
1
answer
173
views
Programming Singletons vs Static classes
I've been developping a 3D app for some time and I remember at some point I started to need to pass data arround in unrelated areas of the program, where it wouldn't make much sense to pass them ...
2
votes
1
answer
221
views
GLSL wrong data read from attribute
I'm developping an OpenGLes 3.0 app with Java and I started writing the shader code. For some reason, it seems to mix up the attributes data locations and I don't understand why. Here's the code :
...
3
votes
1
answer
740
views
How to store condition dependent item information in JSON
I'm developing a RPG-game. After searching about various ways to save item information in RPG-game, I determined to save information in JSON files. The problem is that in my game, some equipment's ...
1
vote
0
answers
69
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 ...
0
votes
0
answers
35
views
I use skin composer, I want to create scene in scene composer, I can't add text buttons even though I created text buttons
I create text buttons, add every image and font, but it's still disabled when I want to add button in scene composer. I'm probably doing something wrong.
0
votes
0
answers
47
views
How do I go about making an enemy change depending on where the player hit it?
Currently coding in java, using cocos engine, making a low-poly game with a world which changes based on what the player does, hopefully including the aspect of an enemy changing when the player hits ...
0
votes
0
answers
160
views
Brick Breaker - Adjust ball's collision angle without affecting speed
I'm working on a Java Brick Breaker game, and it's functional so far. However, I'm facing an issue with collisions. Currently, when the ball collides it simply reverses its direction.
I want to ...
0
votes
0
answers
31
views
Image fragments when moving up and or left
Not entirely sure how to resolve the issue as I am quite new to programming, however this seems to be my last option in terms of finding an adequate solution.
EDIT: https://streamable.com/0i92xq - ...
1
vote
0
answers
380
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.
...
0
votes
1
answer
64
views
Modifying LibGDX vector2's seems to do nothing
I have a piece of code similar to this:
Vector2 test = new Vector2().setLength(20).setAngleDeg(45);
But when I'm trying to print its contents (such as ...
0
votes
0
answers
56
views
Only first line/column of level text file gets loaded into tile map
I'm trying to make a map using a text file, but it only does the first line / column and not the rest.
I know the problem is in getTileImage.
...
0
votes
0
answers
81
views
How would I make a self updating launcher for my game in Java?
I have a game I am working on, and I want to make a launcher for it. I am having trouble finding information on how to do it in Java (my video game is programmed in Java, so I do not want to use C#, ...
-2
votes
1
answer
67
views
1
vote
2
answers
146
views
Is it appropriate to design heroes as items in game development?
If you were to design a multi character game like "Genshin Impact", would you design the character(hero) as a item?
What is an item: in our game design, an item is an object within the game ...
0
votes
0
answers
41
views
speeding up image manipulation for shadows- engineless
so my project is a ray-casted lighting system thats trying to implement soft shadows. the ray casting is working currently, so right now my focus is on performance of the soft shadows portion.
i use ...
0
votes
1
answer
188
views
Unknown enum type when modding Minecraft recipes with CraftTweaker
I want to make some new Recipes with CraftTweaker, which uses machines from the Create mod (I'm using Life In The Village 3), but I have the following error in my scripts:
...
0
votes
1
answer
234
views
How to improve performance of LiBGDX Android app?
After creating a few bodies and a map with collisions, the app performance clearly goes down. However, RAM and CPU don't seem fully stuck, but the game experience is horrible nonetheless.
GameScreen ...
0
votes
0
answers
153
views
Good design for player input handling in 2d game
I am working on a java 2d game. Keeping things short, I'd like to improve my current input handling. Basically the player can move up/down/left/right with WASD, perform an attack with mouse left click ...
0
votes
0
answers
146
views
Canvas vs JPanel in game development?
I'm new to Java and I have seen that some games use Canvas and some use JPanel as the class that Game class inherits from. Here is a sample project but it's a bit old. I am not sure what should I use ...
0
votes
1
answer
516
views
How do I implement Minecraft Forge Config GUI (1.8.x)
So I have recently been working on a minecraft 1.8.9 forge mod, just to play around and see what there is (eventually I am planning on making a utilities mod with versions for 1.8-1.19, which is why I'...
1
vote
0
answers
36
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 ...
1
vote
0
answers
115
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 ...
1
vote
0
answers
167
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.
...
0
votes
1
answer
537
views
How to enable V-Sync in Java?
I have used the BufferStrategy, but my code runs still way too fast. xrandr reports that TearFree is "on" and the ...
1
vote
0
answers
69
views
i have a strange bug with collision, is there any way around this or do i have to pick a different method?
so lately i've been learning about abstract classes and interfaces, and i saw a neat yt video about falling sand games (think Noita) so i wanted to take a crack at it as some particles share a ...
1
vote
2
answers
301
views
Why is my negamax algorithm returning negative infinity scores?
I'm currently in the process of writing my own chess engine in java and am having a little trouble with negamax. I've opted for negamax since its easier on the eyes and reduces the number of lines of ...
2
votes
1
answer
48
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 ...
1
vote
0
answers
52
views
How to update the version of Box2D used in AndEngine?
I need help to use an updated Box2D library where the current version is > 2.3.0. I am unable to find a compatible library and do not know how to compile one for use with the Java Native Interface (...