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
0answers
310 views

How do you program the right analog stick of a controller in JInput?

I have the Left Analog Stick programmed and accepting input (moving a character around). (getCompassDir() returns the values of the cardinal directions and NONE means the stick isn't touched): // ...
1
vote
1answer
2k views

Vector movement in space type game (Mouse rotation)

I'm having an issue with my movement in my 'game' prototype. It's basically not working and admittedly my knowledge with vectors is lacking. The issue I'm running into is that the ship won't move in ...
4
votes
3answers
2k views

Android “Activities” — one or many for games?

I've been learning Android in my spare time, and one of the first things every tutorial/guide will introduce to you is the concept of an "Activity." Everyone loosely defines an Activity as a screen ...
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 ...
0
votes
1answer
831 views

Trouble programming JInput for game controller

Due to lack of reasonable documentation, I have not been able to program inputs for using a game controller. The most I have ever found was how to detect if a controller is found and what it's name ...
0
votes
1answer
935 views

Managing Game States

I'm thinking about making a StateManager for my game. I want to know how to design it; that is, how to use a stack to push and pop states onto, and draw them to the screen. For example, should each ...
0
votes
2answers
288 views

IOException java problem

I'm working through the Head First Java book, and one piece of code it makes me write looks like this: import java.io.*; public class GameHelper { public String getUserInput(String promt){ ...
0
votes
3answers
399 views

Saving and loading large tilemaps

As the title state, I have a large tilemap 400 x 400 x 26. Which currently just about fairs when using it. Saving takes a couple of seconds and it saves to a .ser file which is okay at the moment ...
2
votes
3answers
171 views

Positioning entities in adjacent maps

Say I have a 2D tile based game engine (I don't, but I will soon). I was wondering how I would manage drawing adjacent maps. That is, imagine we have a map that is 50 by 50 tiles wide. Then next to ...
8
votes
3answers
791 views

Is there any Card Game Framework? [closed]

Please let's avoid the discussion of creating/using a game framework or not. I would like to create a small framework for card games or use one if it exists. Does anyone knows one? Preferably ...
1
vote
2answers
1k views

Java: Tile-based Collision Detection with Rectangles

There are a few tile-based collision detection questions out there, but none seemed to suit my need. I guess I really would like to know why this method for collision detection isn't working. It ...
3
votes
6answers
2k views

How to implement object velocity as a vector

I'm working on a Breakout game, and want to change the ball's movement code from how I currently do it, to something based on vectors (as I feel learning and implementing movement based on vectors ...
2
votes
2answers
378 views

Ray Picking: how can I find which copy of model to pick, if they share the same vertices, but each one is translated before being drawn?

I have a scene, in which I am drawing few different objects - each one has the same vertices and each one is translated to proper place before being drawn. While using libgdx (but I think that this ...
3
votes
2answers
638 views

Stop map from scrolling but let player still move?

I have a basic method of scrolling around on a map (moving the map instead of the player), but at when the player gets to a certain proximity to the edge, how do you stop the map from scrolling, but ...
4
votes
2answers
2k views

How to get smooth transition within slick?

When a player clicks start, my app immediately switches to the first level. My question is how do I incorporate a smooth transition within Slick?
1
vote
1answer
3k views

How do I play background music in Slick/LWJGL?

I'm trying to play music in the background for my opening menu, but cant seem to find a tutorial specifically on how to play a music file. Does anyone know how this can be accomplished?
0
votes
1answer
445 views

Rendering Loop Problem (Java)

I'm not new to programming, but I am relatively new to game programming. I am trying to create a version of Breakout, as a good basic game to get myself introduced to 2d game programming. I currently ...
3
votes
2answers
680 views

Design pattern for creating multiple enemies

I'm currently attempting to implement a factory method pattern for creating multiple different enemies after loading data from a file. But I'm having second thoughts on what would be the best design ...
4
votes
3answers
1k views

How to Align Gun with Bullets

I have a top-down 2D shooter. I have an image of a player holding a gun, that rotates to face the mouse. Please note that the gun isn't a separate image tethered to the player, but rather part of the ...
0
votes
1answer
153 views

loading a sequence of obj in java

I have 90 obj for an animation and currently using LWJGL. How would I be able to load them in sequence for 3000 seconds (a frame every 33 milliseconds)?
-1
votes
2answers
183 views

Collision detection not working properly

I have some problems with collisions, the collision detection only works either on one x "line", or on one y "line". Example Heres the collision code: public void checkCollision() { for (int i ...
1
vote
3answers
321 views

Best practice for saving items?

In a game that I'm working on, any player has (at max) 460 items within their inventory. Each item has simple attributes, such as owner and quantity, but equips have different attributes, such as ...
2
votes
3answers
1k views

Text fields in a java canvas

So I'm trying to have some form of input in my game and I understand all the keyPresses and whatnot but the only issue is I have no idea of adding a textfield to the game. JTextfield doesnt seem to ...
1
vote
4answers
2k views

Why does my frames per second function return inconsistent results?

I have a FPS function that: private static void runGameFPS2() { long beginTime; //The time when the cycle begun long timeDiff; //The time it took for the cycle to execute int sleepTime; ...
2
votes
3answers
620 views

Compressing 2D level data

So, I'm developing a 2D, tile based game and a map maker thingy - all in Java. The problem is that recently I've been having some memory issues when about 4 maps are loaded. Each one of these maps ...
0
votes
1answer
168 views

Java: Standing Animation

I've been working on a top-down, and the player already has animations for moving left and right. However, if I move a certain distance and stop, it will stop on the walking animation, which isn't ...
0
votes
1answer
175 views

How do I import Motionbuilder animation into my game?

I have an animation sequence for a 3D model built in Autodesk Motionbuilder. How would import the data for the sequence into my java game for my model? Is there any tutorial on how to accomplish this? ...
0
votes
1answer
964 views

Slick2D: Changing an Image's colour to Color.white

I am working on a game where we would like the enemies to flash white when hit by a bullet. Ideally, we would like to use the same mechanism to render an Image in any colour. Our Images are all png ...
1
vote
2answers
457 views

Moving AI in a multiplayer game

I've been programming a multiplayer game and its coming together very nicely. It uses both TCP and UDP (UDP for movement and TCP for just about everything else). What I was wondering was how I would ...
1
vote
2answers
101 views

Refresh a single view

The game I'm working on is based on different levels. I can use different activities or only one activity with different layouts ( or maybe only one layout, you have to apologize me but I'm studying ...
3
votes
1answer
314 views

Revamping my GUI to be more efficient and less brute

I am building a Java game from scratch right now. So far, it runs fine, but the issue is with my GUI and how it works. Basically, it's a tile-based game. Each time the person moves a different image ...
1
vote
3answers
918 views

Easiest way to create a 2d game in Java? [closed]

I would like to create a 2d game in Java, but tutorials online for game libraries such as LWJGL are usually filled with errors once I compile the project. Most people do not explain very well, and ...
-2
votes
1answer
223 views

Tile engine Texture not updating when numbers in array change

I draw my map from a txt file. I am using java with slick2d library. When I print the array the number changes in the array, but the texture doesn't change. public class Tiles { public Image[] tiles ...
0
votes
2answers
224 views

Handling multiple AI updates for simultaneous movement

How would I go about having multiple AI on the screen all at once all calculating separate movements without too much lag and within sane working memory. Before I have had many on the screen by ...
2
votes
1answer
2k views

Best practice to use Sprites in a game using AndEngine GLES2

Currently I am having static reference to all my sprites and loading and initializing them in my OnCreateResource mthod of SimpleBaseGameActivity, But now I have to override onAreaTouched listener on ...
-3
votes
1answer
94 views

Why would selecting a lot of rows crash my game? [closed]

I have a databse that contains: id , playlistname , playlistnum and I want to get alll the rows where playlistname = "CoolPlaylist" and I want to parse them 1 by 1, so I thought of doing this: ...
2
votes
2answers
400 views

Are my programming methods for java games sufficient

so I'm making a 2d Java game with the slick2d and MarteEngine libraries. This is the biggest project since I made checkers for my Java class. I am still pretty new to programming concepts and using ...
0
votes
1answer
1k views

How do I put a game on miniclip or addinctinggames?

I finished making a java game recently, and I would like to put it on a website such as Miniclip.com or AddictingGames. How would I do this? I have one more question. I know these sites could run ...
0
votes
2answers
585 views

Collision Detection/Map Management in RPG

I'm making an rpg game. I have a Grid class which takes a char[][] to create tiles. The way I'm currently doing collision detection is by creating a Player and assigning it the grid it should be ...
0
votes
2answers
565 views

Help with Meshes, and Shading

In a game I'm making in LibGdx, I wish to incorporate a ripple effect. I'm confused as to how I get access to the individual pixels on the screen, or any way to influence them (apart from what I can ...
0
votes
2answers
297 views

How can I improve this collision detection logic?

I’m trying to make an android game and I’m having a bit of trouble getting the collision detection to work. It works sometimes but my conditions aren’t specific enough and my program gets it wrong. ...
0
votes
2answers
546 views

Euler angles to Cartesian Coordinates for use with gluLookAt

I have searched all of the internet but just couldn't find the answer. I am using LibGDX and this is part of my code that loops over and over: public void render() { GL11 gl = Gdx.gl11; ...
0
votes
1answer
184 views

Java - Tile engine changing number in array not changing texture

I draw my map from a txt file. Would I have to write to the text file to notice the changes I made? Right now it changes the number in the array but the tile texture doesn't change. Do I have to do ...
0
votes
1answer
275 views

Java Slick2d - Mouse picking how to take into account camera

When I move it it obviously changes the viewport so my mouse picking is off. My camera is just a float x and y and I use g.translate(-cam.cameraX+400, -cam.cameraY+300); to translate the graphics. I ...
-3
votes
2answers
965 views

How to fire a bullet in a specific direction?

I am developing an Android game. I have problem with bullet firing. It's a space ship that has to fire bullets but right now it's firing in a random direction. I have to fire a bullet to the enemy ...
2
votes
3answers
625 views

Movement in RPG

I want to make an RPG game in which I move tile by tile. So when I hit up, the tile row that I am on decreases by one for example. Also, it's supposed to be a slow movement so that I can see the ...
-1
votes
2answers
3k views

Breakout ball collision detection, bouncing against the walls

I'm currently trying to program a breakout game to distribute it as an example game for my own game engine. http://game-engine-for-java.googlecode.com/ But the problem here is that I can't get the ...
12
votes
2answers
2k views

Why is C/C++ preferred for game developers?

Some people say it offers more control to developers, but what is it precisely that can be controlled through C++ which can't be controlled using, for example, Java?
1
vote
1answer
1k views

JOGL hardware based shadow mapping - computing the texture matrix

I am implementing hardware shadow mapping as described here. I've rendered the scene successfully from the light POV, and loaded the depth buffer of the scene into a texture. This texture has ...
1
vote
4answers
630 views

Implmenting RLE into a tilemap or how to create a large 3D array?

Currently I've been using a 3D array for my tiles in a 2D world but the 3D side comes in when moving down into caves and whatnot. Now this is not memory efficient and I switched over to a 2D array and ...