Java is both a popular programming language and runtime environment which allows Java programs to run unchanged on most hardware and software platforms.

learn more… | top users | synonyms

1
vote
2answers
85 views

How do I scale a rectangle image while retaining its border thickness?

I want to create a programmatically scalable image like this: scales to . Both have a one pixel border. If I scaled from the first to the second in Paint.NET, there would be a two pixel horizontal ...
5
votes
4answers
494 views

Does Unity let you code in Java?

I am fairly new to Unity3D experience , but I have a very good knowledge of Java and Android development. I am really confused that if Java is at all needed for developing android applications? I read ...
2
votes
1answer
134 views

In Slick2D, how can I generate a 2D platformer map from an image?

I'm fairly new to game development. I've been messing around with Slick2D. My map consists of rectangular objects. I want to use an image to represent my map, similar to this: How could I generate ...
0
votes
0answers
57 views

How to create a 2D overlay over a 3D game? (LWJGL/OpenGL) [duplicate]

GameDev! I would like to create a 2D overlay over a 3D world, using LWJGL (Java version of OpenGL), to show information to the player, for example, a chat box, health bar, selected cannonball type, ...
1
vote
1answer
135 views

Bullets won't shoot out of barrel in top-down shooter

So I am working on a top down shoot and have been stumped on why my bullets refuse to come out of the barrel of the gun. I know about the rotation equation which is x2 = x * cos(theta) - y * ...
7
votes
2answers
651 views

How can I make a snake's tail follow the head?

Following an assignment and just getting started with libGDX by building a small Snake clone I've run into an issue that I'll probably be ashamed for in a little while. I currently have a snake's ...
-1
votes
2answers
82 views

How to implement “move to touch location” function?

What is the formula/logic to implement moving an object towards a TOUCHED location. I want character A to move to my finger and it must be accurate. Here is what I have tried so far: @Override ...
1
vote
1answer
158 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
2answers
146 views

Driver inversion

