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.
0
votes
1answer
9 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 = ...
3
votes
2answers
35 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
0answers
41 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
16 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
11 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
21 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
14 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
71 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
38 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
11 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
21 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
85 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
51 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 ...
1
vote
1answer
20 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
15 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
21 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
40 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
82 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
16 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
31 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
49 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
56 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
23 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
49 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
28 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
42 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
44 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
23 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 ...
1
vote
0answers
15 views
Android Drag and drop problem
Im having major problem (all of a sudden, it worked before :-)) with drag and drop for my jig-saw puzzle app. My layout is in 2 relative layouts 1 for the puzzle pieces and 1 for the complete image ...
0
votes
1answer
56 views
How do you create dots in a shape of a letter and make them interact-able for a user to connect them?
I am making a game where the user is given a letter on screen such as the below image The user then uses the mouse to draw from one point to another until the shape is drawn. I wanted to know what ...
0
votes
0answers
43 views
Unpleasant periodic stutter in game loop
The game is running smoothly otherwise. However in certain periods the game stutters. So it goes from smooth...stutter...smooth and so on. The intervall between these is like 2-3 seconds on average (...
0
votes
1answer
59 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 handPlayer1). The Card class extends Actor.This is the code I use to deal the cards to the ...
1
vote
0answers
142 views
3D software-based engine projection issues
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
2answers
28 views
How do I get the 3d coordinates of my model Instance? [LibGDX]
I want to get the 3d coordinates (as a Vector3) from my model Instances. with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-...
0
votes
2answers
71 views
Implementing “Fix Your Time Step”
So far I have this implementation of "FYTS". However I am facing several problems. final int TICKS_PER_S = 60; double accumulator = 0.0; //The timestep final double dt = 1/(double)...
0
votes
2answers
43 views
How to Handle my Collisions in java
I'm currently making a color switch game All my obstacles are made out of 4 shapes of a different color. The shapes are in an array with their index being the same index as it's color in a array of ...
0
votes
1answer
25 views
LibGDX Box2d - How to only setLinearVelocity on X axis - problem while jumping
public void update(float dt){ float currentYVelocity = body.getLinearVelocity().y; switch(currentMoveState){ case moveLEFT: body.setLinearVelocity(-walkSpeed * ppm, currentYVelocity); ...
0
votes
1answer
37 views
Need help in making buttons for MenuScreen in Java
I'm making a Menu for my game and I made the MenuState(class) and made a MouseManager(class, implemented MouseListener and MouseMotionListener) and they are different class in different folder. Here ...
0
votes
1answer
23 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
35 views
How would you go about applying curvature to the rendering of a flat surface?
I want to draw a 2D planet surface. I have a set of tiles, which by themselves are flat if you draw them. Now I want to apply something to the drawing process, which makes it look curved the more you ...
1
vote
1answer
21 views
Cannot use my objects method when accessing from Stage LibGDX
I have a class Card with the method setOwner. I have set up my touch input to use a hitActor to identify touches by getting the Actor's name like so : public boolean touchDown(int screenX, int ...
0
votes
0answers
32 views
Bounding box (rectangle/polygon) for custom shapes and collision detection
I am a beginner in game development. I am using the libGDX with Box2D and struggling to come up with a solution for the following problem.: How can I have a bounding rectangle/polygon for custom ...
13
votes
10answers
3k views
Random noise based on seed
I am currently working on a program that should generate random noise on a screen based on the 'coordinates' of a pixel. The coordinates should have the same color every time you restart the program. ...
0
votes
1answer
95 views
Verify if a circle is completely inside a rectangle or not?
I am a beginner in game development. I am using the libGDX library. My question is two-fold. 1) First I'd like to know the best algorithm to verify if a circle is completely inside a rectangle. I ...
1
vote
2answers
141 views
Implementing an AI controller for Pacman
I'm currently implementing an AI controller class that is being used to determine the moves that ms.pacman should make to collect pills and avoid ghosts. In order to determine which is the best move ...
0
votes
1answer
79 views
Is javascript viable for serious multiplatform 2D game development? [closed]
Ever since I was a little kid, my dream has been to develop games. Well, now that I am older, more mature, and have some programming experience, I would like to start. However, I would like to turn ...
0
votes
1answer
59 views
How to implement buttons in Java?
I'm new to java and I want to know how to implement buttons for my menustate. Right now all I did is I made pictures of the buttons (play and exit) and just used g.drawImage to draw my Image to the ...
0
votes
1answer
63 views
How to adapt to using a graphics library in a game coded using Java's native graphics methods? [closed]
I've spent months coding a game that uses Java's native graphics methods to create a polygon-based 3D engine, and at this point it's about 12,000 lines long. However, the graphics performance is ...