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

2
votes
1answer
26 views

Using USB sound input for an android game - is it possible?

We are brainstorming ideas for an app, for a major project using Android Studio, and writing in java. My major is game development, so I intend on trying to build a video game based off the use of an ...
0
votes
0answers
4 views

How to use Canvas.translate to make a camera scrolling effect in android?

I'm making a game in android, and I'd like the "camera" to be always drawing the character in the center, I've been searching and I found out that I should use this method, but I don´t know how to use ...
0
votes
0answers
13 views

JAVA: Unformed Sprite When trying to Read SpriteSheet

So Im a beginner experimenting with ImageIO. Can someone tell me why im getting this pixelated-incomplete sprite? Here's the code public BufferedImage getImage(String location) { try { ...
1
vote
1answer
23 views

libgdx - Check if body is touch

I have some bodies around the screen(Ball[] balls), and I would like to delete them when user touches them. Also, I have an Image as userData of the bodies. I dont want to make a function to all ...
2
votes
0answers
45 views

How can I compress resources into a single file in Java?

Today I've finished my game, but there's a problem. There're more than 500+ images in my resources folder and I want to compress them into a single file, like other games do (for example put ...
2
votes
1answer
34 views

Isometric 3D grid - what order do I render elements in the grid?

I'm trying to create a screensaver, so strictly speaking this isn't for developing a game, but the subjects discussed on this SE site are a better match than any of the other sites, and I think the ...
0
votes
1answer
40 views

Java: How do I cycle through a BufferedImage array of images and display them?

So, I'm coming from Python and Pygame here, porting most of my code because I didn't like the performance. A lot of the syntax is similar, but I've been having some trouble with a few things, namely ...
1
vote
2answers
72 views

How to make sprite move in any direction?

I have an arrow sprite that rotates based on where my cursor is pointed, I can only make it move up,down,left and right.How about in a diagonal way? //this is the rotation nt x=Gdx.input.getX(); ...
2
votes
2answers
99 views

2D - Smooth lighting with shadows for a tile-based game

for the last week or so I have been completely stuck on trying to implement efficient lighting. I've been researching and experimenting and I've looked everywhere that I have been capable of finding, ...
0
votes
0answers
17 views

GLFW - Event Polling System

I need some help on design. I'm making an event polling system, where a window is notified of events as they happen. I handle events at a system level in my GLFW backend, by using callbacks. ...
1
vote
2answers
31 views

How can I add extensions to libGDX

