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
1answer
15 views

Java 2d: How to make animation only cycle once, despite control being held down?

I've been working on a 2d game, and I think I've been over-complicating how to make an animation only cycle through once. For example, if the user presses the 'a' key, the character's 'attack' ...
1
vote
1answer
88 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
19 views

X, Y, Z rotation around camera

I'm making a 3d orthogonal-projected, game using painters' algorithm in java. I'm able to rotate the objects with incremental rotations (e.g. rotate all objects 10 degrees) using affine ...
0
votes
1answer
59 views

Weird inheritance hierarchy?

In my RPG, all Food objects should be possible weapons. For instance, I want the player to be able to to try kill bunnies with a cherry or a watermelon. The problem is that the easiest way to do this ...
1
vote
2answers
65 views

How do I ensure my skybox is always in the background, with OpenGL?

I created a skybox in OpenGL (through LWJGL), but the only way I found to render it behind all objects was to make it very big. This leads to ugly edges between the 6 skybox planes. Optimally, I ...
1
vote
1answer
432 views

Including slick2d or slick-util in maven build?

I'm converting a project to lwjgl and trying to use slick-util as well. There's no slick-util maven repo anywhere (nor slick2d itself anymore). I've included local dependancies before using ...
0
votes
1answer
39 views

Huge delay in a client/server

I'm working on my java game with Libgdx and i'm having some trouble with the online part. I can create a server, make multiple client connect on it but there is a huge delay between the player input ...
1
vote
2answers
59 views

How to create Whirlpool/Vortex effect?

Im trying to make a Vortex effect on a Circle Body that is a Sensor. I've been looking for this and all examples i look for are in C++ or Objective C and i dont seem to translate them well. when my ...
0
votes
1answer
49 views

How could I implement 3D player collision with rotation in LWJGL?