I have a GUI game, which is driven by user every time it clicks the mouse. Every time user clicks a square on a board, the board state is updated (we re-compute the score, the player to make next move ...
1
vote
1answer
199 views

What alternatives are there for creating Keyboard/Mouse controls in LWJGL?

So I'm currently working my way through openGL tutorials, using LWJGL to do all my work in. However as I get to the part on how to access Keyboard and Mouse events in this library, I stumble across ...
0
votes
0answers
165 views

Adding 2d hud/gui to a 3d game engine which has no 2d features

I have been following the 3d game engine tutorial series made by theBennyBox for a few months now, and have finally decided to create a game with it. My problem is that it is a 3d only engine which ...
1
vote
0answers
57 views

Structure gameobjects and call events

I'm working on a 2D tile based game in which the player interacts with other game objects (chests, AI, Doors, Houses etc...). The entire map will be stored in a file which I can read. When loading the ...
0
votes
0answers
56 views

Cube projection composed of smaller cubes not lining up

I am trying to make a cube projection composed of other cubes, similar to a Rubik's cube but completely static. I can get one cube to work, but when I join multiple, they don't line up. I am using ...
0
votes
1answer
70 views

Minecraft Modding Errors (.java to .class compression errors) [closed]

Recently I started making a personal modpack. I ran into a block ID conflict and decided to fix it. I figured out how, and managed to change a .class file to .java so I was able to edit it. Now comes ...
0
votes
1answer
105 views

Parse and iterate over SVG path

I need to parse a SVG path expression like m8,295c-4,-292 441,-291 446,-26c5,265 440,263 442,-9 and have a way of iterating over it in [0 ... 1]. I looked into Apache Batik but it doesn't seem to ...
2
votes
1answer
65 views

RGBA values not coming as intended | LibGDX

As it states, my RGBA values aren't coming out the way I want it to be. My RBGBA values are As it states, I am trying to create a orange tinted color on my game. 221, 189, 98, 0.7 I am using a ...
1
vote
1answer
101 views

[ C# ]xna to monogame

I'm thinking of going back to xna and c# because I have used java 2d, slick 2d and some other libraries. I started off with xna and c# but ignored it for java. I'm thinking of going back, but I see ...
2
votes
2answers
109 views

View-Update versus Model-update

I am creating a game using a relatively new platform called "codenameOne", but I'm actually a software engineer, so this question might be rather basic or odd, but I'm unsure what to do. The game is ...
0
votes
1answer
55 views

java slick2d - key press being ignored

I have the following in my update funtion. The first input for key_enter when textPos!=2 works fine, but the one when textPos==2 doesn't work. The key up and down work fine though. The ...
1
vote
1answer
76 views

Libgdx Box2d createfixture crashes vm intermittently

I have a hard to debug problem. I have a Box2D game which creates a wheeled vehicle. I want the vehicle body to reflect when it goes from moving left to moving right. to do this i set a flag in a ...
0
votes
1answer
105 views

Why does my character move up forever when he jumps with this code?

I've been doing some stupid stuff in Slick2D+LWJGL and I've run into a problem. I press the UP arrow and my character continues to go up until I let go :/ Here's the code: if ...
0
votes
1answer
71 views

my movement is working good on keyboard but on android its not

So basically here is what my movement is like for keys: key down if (keycode == Keys.LEFT) { mishi.getAcceleration().x = -13; } key up if (keycode == Keys.LEFT) { ...
1
vote
0answers
37 views

java slick2d - gettileproperty returns true when it shouldn't

I'm trying to implement some collision detection to a test game i've been making. I've used TiledMap to create the map and set a property on one of the tiles to blocked=true This tile is then drawn on ...
1
vote
1answer
75 views

Get the game state using Multithreading in Java Monkey Engine 3

I’ve been trying out Java Monkey’s multi threading recently via the wiki’s tutorial. Since I just wanted to test a prototype clinet, I made a program which creates some cubes using the ‘Cubes’ library ...
2
votes
2answers
355 views

android game development using unity 3d [closed]

I want to learn android game development. I dont have any programing knowledge. So should I learn JAVA and eclispe to develop games for android. Or should I learn Unity 3d. And is knowledge of java ...
1
vote
0answers
185 views

Checkers make move and take move algorithm

I'm coding a checkers game and I encountered a problem and I'm 99% sure is about how the move is done and taken back. The structure of my game data is: an 8x8 array containing my board squares. ...
0
votes
1answer
62 views

JBox2D bodies don't collide?

I have two objects. A dynamic player and a static ground object. It was working for a while until I did some refactoring and suddenly my play falls right through my ground object. Is there anything ...
0
votes
0answers
21 views

How can I avoid duplication of jBox2D physics attributes?

I'm using jBox2D for physics and collision detection in a game engine with an entity-component system. It works, but I'm unsure how to structure my code with respect to the values represented in the ...
1
vote
0answers
78 views

How to write a global GameState manager for a game in Java [closed]

My implementation is written in Java: public class GameState { public static String state = ""; public static void setState(String state) { GameState.state = state; } ...
0
votes
0answers
17 views

how to construct an efficient game loop and add graphics to it [duplicate]

I am reading killer game programming in java and reffering to foriegnguymike on youtube. I think my game loop is ok but someone said not to use thread.sleep() and i'll work on it. For now based on ...
1
vote
1answer
73 views

Preventing rapid inversions of boolean on Collision detection

I know this is both a strange question and a stupid question. But this is an issue I have dealt with in every single game I've made, and I have yet but to find a solution. I can't be the only one ...
0
votes
2answers
152 views

Java: Camera Rendering

Which is the best way to detect whenever an object or tile is inside the Camera Range so I can draw it? With "best" I mean more efficient, and quicker. Thanks
-1
votes
1answer
70 views

Java application: How to play sound [closed]

Hello I have a game that has a title menu and I want to play music in the title menu. The game is an application NOT an applet. (and I'm not changing it) I saw a video where he uses sun.audio pckage, ...
1
vote
1answer
78 views

Physics like asteroides [closed]

I try to make a ship that has the physic properties like asteroides. I have this for now(All in Java): Ship.class public class Ship { public static final float sMaxHealth = 0.1F; ...
2
votes
1answer
37 views

Saving resource

I'm trying to develope a simple platformer on Java, I was wondering if is it better to handle the collissions in a level (player with floor, player with enemy ecc...) by a level handler class which ...
0
votes
0answers
105 views

Collision in Tiled Map - LibGDX

I have collision code that deals with left or right or top or bottom. I am using Tiled Map with LibGDX. Question is: How do I detect collision with other cells by all 4 sides, and not specifically ...
0
votes
1answer
112 views

LWJGL Resize window and glTranslate breaking screen resolution

I'm trying to make a 2D Tile RPG game with LWJGL but I'm having a problem with the display resizing. I want the user to be able to re-size the window to whatever size they want just by expanding it ...
1
vote
1answer
251 views

How do I combine images into a single entity in libgdx?

I've googled this but can't seem to find anything on "concatenating" two images, especially with libgdx. Any ideas?
0
votes
2answers
78 views

Negamax Checkers not working properly [closed]

I'm trying to implement negamax in my checkers game. Sometimes the IA does the appropriate move, sometimes don't. Here is my code: private int evalPawns(ArrayList<Pawn> pawns, int turn){ ...
0
votes
0answers
66 views

Incorrect click event when resize on libGdx

I want to use scene2D, in libGDX, to detect click on object. I have this simple Game sample : Stage stage; @Override public void create() { this.stage = new Stage(1280, 720, true); ...
0
votes
1answer
83 views

Player doesn't jumps in Box2D implementation [closed]

Well, i'm trying to learn andEngine. I was able to successfully implement the move functionality for the player. Now, i'm trying to make the player jump using Box2D. I referred few online tutorials to ...
0
votes
1answer
74 views

JBullet - Detecting when 2 objects collide?

How can I detect when 2 collision objects collide with JBullet? Currently, all body types are going to be of type RigidBody. I have quite literally been trying to find the answer of this for over 2 ...
0
votes
1answer
94 views

Playing repeated sound in Java

I'm trying to play sounds in a Java game with the following code: AudioStream audioStream = new AudioStream(stream); AudioPlayer.player.start(audioStream); The stream variable is just an ...
0
votes
0answers
60 views

Using multiple uniform blocks in OpenGL

I'm using OpenGL with JOGL and want to use two unfirorm blocks in my vertex and pixel shaders. The following GLSL-Code shows the definitions:- uniform perObject { Material uMaterial; mat4 ...
0
votes
2answers
179 views

Do Java and Actionscript use OpenGL?

As far as I know there are only 3 base graphics libraries on Windows, the GDI, OpenGL and DirectX, is that correct, so that means that Java, Actionscript and all language use one of these 3 libraries ...
0
votes
0answers
32 views

GWT problem with Box2D WheelJoint

I am using the below libgdx java code for a wheel joint and rear axle using Box2D. This works fine for android, Desktop, but when I attempt to run through GWT I get the following error. at ...
0
votes
1answer
117 views

OpenGL ES 2 jittery camera movement

First of all, I am aware that there's no camera in OpenGL (ES 2), but from my understanding proper manipulation of the projection matrix can simulate the concept of a camera. What I'm trying to do ...
0
votes
2answers
93 views

Smooth input handling in Java [closed]

I am writing a Java game. My problem is to get a really smooth input. If I hit the key W the character has to go forwards, but if I hit A and release the W key, the character doesn't go left ways :( ...
3
votes
1answer
181 views

LibGDX How to take screenshot and use as background for pause screen

So I am trying to take a screenshot of the current situation during the PlayState of the game and when the player pauses the game I want the game to take a "screenshot" save it in memory and not as a ...
-1
votes
1answer
137 views

Slick2D: Resizing the Window

I am using Slick2D, and I wanted to know which is the best way to resize, maximize, minimize the window, For example, Resizing all the images or scaling them, or Slick2D has an integrated method, Any ...