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
90 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 ...
4
votes
2answers
165 views

How can I get a list of servers hosted by my players?

I'm writing a multiplayer 2D online game, where game servers are hosted by the players. I want to show players a list of the currently hosted game servers. How would I do that? I know how to let ...
0
votes
1answer
57 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 = ...
1
vote
1answer
76 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 ...
4
votes
1answer
97 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
1answer
103 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 ...
3
votes
4answers
290 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 ...
-3
votes
1answer
72 views

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

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 ...
2
votes
1answer
61 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
3answers
113 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 ...
0
votes
4answers
157 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
1answer
89 views

libGDX How to make camera follow the player? [closed]

I'm having some trouble getting the camera to even work at times. Thankfully, its some-what working now. I'm trying to get the camera to follow the players movement but nothing happens. (cut out the ...
1
vote
0answers
29 views

LibgGDX drawing two seperate Textures in FrameBuffer

So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try ...
-1
votes
4answers
182 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
4answers
146 views

How can I optimize performance when updating tiles?

So I'm making a side-scrolling adventure type game in Java. The worlds are procedurally generated, so I can't manually place tiles. Therefore, I every 20 ticks (1/3 second) I update every block's tile ...
0
votes
1answer
54 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
142 views

How do I rotate and flip 2D sprites stored in a 1D array of pixels?

I am using a 1D array of pixels for rendering in 2D in java. I am interested in rotation (in radians) and mirroring across the x and y axes. The desired result looks something like this: Public void ...
0
votes
2answers
124 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
68 views

Cant center screen between black bars

As I was trying to adapt my game to different device resolutions I ran into a problem when adjusting the game screen between the "black bars." In my case I am using the FitViewport class from the ...
1
vote
1answer
53 views

Scale around a point

I am trying to create an image editing application for the purpose of generating UV maps in my own format. I am currently working on scaling the image for the purpose of zooming. I can get the image ...
0
votes
1answer
45 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(); ...
0
votes
0answers
69 views

Libgdx/Box2D PolygonShape has no position… well, what now?

As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body. So for Box2D I figured I'd need multiple fixtures, like one for ...
0
votes
0answers
28 views

LibGDX ShapeRenderer graphical glitches

So drawing something static on the screen with the ShapeRenderer is fine but whenever I try to move something it starts glitching out. Here's a vine to show what I mean: https://vine.co/v/OBxFi1P2IO9 ...
1
vote
1answer
83 views

Using xinput vibration with java

I need to use vibration for my java game, which is only available through xinput since I use xbox controllers. How can I achieve this with jna? I've never worked with dlls before so any help is ...
0
votes
1answer
36 views

Jumping distance due to X velocity

I would just like to know if there is a way to work out the distance of a jump depending on how fast the player is going. For example if the player has a velocity X of 10 and he presses the jump ...
0
votes
0answers
87 views

Java Libgdx - Fire bullets

This is my project structure! I am using Java Libgdx I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot ...
0
votes
0answers
30 views

Camera rotation issue Libgdx

I have a OrthographicCamera and I want to rotate 90° it, but when I rotate it seems to be shifted more to the right. Before rotation: http://postimg.org/image/tc9jpq9zr/ After ...
0
votes
1answer
62 views

Fade into splash screen on game load

I'm using Slick2D and LWJGL for my StateBasedGame and I was wondering if there was a way to enter into my splashscreen on application load using a transition? I tried using: this.enterState(SPLASH, ...
0
votes
0answers
44 views

2D Game with a big block-based Map - Create for each block one block-object? [duplicate]

I'm working on a 2D game in Java which will be similar to Terraria (Mincecraft 2D). I want to generae the world-map random. The world (the ground) consists of 32x32 blocks. How I should handle all ...
0
votes
1answer
75 views

Enemy spawning problem [closed]

I've been trying to get my characters to spawn at random points through out the map. I have a camera which is following my main character (2D RPG Style) around the screen, but I want these "enemies" ...
0
votes
1answer
62 views

Coordinates issue vertical scroll Libgdx

I'm going crazy with this problem. I'll explain: I have a camera that falls down (flowing along the y-axis) which displays a TiledMap and declare the whole in this way: In the create method: ...
0
votes
1answer
26 views

Timed player collision

I'm trying to make the player loose one heart then cool down for a second after being hit. For an example if(a.overlaps(b)) { p.health--; } would lower the health while being touched. In my old ...
1
vote
0answers
45 views

LibGDX: Why look BitmapFont pixelated on a scene2d.ui.Dialog?

When I use BitmapFonts directly on the stage table, the fonts looks normal (not pixelated). But when I use the same BitmapFont with the same size on a scene2d.ui.Dialog, the font looks pixelated. ...
0
votes
0answers
49 views

Client side latency when using prediction

I've implemented Client-Side prediction into my game, where when input is received by the client, it first sends it to the server and then acts upon it just as the server will, to reduce the ...
0
votes
2answers
62 views

Libgdx, find Vector3 direction

I am using Libgdx along with Bullet physics. I have a vehicle moving. I would like to use a ray from the vehicles origin and in the vehicles forward direction. How can I create the forward Vector3 ...
1
vote
2answers
66 views

LibGDX . draw multiline text

I am trying to write a big text using BitmapFont in libGDX . But it shows on one line and the user can see only the first part of the text . How can I make that bitmapFont made new line automatically ...
0
votes
1answer
93 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
85 views

Transparent JPanel, Canvas background in JFrame

I wanna make canvas background and add some elements on top of it. For this goal I made JPanel as transparent container with setOpaque(false) and added it as first of JFrame container, then I added ...
1
vote
1answer
96 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 ...
1
vote
1answer
123 views

Pokemon Yellow wrap transitions

So I've been trying to make a pretty accurate clone of the good old Pokemon Yellow for quite some time now and one puzzling but nonetheless subtle mechanic has puzzled me. As you can see in the ...
-3
votes
1answer
35 views

How can I perfectly center an image in a window using Slick2d?

Dividing the window's width by two to position it in the middle of the x-axis did not work. What else can I do?
1
vote
2answers
140 views

Why does my code dividing a 2D array into chunks fail?

I have a 2D-Array representing my world. I want to divide this huge thing into smaller chunks to make collision detection easier. I have a Chunk class that consists only of another 2D Array with a ...
0
votes
1answer
76 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 ...
1
vote
3answers
192 views

What datastructure would you use for a collision-detection in a tilemap?

Currently I save those blocks in my map that could be colliding with the player in a HashMap (Vector2, Block). So the Vector2 represents the coordinates of the blog. Whenever the player moves I then ...
-2
votes
1answer
91 views

Calculate velocity of a bullet ricocheting on a circle

I made a picture to demostrate what I need,basecaly I have a bullet with velocity and I want it to bounce with the correct angle after it hits a circle Solved(look the accepted answer for explain): ...
0
votes
1answer
60 views

TileEntitySpecialRenderer only renders from certain angle

I'm developing a Minecraft mod with Forge. I've added a tileentity and a custom renderer for it. The problem is: The block is only visible from sertain angles. I've compaed my code to other peoples ...
-1
votes
1answer
63 views

LibGDX Json not parsing full file

I'm trying to load a World with different Objects (World Objects and Entities). For that, I want to use Json. For less than two elements this works like a charm. But as I add more elements, some ...
1
vote
1answer
94 views

making a monster encounter method

I'm currently making my own little 2d text based game and I've got a 11 / 11 grid where a monster spawns in the middle and when i stand on it's position and it brings me to another 11/11 grid where i ...
0
votes
0answers
50 views

LibGDX - How to move Actor with fingers Code?

I am completely new to Game Development. I See all these Questions and Answers and Codes and I have no clue what to do with them. I need some Guidance. My Plan: I want my Actor to move up and down, ...
0
votes
1answer
82 views

NiftyGUI - Text isn't rendering

I am trying to create a gui with nifty on top of lwjgl. I've already had some problems during the Nifty setup, however now Nifty is set up and running correctly but for text rendering. Here is my xml ...