I have a problem with my current collision implementation. Currently for player collision, I just use an AABB where I check if another AABB is in the way of the player, as shown in this code. (The ...
0
votes
2answers
59 views

How could I host my multiplayer servers?

I have a question. How could I host my multi player game? To be more descriptive, I am developing a 2D online game. I want there to be a server list, where the player can see all of the currently ...
0
votes
0answers
23 views

How to take a screenshot with java from directX

I'm looking for a way to take a screenshot with a Java application of any running directX game. I use the following code Robot robot = new Robot(); GraphicsConfiguration config = ...
0
votes
1answer
43 views

How can I make an soundsystem with slick?

My Question would be , how can I develop an easy-to-use Soundsystem under slick-util? Under the function a.playAsSoundEffect(1, 1, true, x, y, z); it allready works to create a static ...
1
vote
1answer
62 views

Save a mouse coorinates after a specific number of seconds

I have a specific method that saves my mouse x and y coordinates. I want that mouse coordinates be saved by specific time (for example after 1000ms). How I need to do that in Java? Please add a simple ...
1
vote
1answer
62 views

Dynamic object creation with HashMap

I want to use a HashMap to dynamically create objects based on the key. I have a Random Map Generator that stores the maps in 3D Arrays of Type Integer[][][]. Upon creation of the actual map I ...
4
votes
1answer
67 views

Large 2D Arrays Causing Garbage Collection

I've been working on a game in Java that, for this post's sake, looks like Terraria and has random world generation. I've been using Vectors to contain my tile/block objects, but recently due to the ...
1
vote
2answers
151 views

How to achieve a Gaussian Blur effect for shadows in LWJGL/Slick2D?

I am currently trying to implement shadows into my game, and after a lot of searching in the interwebs I came to the conclusion that drawing hard edged shadows to a low resolution pass combined with a ...
0
votes
1answer
60 views

LibGDX - Textures rendering at wrong position

Update 2: Let me further explain my problem since I think that i didn't make it clear enough: The Y-coordinates on the bottom of my screen should be 0. Instead it is the height of my screen. That ...
1
vote
1answer
36 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 ...
0
votes
2answers
1k views

How to update libgdx scene2d Label text dynamically?

I display a BitmapFont on the screen, update its text and the font is updated dynamically on the screen as well. I seem to fail to do the same with a scene2d Label added as actor to a Stage. The ...
0
votes
1answer
226 views

problem adding bumpmap to textured gluSphere in JOGL

I currently have one texture on a gluSphere that represents the Earth being displayed perfectly, but having trouble figuring out how to implement a bumpmap as well. The bumpmap resides in ...
0
votes
1answer
195 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
76 views

Design pattern for animation sequence in LibGDX

What design pattern to use for sequence of animation that involve different actor in libGDX. For example I am making a game to choose a wolf from a group of sheeps. The first animation played when the ...
0
votes
1answer
108 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 ...
1
vote
1answer
70 views

How to resize my 2d game to fit the screen?

I am currently making a 2D game using Java (Java 2D). I want to make my game resizable. If you play any game on an emulator (e.g. legend of Zelda in fceux emulator) in full screen mode, you'll see ...
0
votes
1answer
30 views

Predicate methods and not logically related fields

After getting something up and running, I want to do some refactoring (to improve extensibility). From this, two problems about composition and design arose: If Creature have a public getHealth and ...
3
votes
3answers
169 views

Inventory implementation in Java RPG

In my game (simple RPG with Java) there will be an abstract class Creature. Critter, Beast, Vampire... will inherit from Creature. But not ALL classes that inherit from Creature will have an ...
0
votes
2answers
167 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
0
votes
4answers
128 views

Is there any way to load pieces of a tile-map as and when needed, and not the entire map at once?

I created a tile-based rpg game in java, but it runs really really slow, the reason is the big tile-map that is stored in the buffer. Is there any way to programmatically load pieces of the map when ...
2
votes
2answers
2k views

Menus for LWJGL - Swing or other? [closed]

Okay so I want to create a main menu which includes several buttons and text fields, is there a built in library for LWJGL or would I use normal Swing and start a thread of the application? Its a 2D ...
-3
votes
1answer
67 views

What's wrong with my step-toward-target implementation?

I want to move a game object from its current position toward the mouse position. I wrote this Vector2D class to help me: public class Vector2D { private double xVect; private ...
0
votes
2answers
57 views

How would I start my multiplayer game? (JAVA) [closed]

I'm Bryce. I'm trying to create an online game. To give you an idea on what scale I am imagining this game to be at, I'm basically recreating Notch's cancelled game, 0x10c. I'm here to ask: where ...
0
votes
0answers
27 views

Collision detection bug in java applet

In my maze game applet I'm having a little bug. Collision detection works but sometimes my character can go into walls. More precisely it detects collision and moves the character into the wall. It ...
-1
votes
0answers
16 views

TextureAtlas issue get texture

I have a texture atlas and I want to get a specific texture in it by name, but I get all textureAtlas with all texture. Why? This is the code: this.textureLeft= ...
0
votes
1answer
56 views

Tiledmap rendering [closed]

I want to hide and make visible the tile map based on a condition, the tiledmap top is visible then I want to hide and then make it visible again I've implemented in the following way: //map object ...
1
vote
1answer
159 views

Random lines away from images in java2d opengl game

Working on a java game that uses some pngs images for icons/textures. A few images ( fewer than 5, out of dozens ) are showing some odd parallel "artifact" lines. They move with the image, are ...
1
vote
2answers
108 views

2D Lighting Glitch

I've been working on a game in Java, and recently I decided to try out my game on a netbook just to see how it would run. While I do get a constant and decent FPS, it appears that my lighting ...
-4
votes
0answers
48 views

Please recommend any API to write bot on WIndows [closed]

What API exist to write bots for internet games like Diablo III on windows box. Where all data exist on remote server. Ideally if api is written in java. But C# is also OK.
1
vote
3answers
92 views

How to handle network game [closed]

I'm currently building my own game using LIBGdx in JAVA but i'm facing some trouble. My game is base like this : A player have a position and some other parameters that are float, int types. He also ...
-1
votes
0answers
19 views

getting sprite coordinates of mouse position java slick2D tiled map [closed]

How to get sprite coords of mouse position? Game engine Slick2d. Tiled map 16x16. Camera public class Camera { public int x, y; Object object; public Camera(int x, int y) { this.x = x; ...
2
votes
0answers
45 views

Edit spawn location according to vector direction

I'm trying to make a turret in Bukkit (Java). This will shoot an arrow to the players that are in the shooting radius. But now I've a little problem, the arrow gets stuck inside the block where its ...
1
vote
1answer
83 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 ...
0
votes
2answers
99 views

Recommended approach for event system in Java

What are the recommended approaches for an event system of a turn-based RPG's battle engine? The system I'm currently working on has a runEvent method that sorts the actions queue based on their ...
0
votes
1answer
73 views

Too much delay while sending object over UDP to server

I'm getting 4 sec delay when sending objects over UDP. Working on small game and trying to implement multiplayer. For now just trying to synchronize movements of 2 balls on the screen. ...
0
votes
1answer
28 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
votes
4answers
156 views

How/where to generate RPG world?

I'm programming an RPG in java. It's text based, so movement is more or less from "room" to "room." In the case of cities, they will generally be one room, with some sub rooms for important shops and ...
0
votes
1answer
46 views

Collision bug with gravity in slick2D

I have fixed some of the previous problem. The collision when running into a corner(a wall on two sides) however is still not working. When the player runs into a corner he just falls down and out of ...
0
votes
1answer
27 views

LibGDX - Accelerometer Problems

I got some issues. I'm using LibGDX. 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 ...
0
votes
1answer
51 views

Moving a tiled map in a jframe

I rendered a tiled map, with the help of slick2d, in my JFrame in Java. I can move my main character, but it is just that the character itself moves. I would like to do it that, if the player moves, ...
2
votes
3answers
894 views

How to draw a rectangle or curve between two co-ordinates in libGDX

I am new to libGDX.I just want a Rectangle or a small curve drawn between the object and the clicked position .I know libGDX has RECTANGLE class. I just want to draw a rectangle or a curved line to ...
0
votes
1answer
74 views

Slick2D: Animation not being parsed from spritesheet correctly

I have a 960x960 spritesheet with each tile being 192x192. I initialized my spritesheet and animation like so: spritesheet = new SpriteSheet("resources/spritesheets/player.png", 192, 192); ...