I had a problem with my Font in a game I am developing in libGdx. After some googling I was instructed to use the following code: private void createFonts() { FileHandle fontFile = ...
0
votes
1answer
34 views

android canvas rope swing

I'm creating the code, where a player swinging on a rope for the moment I got this double angle = Math.atan2(player_y - center_y, player_x - center_x) - Math.atan2(end_y - center_y, end_x - ...
1
vote
1answer
27 views

Scene2D: How to use Image.setDrawable()

I'm trying to change the texture of an Image actor on my Scene2D stage, however I can't seem to get it working. It seems like setDrawable() doesn't really do anything. For example, this will make ...
2
votes
0answers
24 views

balloon ligher than air with libgdx, impementation of FixtureDef.density, gravityScale, linearDamping?

I use libGdx/box2d's physic. My intention is to create a balloon filled with helium (a body, what hovers above a surface, if we apply a little force to it - it moves fast but not far, if we push ...
0
votes
1answer
30 views

glGenArrays - This functionality is not available

Whenever I call glGenVertexArrays(), I get the following exception: Exception in thread "main" java.lang.IllegalStateException: This functionality is not available. at ...
0
votes
3answers
103 views

Procedural generation of stars in the background with given random seed

I want to generate stars (actually a 2d vector) in the background. The player is moving left and right endlessly. When the player moves the stars, which aren't in sight anymore, should be deleted from ...
0
votes
1answer
83 views

AI for Minesweeper like game

I am currently developing a Puzzle/RPG game which works a little bit like Minesweeper. You have a Field of Tiles and 2, 3 or 4 different colors from which you can choose. Now you have to uncover tiles ...
0
votes
1answer
31 views

How to create objects having attributes from differents java class

I have a class Creature with another class Flying and Undead that extends Creature. How could I create a object that have both the Flying and Undead attributes? class Creature(){ String name; public ...
0
votes
0answers
18 views

Java how to wrap text

Hello I have a game where you hack into computers(not real ones :P ). You can type the command ping and it pings to your address in real life. It returns something like this: Pinging 192.168.6.1 with ...
0
votes
1answer
24 views

Should System.nanoTime() in Java be explicitly casted to a double for game loop?

I am writing a game loop in Java and trying to calculator deltas. When attempting to get the current time, the following does not give me an error in my IDE. However the function returning a double, ...
0
votes
1answer
58 views

Getting positions of static entities in a Tiled Map

I'm creating a 2D game that uses a Tiled Map with an underlying 2D array to store where entities are in the world. At the moment, I'm just creating one instance of an entity, assigning it a number, ...
1
vote
2answers
68 views

How can check a collision between 2 non-axis aligned boxes?

I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return trueor false, no physics involved. I started working and couldn't find an algorithm that ...
0
votes
1answer
17 views

Triangle data structure not working for LoD algorithm

I would like to implement a LoD algorithm to my 3D game in order to simplify meshes at certain distances from the player. My meshes are created / loaded using a VBO, so the vertex data is stored in a ...
1
vote
1answer
26 views

How do I query a LibGDX Box2DLights “light” and “dark” regions?

I have lighting implemented using Box2dLight. I want to update/render things inside the player's PointLight area. Stuff in the dark area should not be rendered. How can I find which areas are lit or ...
1
vote
1answer
24 views

LibGDX viewport touch coordinates transformation

I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me. I have a game window of 840x480 units with ...
1
vote
0answers
41 views

Libgdx performance on old devices

I'm developing a game in Java for Android, using LibGDX. I'm using Nexus 5 to test my game most of the time and it works great (Minimum FPS it gets is 57 out of 60). Recently I ran my game in Galaxy ...
0
votes
0answers
18 views

GLFW/LWJGL black screen flicker issue

Im having a problem with creating a borderless fullscreen window in LWJGL using GLFW. It creates the (in this case black - as intended) window, however when the focus changes (f.e. tabbing int/out), ...
7
votes
1answer
156 views

Tiling perlin noise seamlessly, but without repeating to generate an infinite 3D world

I have been working on a 3D game in java using LWJGL for a while now. I am trying to make procedurally generated infinite 3D terrain that is generated around the player. So far I have: 3D terrain ...
1
vote
4answers
52 views

OpenGL calls from a different thread?

I understand OpenGL is not thread-safe, but at the same time, Google seems to be giving me mixed responses. I have a LibGDX game that functions normally, UI/rendering/logic on the same thread, ...
1
vote
1answer
32 views

libGDX: Why doesn't Gdx.input.isKeyJustPressed() work?

I'm trying to use the method Gdx.input.isKeyJustPressed() to check if the Android BACK button was just pressed. I don't want to use the Gdx.input.isKeyPressed method to avoid multiple calls. Here is ...
0
votes
0answers
25 views

How to “pause” stage actors listeners

I have a problem with multiple stages and listeners in libGDX. I have GameScreen with gameStage (contains game elements), uiStage (score label and pause button) and pauseStage (resume, restart and ...
1
vote
1answer
37 views

How can I add a transparent overlay to a UI in libGDX?

I am attempting to use the following code shapeRenderer.begin(ShapeRenderer.ShapeType.Filled); shapeRenderer.setColor(3,3,3,.3f); shapeRenderer.rect(0,0,gameWidth,gameHeight); ...
1
vote
1answer
36 views

Objects phasing through each other in physics engine

I'm writing my own physics engine right now (following this tutorial), but I'm running into some problems. Sometimes on collision, objects will just phase through each other instead of bouncing off of ...
3
votes
1answer
63 views

Does libgdx implement the game loop for you?

Initially, I assumed that the developer has to implement the game loop because libgdx is a library - not an engine. But then I found out that Graphics has getDeltaTime() and getRawDeltaTime() so I ...
5
votes
1answer
243 views

Why does flipping 1 texture region cause an identical texture region to also be flipped? (libGDX)

Sorry for the bad title. I didn't know how else to explain it. The following is a portion of my code: public class AssetLoader { public static TextureAtlas spriteSheet; public static ...
0
votes
0answers
18 views

boost/geometry replacement in Java/for the JVM (Destructable Box2D terrain)

I'd like to reimplement https://github.com/seemk/DestructibleBox2D in Java. The main problem is finding an adequate replacement for the boost/geometry library. Any ideas?
0
votes
1answer
20 views

Displaying Images Correctly

So, I've been working on several smaller game project in past few months, and I've got the hang of game dev in java. Now I'm trying to optimize game performance. Is it ok to simply use ...
1
vote
1answer
35 views

libgdx Vector.cpy question

Why do people use this: public void set(Vector2 v) { this.vector2 = v.cpy(); } insted of just using: public void set(Vector2 v) { this.vector2 = v; } What I don't know that I should ...
0
votes
2answers
40 views

Java how to rotate an image towards a certain point?

Hello I have a game where a spaceship flies towards a different point every time I press a button. I am able to rotate the image but I don't know how to rotate the image to face the direction it is ...
1
vote
0answers
20 views

Scale smaller resolution to full resolution libGDX

Short question about the scaling in libGDX. At the moment i have a application with the resolution 480x320. I define this in the main method of the desktop launcher. My whole application is now ...
-1
votes
0answers
16 views

java How to rotate an image? [duplicate]

Hello I have a game where ships move from point a to point b. point a and point b are always moving so I draw a line between them and the ship follows the line. I want to be able to rotate my ship to ...
0
votes
0answers
12 views

How To Make ModPE Perform Function The First Time Mod Opened

I am making a Minecraft PE mod and I want to set a variable only on the first launch of the mod. So, how do I make it it set the variable and then not set it again until I import the mod again. ...
1
vote
2answers
57 views

Java Game how to make image follow line?

Hello I have a game where circles rotate around the centre of the frame. When I click on two circles a line is drawn between the two circles. The circles are always moving and so is the line. I have ...
0
votes
1answer
33 views

AssetManager proper usage in libgdx

I am a beginner in libgdx and I am coding a simple game. This game is like a word puzzle where each letter is a texture. Before loading the first level I need to load into memory 26 textures, one for ...
0
votes
0answers
19 views

Raycast trouble

i'm having some trouble with the RayCast. I'm raycasting from the player position and my mouse position. I have this situation : http://i.imgur.com/h7iplnY.png (the white line is a representation of ...
2
votes
1answer
50 views

Drawing textures off screen optimization required?

I recently started using LibGDX and I am wondering if I have to optimize my code when drawing textures/sprites off-screen, just like I used to do with XNA. My biggest concern here is specifically ...
1
vote
1answer
66 views

How to use mipmap with TextureAtlas and AssetManager

I searched on the Internet but couldn't find the way to use mipmaps with libGDX TextureAtlas. I want atlas instead of normal textures because as far as I know mipmap supports only 2^n width and height ...
1
vote
0answers
28 views

How to render/load world chunks? (Java) [closed]

I am developing a top down 2d rpg called "MasterQuest", using Graphics2D in java. Most of the code that I have written has come from my own head, and this is really the first time that I have had the ...
0
votes
1answer
40 views

Stop rendering hidden objects libgdx

I currently am hiding objects that are not in the frustums view. However, some objects are still being rendered that are in the frustums view, but are hidden. My goal is to not render objects that ...
0
votes
0answers
37 views

Minecraft Modding - How do I use OpenGL stencil functions alongside the game's GlStateManager?

Note: I am using Minecraft Coder Pack 9.10 for game version 1.8.0 (official release). I am trying to make a multiline text field similar to the game's original net.minecraft.client.gui.GuiTextField. ...