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.

learn more… | top users | synonyms

0
votes
1answer
14 views

per-pixel collisions using Libgdx Java (is there existing class for this??)?

I am making a simple side scrolling space shooter game using Libgdx and everything is going nicely. However until now I haven't been testing collisions for my players ship with other ships. I have ...
-3
votes
0answers
62 views

Learning to code games [on hold]

I have learnt to make some simple games using Unity, but now I would like to learn how to code them. After some research I have decided that I will learn Java game development. However, I don't know ...
1
vote
1answer
39 views

When should new threads be created in a game or how should time consuming task be handled?

This has been a question that has always troubled me while thinking about the code and logic behind gaming, I was wondering when and when not, is it appropriate to create new threads for different ...
0
votes
0answers
19 views

LibGDX - problem with LoadingScreen

I have problem with my LoadingScreen. When I run the game I have a black screen for about 5 seconds, and after that I have my LoadingScreen but for a split second. It's almost unnoticeable.
0
votes
0answers
33 views

is it a good idea to implement game states as member variables of a previous state?

I don't want to use a state machine because reasons. I have a menu class and a game class. The menu class has a variable of type game inside it. Calling a function start() in the game will launch ...
0
votes
0answers
21 views

How make my player dead with collision with tiles?

What I want is that when my player collides with my Tiles(which are solid) they'll be sent to the menustate(kind of like a death). I already did collision detection for my solid tiles. So how to make ...
0
votes
1answer
28 views

Java libgdx: spawn particles around a point

There are particles in a box, the black circle representing the spawn point and the red circle representing the particles. How would you spawn them so they don't spawn outside the box, and so that ...
0
votes
0answers
7 views

Mouse location is off due to Camera in Java slick2d

So I'm building a 2D top down shooter but I have a little issue with my camera and mouse. When I add the camera that I use to my game my mouse seems to stay in the first rendered part of the map(in my ...
0
votes
1answer
22 views

Why do I have to use this in my constructor when initializing variables in parameters of constructor?

