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

-2
votes
1answer
45 views

Using an image instead of a colored rectangle

I recently watched a video on how to do tilemaps in java. He has the tiles as colored rectangles. I want them to be images. My code: public void draw(Graphics g){ for(int row = 0; row < ...
0
votes
0answers
34 views

Bounding box should rotate - Skews instead [duplicate]

I have a method to rotate a sprite's bounding box around the center of the sprite (the sprite rotates and I need the bounding box to rotate with it. The sprite is rectangular). Instead of being ...
0
votes
0answers
96 views

Why is my rendering jumpy?

I am writing a game in Java. My main class extends JFrame and implements runnable. It has the typical java game loop as such: @Override public void run() { initTimingVars(); while (running){ ...
0
votes
1answer
154 views

libgdx game process dies on loading texture atlases

I try to load a lot of texture atlases (10) with approximately 5 (~2048x~2048)(not using PoT) .pngs each. I'm using AssetManager and there is no trouble with it on my pc but when I try it on my tablet ...
0
votes
2answers
217 views

translating canvas for rotating sprites that shoot

I am trying to align bullets to my different sprites guns (top down 2D for android). Right now Im using this method to draw my bullets: public void draw(Canvas canvas){ update(); ...
2
votes
1answer
97 views

Collision detection in libgdx

I am currently writing a little zelda like game and have a little bit of a problem with collision detection. It works but the the character stands to far away from the object. Here is my player ...
2
votes
0answers
62 views

LibGDX controllers: how to fix crashes in JRuby?

I'm using JRuby with LibGDX and it's been going quite swimmingly, save for a crash I experience every time I try to use the controllers extension. Here's a basic rundown: I've required all the ...
0
votes
1answer
219 views

Drawing UI using density pixels

I have a question about proper ways to draw UI, since I've learned what I know from the internet and by experimenting I often dont code the "proper" way, instead I do it my own way, not knowing if it ...
0
votes
2answers
133 views

How to get surrounding tiles in a tile array

I've created a tiled map that holds two layers, one for the tile type, and the other for whether it is solid or not. I plan on creating very big maps, and checking every tile seems like it would slow ...
5
votes
3answers
610 views

Is this really the reason for smoother movement?

Actually i'm watching a tutorial series on youtube about 2D Game programming in Java. My question is about the player-movement. The first version: public void keyPressed(KeyEvent e) { ...
0
votes
1answer
143 views

2D Tiled Map - Small tiles or big tiles with pixel-precise movement

I am using Java - LWJGL - Slick2D . I have tried to do a proper collision detection with 32 x 32 tile size but failed three times. I just cant get it to work! I found a youtube video that was using ...
0
votes
2answers
70 views

JOGL runs extremely slow from a jar file on other machines.

I am currently messing around with JOGL and JBullet, with some success. I'd like to share what I've created with my friends. I created a jar file and a .bat to open it with the argument ...
1
vote
1answer
221 views

Pipe connection game algorithm - Java/Andengine

I am creating a game based on Pipe Dream/Pipe Mania using java/andengine for android. I have a square grid of tiles each representing a type of pipe. The player needs to swap tiles to connect the ...
0
votes
1answer
99 views

Alpha Value at 0 Shows Black for Android Canvas Bitmap

There have been a few questions similar to this but none seem to give a straight answer. If I am creating a Bitmap from a .png image and want to set a color (i.e. true pink) to transparent, the color ...
2
votes
2answers
383 views

How would I implement procedurally generated tiles in libgdx?

I'm creating a simple top down Zelda-esque game in libgdx, and I want to implement tile-based dungeons that are procedurally generated, similar to this. Libgdx does have a class called TiledMap which ...
0
votes
1answer
95 views

libgdx ActorGestureListener.pan() parameters not moving actor in smooth line

I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d). When I move individual pieces on a board they move smoothly, but when moving the whole board, the ...
0
votes
1answer
109 views

Load all bitmaps at once or only when needed?

I am starting to get a pretty hefty amount of bitmaps in my 2d game for android. I load them all in 3 colors to save some memory but the thing is, I load all of them when "Start game" is pressed, even ...
0
votes
1answer
202 views

How should I determine the bounding rectangles for frames within a sprite sheet? [closed]

I have a spritesheet for a character. The spritesheet has several rows, and each row represents an animation. The elements within a row might vary in width. How can I load the different sections of ...
4
votes
3answers
750 views

How do I render a PNG with transparency in LibGDX?

I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background. How can I render them as a Texture with ...
1
vote
1answer
103 views

Is the Key Bindings delay unavoidable in Java when pressing different directional keys quickly?

I've read just about every tutorial I can on why to use Key Bindings instead of implementing the KeyListener interface, including all the examples that show using a field to track the key event ...
-3
votes
1answer
102 views

Regulating Frames Per Second

I'm watching a video on regulating frames per second. I don't really fully understand the code. public void run() { long lastTime = System.nanoTime(); final double ns = 1000000000.0 / 60.0; ...
0
votes
1answer
107 views

Java 2d game cross-platform compatability

I need to make a few small, simple 2d educational games primarily to help kids improve their reading. Drag & drop/matching words with pictures, spelling out words as well as maybe a scrolling ...
0
votes
0answers
156 views

2D Sidescroller camera

I'm using OpenGL. For my tiles, I'm using a display list and I'm just using immediate more for my player (for now). When I move the player, I want to center him in the center of the window, but allow ...
1
vote
3answers
148 views

Should I use object references or integral values to store pieces in a chess board?

just a general question regarding a checkers project. I built a class hierarchy for the game pieces (that could be extended for chess etc). The hierarchy looks something like interface GamePiece() ...
3
votes
3answers
208 views

How can I support retina graphics in libgdx?

I'm not sure if I'm missing it somewhere or if this just doesn't exist, but I'd like to support "retina" graphics on desktop displays that support them (like the newer MacBook Pro), but I can't find a ...
1
vote
1answer
299 views

Handling XBox 360 Controller Connections in LibGDX after Game has Started

I am currently making a game with the java library LibGDX and want to add XBox 360 controller support using the GDX-Controllers extension. At the moment I have a setup where I create a listener to ...
1
vote
1answer
131 views

LibGDX strange camera behaviour

I'm currently doing my final assessment for my study Game Development. I'm currently facing a real weird (maybe explainable) result from my camera. I just set up my scene with alot of tiles and a ...
0
votes
0answers
38 views

Should tiles in a tile-based game draw themselves? [duplicate]

I'm a beginner in game programming, and I want to start with Java (in which I have a strong background I think) and LWJGL. I want to create tile-based games. Let's say I have an object named Tile, ...
0
votes
2answers
102 views

How can I move a created Image in Slick2D?

I want a image to follow the mouse, and I use Image class of Slick 2D: public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws SlickException { mouseImage = new ...
1
vote
2answers
76 views

Java: creating an instance of a user defined class by reading xml file

I am trying to write an engine for a game, in particular a component-based one (in my approach components contain both data and logic). So basically I have entities, and each entity has a list of ...
-1
votes
1answer
37 views

java Game: Rendering issue! [duplicate]

Hi I am making a java game in were you can build land. At the moment you can build but not destroy. So I want to be able to destroy. I have an array of the tiles. I think I might need to do something ...
2
votes
4answers
172 views

Implementing frame-independent friction

So I'm not looking for anything realistic like a physics engine, just want to say that first. I'm working on a simple top-down game and I'm trying to get friction working with deltaTime. This was my ...
0
votes
3answers
70 views

JME3 Transparent Image Shows Geometries Behind

I'm using jME3 (JMonkeyEngine). I’m setting a geometry (a box with a bullet hole material/texture) to show transparency using material.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); ...
1
vote
4answers
257 views

How to set speed of circular motion

Edit 2 - clarification Just to clarify, the issue I have at the moment is how I specify a time (in seconds) for a complete revolution to occur. My delta is fixed and is 1/ticks per second (1/60). ...
0
votes
1answer
93 views

Passing through edges of AABB collision

When I move, I grab the tile in front of the player, but when the player is colliding between two tiles, I grab the wrong tile due to rounding error. I made a video explaining what I mean. As you can ...
0
votes
1answer
188 views

Creating a knockback effect

I'm fairly new to creating a 2D game in java and I'd love some help. I'm trying to create a sort of knock back effect the enemies have on you. So when you are touched by a enemy you will: lose life ...
2
votes
1answer
164 views

Ray picking and bounding boxes in Java

How do I check which bounding boxes (of different types) a ray, sent from the camera through the mouse-click coordinates, intersects with first in Java (and where)? I have arrays (box_X, box_Y, box_Z, ...
0
votes
1answer
188 views

AABB collision detection not detecting in some cases

I'm using simple AABBs in a tile based world, and for some reason the algorithm does not detect collisions when moving towards the left and then down. I actually upload a video to YouTube to ...
-1
votes
1answer
99 views

Java Game : How to place one tile over another tile

Hi I am making a java game in were you can build land. at the moment when you place tile A on top of TileB it renders over it but when you place TileB on top of TileA it doesn't render it stays as ...
0
votes
1answer
84 views

Entity System handle graphics/textures [duplicate]

I use in Java Artemis(entity system library) and Slick2D(graphics library) for a game. Now I wonder me, how I should handle graphics(sprites, textures...). In the demos of the page from Artemis it ...
-1
votes
1answer
86 views

java building game : snap to grid

I am making a game in where it's topdown and you can place blocks how can I have a snap to grid game so its like you place a block and it snaps to a grid so you cant place squares on top of eachother. ...
1
vote
1answer
237 views

How should I generate the board for a match-3-style game?

I am trying to create a "match 3" game. I'm stuck figuring out a good algorithm to fill up the game board. My game's board is 8x8. EDIT: A few things: The board should always be solvable. for ...
6
votes
1answer
183 views

How to debug framerate drops with VBOs, OpenGL

I'm working on an experimental app to test how VBOs perform when rendering a minecraft-like world. If the performance is better than what I use now I'll update my actual game. Based on what everyone ...
2
votes
1answer
183 views

How to crop camera's viewport?

I'm making an Android game using LibGDX. I want to do something hard to explain but I'll try nonetheless. Look at this camera view (it's from 3ds max): I can get same exact view in LibGDX without ...
3
votes
2answers
190 views

How can I improve the performance of this rendering code?

I've created a practice application for rendering triangles/squares/cubes using VBOs. This is mainly so I can get it right before upgrading a 3D block world game I've written that currently is using ...
1
vote
1answer
34 views

VBOs no longer renger when gluPerspective applied

I've written a basic program so I can make sure I'm properly learning VBOs before converting my 3d game's rendering to them. Essentially, this question is why changing the perspective is the GL setup ...
0
votes
1answer
212 views

Why does my isometric rendering technique leave large gaps between tiles?

I've followed tutorial after tutorial for converting from cartesian coordinates to isometric coordinates. The cartesian behavior of my game works fine... that part is easy... For the most part, I can ...
1
vote
2answers
145 views

How can I create a VBO when I don't yet know how many vertices it will contain?

I'm trying to convert my 3D block work rendering from immediate mode and display lists to VBOs. I'm having trouble understanding how to properly handle creating the buffers: I really don't know how ...
1
vote
1answer
142 views

TCG - how to program cards as separate entities

So I'm planning to try making a card game (in Java) but I'm not sure what the best way to design it is. I understand the engine stuff but not how the cards should be coded an how they should interact ...
0
votes
0answers
91 views

Block picking / ray casting through 3d blocks always slightly off

I've been working on adding a line-of-sight/ray-tracing system to my 3d block-world game. I've tried several different methods and they all work fairly well. At the moment I'm using something similar ...