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
0
votes
1answer
82 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
1answer
23 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 ...
0
votes
1answer
20 views

Drawing object lines in the Tiled map editor

Suppose I have this picture: I have a map like this created in Tiled already. I would like to draw collision lines (the green ones in the picture) without having to make it a polygon. As far as I ...
9
votes
1answer
14k views

3D Camera Rotation

Please, forgive me, but I need help and I've been stuck on this for a few weeks now, I'm making no progress and everywhere I go and I see a different answer, everything I try doesn't work. I've had ...
-4
votes
0answers
26 views

How to capture game's screen with 60 fps in java?

How to capture game's screen with 60 fps in java? I want to capture the game's screen in programmatically with java. I am using awt.Robot method to capture the game's screen. But, The fps of the ...
0
votes
2answers
914 views

Color Switch Collision Detection

If you don't know what color switch is look here: http://poki.com/en/g/color-switch I need a good way to detect the color collisions, one way would be to get the colors of pixels around the ball on ...
0
votes
0answers
27 views

Simple Checkers Game between two users

I am having issues with being able to have a click that occurs in one class interact with another class. I have a CheckerPiece class, where a ...
3
votes
3answers
665 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
0answers
16 views

Dynamic spawn system

What are good approaches or patterns to structure a dynamic spawn system ? It should be able to "create" entities by their type-ID based on a set of rules which are able to change dynamic during ...
0
votes
0answers
10 views

Casting the InputMultiplex class

...
0
votes
2answers
2k views

Libgdx music is not working properly

I finished my game programming but I have small problem, please help me I want to finish it completely. I am starting background music when the user goes to the PlayScreen and when the kid in the game ...
0
votes
0answers
29 views

Is using sprite sheets and drawing specific part the way to go?

I'm programming in Java. I have more than 200 MB of images used in my games, something like 100000 40x40ish images. I initially wanted to load them all during app initialization but it took like 2 ...
0
votes
2answers
84 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
244 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 ...
-1
votes
3answers
318 views

Java Tilemap Collision

I have tilemaps represented by values from 0 to 4. How can I make the player collide with tiles represented by 3 and stop the player from passing through it ? Here is my code for the player and ...
0
votes
1answer
24 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
57 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-...
1
vote
1answer
129 views

How to create post-processing effects in Slick2D?

As I get closer and closer to the end of the feature development for my game and the beginning of the graphical overhaul, I keep thinking of ideas for graphical effects that would make my game even ...
1
vote
1answer
35 views

Function to draw an image inside a rectangle

How can I draw an image inside a rectangle? I am introducing myself in the manipulation of images for games, I have a window and inside there is a rectangle that deforms. I would like to fill the ...
-1
votes
0answers
33 views

Libgdx, size of the button on phone really small

I making a game, so I created main menu with scene2d,on PC my menu looks good (big buttons on the center of the screen), on my phone it looks very small, what should I change? If you see any code I ...
0
votes
2answers
291 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
66 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, ...
1
vote
1answer
343 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 ...
0
votes
1answer
44 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 ...
3
votes
2answers
451 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
208 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
162 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
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 ...
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 ...
3
votes
1answer
545 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 ...
0
votes
1answer
265 views

switching scenes in libgdx?

I'm writing a little something in libgdx to learn more about the platform. Currently, I have a simple generated world consists of tiles, which are just blocks of texture drawn to the screen. It's a ...
1
vote
2answers
436 views

Java - Collision detection (Glitch)

I am working on a platformer game for the final year project in HS. However... The collision detection system I use is basically about checking wether a specific part of the character intersects with ...
1
vote
1answer
48 views

How to choose what to use in Java: Enums or Objects?

I'm in a dilemma over using Enum Types or using class objects in that particular part of my java project. Let's suppose I have an array where I constantly add and remove things from it, but I also ...
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 ...
7
votes
2answers
1k 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 ...
1
vote
1answer
393 views

How to replace tiles in Tiled in AndEngine?

in my Game I Create object layers and interpret the shapes in the engine as collision objects...now I want when Player collide with object, after a few seconds object falls...this works properly but ...
4
votes
2answers
2k views

Why do separate loops run faster than one loop that does multiple things?

My game had some lag, so I tried to improve the performance. I found that if I write my loops separately like this: ...
1
vote
1answer
341 views

Increase friction with a friction joint

I'm making a topdown 2.5D game (think the legend of zelda: a link to the past) using libgdx and box2D. to simulate friction from a topdown perspective, i've set the gravity for the box2D world to 0, ...
0
votes
1answer
283 views

Rendering an isometric tilemap

I have a tile which is 512x256 pixels and I'm trying to render it in an isometric fashion. I have this helper function: ...
0
votes
1answer
362 views

LibGDX: Best Texture Sizes to use for highest resolution?

I have two texture atlases: 1 is 1024x1024 (mostly used for GUI elements), the other is 2048x2048 (for game objects like characters). I used Texture filter mip map linear on them. But when the ...
1
vote
4answers
5k 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
1answer
85 views

Java Swing KeyBindings do not recognize input in a weird way

I am new to programming, so forgive me if I make silly mistakes. I want to make a game, and I started by making the player, and that's where I'm stuck at. I'm trying to use Keybindings (InputMap and ...
0
votes
1answer
28 views

Libgdx, button onclick event crashes

I'm trying to create an android game using libgdx with a Titlescreen, you just press start and your game startes. However I'm having difficulty trying to get these buttons to work. The titlescreen ...
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 ...
0
votes
1answer
86 views

Topdown Game Collision Detection

I am working on a simple game with topdown movement, but I am unable to get the collisions to work properly. I know the collision detection itself works, but the constraining of the player is where I ...
0
votes
0answers
15 views

Sliding against a wall is “sticky”

I try to implement a ball sliding mechanism in my game. When the ball collides with a wall, it gets bounced. When it's close enough though (after many bounces) it will start to slide against it. But ...
0
votes
1answer
166 views

Tuning physics for a “worms”-like game

I'm using LibGDX and Box2D for my physics but my characters bounce all over the place when moving and if there is a small slope in the terrain they launch off of it. I've tried tweaking settings but ...
1
vote
1answer
52 views

Java - set resolution of game

Hi everybody I am making small game using pure Java 8 and rednering it by Java AWT Graphics2D method . My question is how to make that user can change the quality ...
0
votes
1answer
426 views

Graphics2D.drawImage not working

I'm quite new to java. I'm trying to come up with my own game after watching a few video tutorials. However, I encountered a problem where I cannot draw an external image file that I loaded using the ...
0
votes
0answers
21 views

What design choice should I follow for client-server communication?

My game server currently launches a thread for each connected client, and handles all data exchange through that socket in a server-blocks-until-client-requests fashion. The problem derives from the ...

1
2 3 4 5
66