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
40 views

keylistener and synchronization

i have this code: public final class PlayerInput implements KeyboardInputHandler{ public static final int INVERTED_AXIS = 0; public static final int NORMAL_AXIS = 1; private Sprite sprite; private ...
2
votes
1answer
99 views

In JBox2d when dragging a Body, why is the direction is flipped vertically?

Why is it when I drag a JBox2d Body with the mouse, the vertical component is flipped? e.g. If I drag down-right, the Body moves up-right. Is this expected behaviour, a bug in JBox2D, a Mac ...
-3
votes
0answers
21 views

Java chess game [closed]

I am making a chess game in Java like MyChessmate: https://github.com/melvic-ybanez/my_chessmate/tree/master/src/mychessmate I am implementing the OOP concepts and would like to know how I can ...
0
votes
1answer
26 views

Libgdx - changing tiledmap smoothly, Tween engine maybe?

First question here, so bare with me if I make a mistake or two. Long story short I'm currently developing a side scroller game in java with libgdx, which uses tiledmaps from the tiledmap creator ...
0
votes
1answer
144 views

Moving a Polygon based on Camera position

I am in the process of implementing TMX Maps (made in Tiled) for my game. In Tiled, I can create polygons, which leaves a tag, containing the points. Loading in these points to a Polygon ...
0
votes
1answer
14 views

LibGDX - Shader not being applied

I've recently encountered a strange problem with my program and I can't seem to fix it. When I try to apply a shader to my SpriteBatch it doesn't change. I've debugged this problem like so: if (test) ...
1
vote
1answer
37 views

How to jump in Box2D with LibGDX

I am making a 2D platformer in LibGDX with both Ashley and Box2D. I have it so, that the PlayerControllerSystem watches for the jump key being pressed: // Jumping if ...
1
vote
2answers
403 views

LWJGL: Camera distance from image plane?

Let me paste some code before I ask the question... public static void createWindow(int[] args) { try { Display.setFullscreen(false); DisplayMode d[] = ...
1
vote
1answer
184 views

Java Reversi/Othello - Checking if Valid move

I've written a gameBoard class for a Reversi/Othello which is the following: import java.io.Serializable; public class GameBoard implements Serializable { private static final long ...
1
vote
0answers
36 views

How can I connect multiple explorable regions into one large map? [closed]

I am planning a 2-D science fiction game involving spaceships. A major thing that I am having trouble figuring out is how to create a 2-d array of smaller maps that the player can explore. My ...
1
vote
0answers
44 views

What is the most efficient way to store world data for a 2D tile game? [closed]

I'm working on a 2D tile based survival game for my programming class and as I was working on GUIs I realized that I would need an efficient way of storing and recalling not only the tile data and ...
1
vote
1answer
31 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 ...
0
votes
2answers
76 views

Render terrains depending of the player position (Chunks)

Well, I have an array with all the terrains. How do I render them? I just add them to a List of terrains that are sent to the Renderer. There, every terrain of the list is rendered. The problem is ...
0
votes
3answers
65 views

LibGDX simple button with image

I want to make two image buttons (play, restart) in my main menu screen but I dont know how to do it. I tried this: Texture playTexture = new Texture(...) Image playImage = new Image(playTexture) ...
1
vote
1answer
120 views

How to detect if two sprites are being touched at the same time?

I tried this: if(spr.getBoundingRectangles.contain(x,y)){ //do this } but how to detect if the other sprite is touched by the second pointer? Then I created two Vector3 for the pointer ...
2
votes
1answer
2k views

Calculating trajectory

I'm just starting with game development and some physics related to that. Basically I want to calculate a trajectory given an initial velocity and as well as an elevation / angle. So I wrote this code ...
0
votes
0answers
24 views

HorizontalScrollView with multiple views in one “frame”

I have ImageButton, with TextView and ImagaView inside it. I have six of these. So I want to implement them into HorizontalScrollView. I remember I had one HorizontalScrollView with images some time ...
1
vote
1answer
90 views

LibGDX - How to export a texture as a .png onto, say, the desktop

I'm making a game in which I need to export a texture which the user has edited as a .png into a specified location. I'd like it if I could have the default saving window thing (like on other apps ...
0
votes
1answer
142 views

Is the standard collision detection in Slick2D too heavy for broadphase?

I was wondering two things about the built in shape detection of Slick2D. When executed on a lot of shapes, how performant are the intersects and containsmethods, and what kind of algorithm is behind ...
1
vote
1answer
119 views

Getting the tile over wich the mouse cursor is

Im making a tilebased game, I have the rendering, the main engine, everything setup nicely (btw Im using LWJGL and Slick). Now this is more of a math question. How do I get the tile the mouse is on, ...
0
votes
1answer
99 views

libgdx - Math for wall collision when adding velocity

I've created a game which spawns a random colored ball in the top or bottom of the screen and moves to random direction with this method. private Vector2 position; private Vector2 velocity; private ...
1
vote
1answer
35 views

Java- Trig based movement

I have been trying to create a smooth movement technique that would allow me to move in all directions, not just the 8 cardinal directions. I have tried to use this doing trig, and while the ...
2
votes
2answers
745 views

LibGDX - Rendering things in different classes

thanks for your time! I'm really new to LibGDX (and Java itself). Which approach should I use to render my different game parts? I want to show a background, the main character, a bunch of enemies ...
0
votes
1answer
146 views

Java - LWJGL OBJ Loader with Materials not rendering

So I successfully loading my obj file but I obviously want to get materials on it. I added the vt(texture) to the OBJLoader and the Model.render but still rendering textureless. I have exported the ...
1
vote
1answer
53 views

Canvas doesn't draw

I've set app view on XML based layout: setContentView(R.layout.mlayout); with some views objects on it. Then, I added another view via: RelativeLayout layout = (RelativeLayout) ...
4
votes
2answers
320 views

Smooth 1D terrain generation

So I'm pretty happy with my terrain, and the progress on my game. I just want to figure out why the terrain is so steep sometimes. Right now to generate my random seed I use this: seed = ...
0
votes
2answers
293 views

Mouse coordinate conversion Libgdx

I have a camera: //Map is a my object that wrapper of TiledMap class In the create method: this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap(); this.camera=new OrthographicCamera(); ...
1
vote
2answers
1k views

keyPressed is not working after adding ActionListener to JButton

I have a serious problem while trying to build a menu for my game. I've added two JButton to a main JPanel and added an ActionListener for each of them. The main JPanel also contains the game JPanel ...
1
vote
1answer
613 views

Random Sprite Speed

I followed the Rain Catcher tutorial from libGDX and I made some modifications to the code, allowing the rain drops to appear faster. But I cant figure out how to make the raindrops fall at random ...
8
votes
4answers
4k views

Looking for JMonkeyEngine tutorials and documentation [closed]

I'm looking for tutorials and documentation for JMonkeyEngine, beside the material on the official website. Any clue?
-2
votes
2answers
363 views

Absolute newb Java programmer seeks “dumbed-down” tutorials/resources [closed]

I understand the basics of Java and Object Oriented Programming so far, and am still working on refining my understanding of it. I have sought several different resources - two books and Oracle's own ...
2
votes
3answers
6k views

Where can I find tutorials for LWJGL? [closed]

I don't know if this is against the FAQ so if you close this, it'll be no surprise. I have done research but all the tutorials I have seen have been to hard to follow; I reckon there are better ones ...
1
vote
1answer
2k views

JMonkeyEngine in Eclipse

I wanted to try the JMonkey engine, so I downloaded the JMonkey sdk, but I don't want to work in the JME IDE, I would rather like to work with Eclipse, since I already started a game project there, ...
0
votes
1answer
687 views

Break a learning barrier with Java + LWJGL [closed]

I have been coding with Java and LWJGL for some time. I mainly use thebennybox's tutorials, but I can't always remember the 3D rendering. But even when I have a 3D rendering models, planes, cubes, ...
1
vote
1answer
533 views

How to use LWJGL Vertex Buffer Objects?

I have been learning how to make a game with LWJGL for a while now by following YouTube tutorials online but I've recently been having a problem understanding Vertex Buffer Objects. I've looked at ...
2
votes
0answers
38 views

Pre-existing voxel tools/libraries for Java [closed]

I want to do some development using voxel data as well as rendering it. My interest is more in the project its self, rather then things like working out rendering optimization techniques and working ...
1
vote
2answers
249 views

Accelerometer problems

When I hit an object, my Fighter is supposed to fall to the Ground. BUT, because of the Accelerometer, i can still move it up and down eventhough it died. The Scroller on the x-Axis though stops. ...
0
votes
1answer
26 views

Position of an object relative to another in a 2D plane

I have two objects, A and B, each of them has a set of coordinates (x,y). How do I understand where is A in relation to B's position? If I where to just check each coordinates I could do it like ...
0
votes
1answer
93 views

Map coordinates to camera coordinates

I have a tiled map which is 3 times higher than camera. When I press on a tile, I want an actor on that tile to show up. This works if camera is not moved. If I move camera a little bit up, so the ...
0
votes
1answer
21 views

How do I know if the ad is open while the use pressed the back button?

I am trying to reward a user a point whenever they watch/look at an ad. I give the user the reward whenever they watch the ad. However, the user earns a point even if they go to the ad and click back: ...
1
vote
1answer
129 views

How to map texture to shape in Slick 2D

I need to map texture to shape. Texture: This is a example of shapes I need to map texture to: Notice that each piece in mesh has exactly 4 point to map texture. Logic is pretty straight ...
0
votes
1answer
188 views

LibGdx - How can I correctly handle tile transitions / connected textures?

So I am making a tiled game and I need to connect textures correctly based on whats next to it. With tiles that had connection really close to the edge of the tile I could just use the 4 bit meathod ...
3
votes
1answer
87 views

LibGDX: Is it necessary to set a stage as an input processor when creating a touchpad?

I mean, I've been searching it, they always use set a stage as an input processor after they had added the Touchpadto the Stage because it extends from Actor indireclty(it extends from Widget that ...
1
vote
1answer
63 views

How do you create a funky moving background?

I'm trying to create something similar to what you would see if you loaded a song in Windows Media Player (the cool abstract background that moves and produces various colors). I have no idea how this ...
4
votes
1answer
134 views

RAM usage unusually high, but CPU usage relatively low

I've created a relatively simple game using libgdx, but the RAM usage when I start up the game on my Android device is roughly 600-700 mb, but the CPU usage is only about ~0.05%. I've downloaded a ...
0
votes
1answer
50 views

onHold input libGDX

I want to have onHold or onTouch input for my game. So as long as the user touches the screen something happens (a car moves) and when he stops touching the screen it stops. How do I do that? I want ...
1
vote
1answer
395 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
1answer
56 views

2D BoundingBox Collision Detection Problem

I implemented collision detection into my game (using Bounding Boxes) The character is floating above the blocks instead of standing on them. I know what is happening, but I can't figure out how to ...
0
votes
0answers
13 views

Actions.fadeOut doesn't work when called on stage root

I'm trying to fade out my screen when a button is pressed, but the following code doesn't work: public void switchScreen(final Game game, final Screen newScreen){ stage.getRoot().getColor().a ...
-3
votes
2answers
75 views

Is it possible to use Java as a scripting language in unity? [duplicate]

I wonder if its possible to use Java as a scripting language in unity to create a basic 2d game?