Alright I will explain my question the best I can. So, I have this code: private Handler handler; Game game; public Menu(Game game, Handler handler){ this.handler = handler; this.game = ...
-1
votes
1answer
23 views

How to make it so that My SplashState will switch to my MenuState after few seconds

I have a SplashScreen class( SplashState) which will show first when someone opens my game, and what i want to do is that my Game will show the SplashState for lets say 5 seconds and after 5 seconds, ...
-3
votes
1answer
62 views

2D Java shooting game [on hold]

I've got homework in school - create 2D game in java - nothing big, just 1 player who is shooting with weapons. And I would like to ask you, how should I start - eg. how would you recommend me to ...
0
votes
0answers
27 views

Creating a 2D Arena-Styled Map: What's the best way at approaching this?

I'm trying to make a simple 2D top-down arena-styled game. The one area I am struggling with implementing is a good way to implement a map. Right now the game is just simply the screen, but I would ...
1
vote
1answer
28 views

LibGDX - Box2D, world, bodies and deltaTime

Can somebody tell me how to correctly handle Box2D "deltaTime"? When I have non-Box2D objects it's sufficient to multiply velocity by deltaTime but what should I do when I use Box2D world and bodies? ...
1
vote
0answers
25 views

Creating proper jump mechanics in LibGDX with Box2D?

I'm trying to create a proper jumping system for a 2D platformer with box2D, however, I'm not exactly sure how to make a good jumping system. Right now, I'm just doing public void jump(float delta) { ...
0
votes
0answers
46 views

How to make a google maps based game? [closed]

I think you all heared about Pokemon Go or Ingress and games like this. How are those games created ? What librarys did they use ? Are there special ones for them which are focused on game development ...
0
votes
1answer
37 views

get Actor hit() from array of Nodes

I have an array of nodes, i need to get a specific Node from this array in the InputListener event using Actor hit().. I have multiple menu items (Buttons, Levels) but the touch event not working. ...
0
votes
0answers
49 views

mobile card game prototype

We are currently planning to develop a mobile trading card game (something similar to Hearthstone). Coming from a web-development background, I do not have any experience in mobile development so have ...
-3
votes
1answer
71 views

How can I put my Java game in my Weebly Website?

I'm making a Java application (not applet), a game, which I want people to play through my weebly website because problems came for most of my friends PC's like the assets aren't appearing and the ...
1
vote
1answer
49 views

LibGDX - how to change FreeType Font color and screen coordinates

How can I change my FreeType Font color? I want to set custom color. I tried do this by using Color color = new Color() but don't work. And second: can I change my screen coordinates? I use two ...
0
votes
1answer
34 views

LibGDX - huge font

I have big problem with drawing font. My virtual world is 20x15 meters (viewport and camera too). I use FreeTypeFontGenerator. But something is wrong because for example if I have font 40px (40px = 1 ...
0
votes
2answers
40 views

LibGDX - how to close game and dispose objects properly

can someone tell me how to close game and dispose objects properly? I tried several methods but always have problems. I have ImageButton with ClickListener. Here's code of listener: exitListener = ...
5
votes
2answers
65 views

LibGDX, How to create a 2d collision terrain

How can I create a surface so my bike collides with the ground? I'm thinking of placing x,y coordinates, but that will be too straight and I want it more smooth. (I don't want to place 1 million dots)
0
votes
1answer
51 views

How can I render a tmx map at a given location?

I am using libgdx & trying to implement a Binding of Issac like dungeon. To do this I'm loading a tmx map when a dungeon room is created and rendering it to the screen. The issue is that the each ...
0
votes
0answers
20 views

LibGDX placing UV on a generated basic terrain mesh

I'm making my own terrain mesh via code (not really for efficacity but more for understanding meshes and 3d in general) and trying to make it tiled. Here's my code: private static Model makeTerrain(...
0
votes
0answers
12 views

Of Nodes and Motion States LibGDX

I am working with ragdolls in libGDX and bullet. Heres the idea: I have a Model object of a person appropriately exported and loaded. I create a ModelInstance Object from it. The Node's of the ...
0
votes
1answer
24 views

(LIBGDX) args instead of variables names

I added Kryonet to my libgdx project like this... Created a "libs" folder in core project, droped kryonet.jar in there. In build.gradle of the root project added this line: project(":core") { ... ...
0
votes
1answer
16 views

LibGDX: Shape from ShapeRenderer won't show up when put in another class

I am currently trying to make a little snake clone as my second project with LibGDX. I want to draw the borders of the screen with a ShapeRenderer. The Shape gets displayed flawlessly when I create/...
0
votes
1answer
81 views

MMO server use mysql offline?

Im going to write an MMO server for a game, however in my last attempt to do this I used mysql with xampp-server and the game-server was getting the data offline tru mysql(xampp server was offline). ...
1
vote
1answer
39 views

LibGDX - change actor's texture

Is there a way to change actor texture without creating a new object? I want to change my ImageButton texture when resize() is called, and for example for screen > 800px, ImageButton have bigger ...
0
votes
1answer
27 views

How to get the attack animation cycle all the way through after one KeyEvent without twitching? (Java awt)

So I figured by myself (supposedly) how to make the attack animation cycle all the way through after pressing a key without needing to keep it pressed. But now it doesn't always start at the same ...
0
votes
0answers
15 views

jMonkeyEngine3 having difficulty loading textured mesh

I have a OBJ (with respective material files, MTL, etc.) model that I created myself and that I can load into Blender just fine. I am now trying to load that model into jME3 and am having difficulty ...
-1
votes
0answers
22 views

Create a new LWJGL window from a running lwjgl application

I am working on a game using LWJGL, and i'm currently trying to make a launcher built-in to the same program, when i hit play, the launcher close and the game window gets created, however the program ...
0
votes
1answer
100 views

Calculate current level and level requirements when only XP is being updated

I am trying to create a formula to calculate the players level based on his XP alone. The game currently only increments his XP after certain actions. I have the formula for calculating the required ...
1
vote
2answers
55 views

Detecting collisions between orbiting objects in 2D

I am currently in the process of creating a 2D space debris simulation. I have the orbital physics implemented, but I am currently struggling to find a suitable way of detecting collisions. There are ...
2
votes
1answer
25 views

Gdx.graphics.getWidth() vs cam.viewport width

I'm facing difficulty understanding the difference between Gdx.graphics.getWidth() vs cam.viewportwidth, What is the difference?
0
votes
1answer
19 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
1answer
22 views

Libgdx scene2d not erasing old texture

I've been having trouble with getting scene2d to erase my old texture when I switch screens, and also when I change my label the old label string is still drawn underneath. public StartScreen(...
0
votes
1answer
43 views

LibGDX: How do I manage Player position?

I'm making a 2D isometric tiled game using LibGDX. In my Player class, I created a vector2 that I named 'pos' to manage the player position, then I draw my Player with: batch.begin(); batch....
1
vote
2answers
86 views

how to make my character jump

I want my player to jump and i tried my best to do it and i couldn't. Basicaly my class are splitted(i have speparate player class and keyboard class) which i thought would make my life easier but ...
0
votes
0answers
18 views

Static libGDX assetmanager (desktop only)

(I know there are a lot of questions about this on the internet, but most of them warn about android) Long story short: is this code safe in a desktop only game: public class Variables { public ...
0
votes
1answer
22 views

How do you save the rendering of a tiled map to an image?

Im currently using LibGDX and drawing a tiledmap with the OrthogonalTiledMapRenderer. Is there a way to save one rendering and put it into some file as an image? If you know of a method that doesnt ...
0
votes
1answer
33 views

Greenfoot java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

When an enemy comes into contact with the hero the hero class is supposed to remove the enemy class with the same X and Y. It works the first time but throws an error immediately after that: java....
1
vote
1answer
51 views

How to detect if game is hidden?

I'd like to pause my game when my app is hidden (user pressed home button or changed app). How can I detect that ?
-2
votes
1answer
63 views

How to apply Jump and gravity in java

Hey guys I'm working in a game where I want a jump function and gravity function instead of my player just flying around in the air. I added the function of able to press 'Space Bar' but haven't ...
0
votes
0answers
26 views

How do I add images using Greenfoot?

How can I add an image to my Greenfoot game and contort it? I'm designing a game where I have ships at sea battle against each other. When the ships battle I would like to change the image of an ...
1
vote
1answer
52 views

Rotate a Crosshair around a sprite - 2d worms style game?? (LibGDX)

I'm currently learning to code 2d games in Libgdx. Right now I'm making a kind of worms clone. I am using Box2d and have just my main sprite and a flat ground object so far. What im stuck on is ...
0
votes
1answer
30 views

Performance optimization when changing Textures LibGDX

In the main Screen class of my game there is a ListArray<Card> which makes up the deck of cards . The Card's texture is set in the constructor like so : cardTexture = new Texture(Gdx.files....
0
votes
0answers
47 views

How to fix a vertex projection distortion problem?

i have been writing a 3D soft-engine for a little while and i have gotten it a reasonable position but recently noticed a bug that i can't seem to solve. When i am rendering a few cubes as a test, if ...
0
votes
1answer
48 views

Repeating a background texture forever in libgdx

My "game" works with a pretty large playing field, so I need a repeating background. I've implemented this the following way: Loading: assetManager.get("texture_bg.png", Texture.class).setWrap(...
0
votes
1answer
25 views

LIBGDX Image tearing

I'm making an game in libGDX and I have been noticing some image tearing when camera is moving. Note that it happens only when the game is maximized and the camera x position is less than screen width ...