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

Catapult projectile math [duplicate]

I'm trying to make a catapult that will attack enemies as they approach a castle but I have only a foggy idea on how to get the math correct for the projectile to travel from the catapult, to the ...
-2
votes
0answers
32 views

Slick2d: Fullscreen display resolution problem

My computer screen size is: 1920*1080 Problem is when this code: try{ AppGameContainer app=new AppGameContainer(new Game()); app.setDisplayMode(1920, 1080, true); ...
0
votes
2answers
118 views

sprite animation system height recalculating has some issues

Basically, the way it works is that it update the frame to show every let's say 24 ticks and every time the frame update, it recalculates the height and width of the new sprite to render so that my ...
1
vote
1answer
72 views

Detecting collision with a 3D array of boxes

I am at the stage of my development process where I want to implement collision. Now I can think of a simple way of doing it, if the camera's x, y or z are inside the position of a certain cube then ...
-1
votes
0answers
64 views

OpenGL 2D Screen to 3D World

I'm in the process of making a block voxel game (not minecraft clone) and I now need to be able find which block I am looking at. I've come across two methods: Ray tracing and gluUnProject I found a ...
-2
votes
0answers
38 views

KeyListener with CardLayout [closed]

I want to creat a simple game but I'm having problems with KeyListener. public class Vliegtuig { private int XPositie,YPositie, XSnelheid, YSnelheid; ImageIcon vliegtuigrechts, ...
0
votes
2answers
151 views

best structure to handle entities in an entity component based game engine

I am trying to develop a 2D entity component based game with multiple layers as tilemaps (front or back from the scene). I currently handle the tilemap layers in a 3 dimension array[z][y][x]. Each ...
0
votes
5answers
312 views

Does Java support OpenGL by itself?

Note: This is long but I explaining everything that you need to know. Don't read half way through it and say "What's the question?". It's simple but long and I need help as soon as possible. So I ...
1
vote
1answer
53 views

Jogl2 won't accept jogl 1.0 code - GL_LIGHTING and GL_LIGHT_MODEL_AMBIENT cannot be resolved or is not a field?

I'm trying to run my code on jogl 2.0 , for the first time (until now I worked with jogl 1.0) however Eclipse throws to almost every that I have a "cannot be resolved or is not a field" message . ...
1
vote
2answers
101 views

Java looking in wrong directory for XML [closed]

I found this suggestion on a Stack Exchange site to print out what the current directory is: File file = new File("."); for(String fileNames : file.list()) System.out.println(fileNames); ...
7
votes
1answer
258 views

When and why is a Pool class needed to hold objects?

I've been studying opengl es and an example I saw was using a "Pool" class to keep track of touch and keyboard events. Could someone please explain how and why a pool class is needed. From what I was ...
-1
votes
1answer
71 views

How can one make multiple movable images in OpenGL ES 2.0? [closed]

I was wondering, I've only seen examples of OpenGL ES 2.0 where people have used one or perhaps two images. I didn't see multiple images of where they each had independent movement. What if someone ...
0
votes
0answers
133 views

Pac-man animation

So for my intro to java class we need to re create this. http://people.highline.edu/tostrander/142/demo/pacman.htm We need to use only the Java.awt package so I figure to make the pacman I need to ...
-2
votes
1answer
160 views

MVC pattern for turn-based RPG [closed]

I'd like to make a 2D game in Java using the Model-View-Controller (MVC) pattern, but I have some issues concerning the battles. There are two groups of characters in each battle: heroes and ...
0
votes
0answers
98 views

Libgdx vs slick [closed]

I know slick2d and libgdx are built on top of lwjgl. I just want to choose what 2d game library to go. Is slick better than libgdx? or the other way around? and why?
-1
votes
1answer
103 views

Generating a grid of cubes in 3D space [closed]

I am trying to generate a grid of cubes in 3D space and It aint workin... All im doing is for looping YXZ (in that order) (nested for loops) then im doing cubes[x][y][z] = ... (new Location(x,y,z)) ...
2
votes
2answers
293 views

How to detect a touch on transparent area of an image in a (libgdx) stage?

Can some one please help to detect a touch on an image which I am using as an actor in a stage. The image is actually a long diagnol brush which has plenty of transparent area. The problem is when I ...
2
votes
6answers
974 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 ...
1
vote
1answer
60 views

how to detect when a character is walking on an item in java

I just want to know if there is a way in java to detect when the character is on an item on the floor without without verifying if every items on the map contains the character or vice versa in every ...
0
votes
1answer
51 views

Follow behavior with randomization factor

I'm trying to make enemy follow player as in picture below, the code below is code for following player with steering behavior ( i'm not sure it steering works tho but it does follow player ), how ...
5
votes
4answers
559 views

How to save and restore Bullet Physics state?

I'm looking for information on how to save the runtime state of rigid bodies with Bullet Physics. Most of my world consists of static objects, but I have a few dynamic and kinematic objects as well. I ...
2
votes
3answers
178 views

Using random numbers with a bias

I appear to be awful at describing the question so I'll try and describe the problem. I want to add a random amount of heads to my creatures but I want to be able to determine several things. a) The ...
4
votes
3answers
234 views

Are there methods faster than Strings for sending a sprite's state over UDP?

I'm programming a 2.5D networked game in Java. The networking works like this right now: Create new networked sprite object at the client. Send it to the server. Server distributes and saves it. ...
5
votes
3answers
494 views

How can I make a character move forward in a certain direction?

I have an entity class which is updated every game tick. Let's just assume said entity moves forward constantly. What i want to know is, how can i make it so that i can give an angle to a function and ...
-5
votes
0answers
68 views

How to make a picture to grow like grass garden [closed]

I m new in to the Java Please could someone give some tips of method to use to make a image of grass growing ? Like day by day ? Thanks
-1
votes
0answers
73 views

Best Gamedev book for jmonkey engine [closed]

I want to start using the Jmonkey Engine to make a game but I want to learn some theory first. I am NOT interested in marketing or creating a story. I basically want to know which book would tell me ...
-3
votes
0answers
38 views

Using Multiplayer and Rendering on a single thread [closed]

I have a rendering thread which does all my rendering of the game, is it possible to connect to a server at the same time on the same thread as the render? Would it overload, would it slow it down? Or ...
3
votes
0answers
94 views

Dynamic “Light Level” System based on alpha levels

My team and I have been working on a game in Java using the Slick2D engine and there are a few things I have questions on. As of right now, the code that I've written basically takes a cosine function ...
1
vote
1answer
77 views

LibGDX Cross Platform Networking

Backstory: I've been developing a game with LibGDX for the past two years, and I've seen it refactored more times than I remember. I jumped on the iOS iKVM port as soon as it was released. But I've ...
2
votes
1answer
1k views

How do I implement a score database in Android?

I making a 2D game for Android using OpenGL-ES technology. It is a space shooting game where the player shoots enemy ships. I want to keep a track of score for the amount of enemy ships destroyed ...
-1
votes
0answers
41 views

Strange Resource not found error [closed]

I'm getting this error when I try to run my application: java.lang.RuntimeException: Resource not found: /res/images/ at ...
0
votes
0answers
32 views

Getting direction of mouse from the middle - slick2d [duplicate]

I need to find the direction of the mouse from the centerpoint, i need it to return a direction e.g. north, south, northwest, southeast and so on how would one go about doing that in java ps. to ...
2
votes
2answers
102 views

Java Tetris - Matrix Rotations

I'm building Tetris in Java and am trying to use linear algebra to rotate a piece composed of 4 tiles. My friend was explaining the way to do it is: He said: "To clarify, you do need to rotate ...
0
votes
1answer
155 views

Problem with enum as game state

In the current game I'm building, I'm having trouble moving from one game state to another. I'm using enum to control my states. As of now, this is my enum: public static enum State { M_MENU, ...
3
votes
3answers
259 views

Tetris - Rotations using Linear Algebra (Rotation Matrices)

I'm making Tetris in Java and am at the point of rotations... Originally I was hardcoding each rotation: if (direction.equals("right")) { if (shape.equals("Bar")) { if ...
-2
votes
1answer
119 views

Usage of triangulators - Slick2d [closed]

So i need detailed examples how to use one of Slick2ds many triangulators to create a polygon with a hole. Could someone show me code examles of how to use it.
1
vote
1answer
46 views

LibGdx: How do I combine 2 GestureListener objects from 2 seperate classes into 1 GestureDetector

I'm trying to make 2 separate classes, 1 a VirtualJoystick class and 1 a VirtualButton class. I want to implement a GestureListener class in each, it just seems like good code to do so, but when I go ...
-1
votes
0answers
95 views

Logic in an Object Oriented Architecture [closed]

Good evening. Recently I've been thinking of making a simple TBS game in Java for fun and I was wondering if my logic is correct. Basically, I have the following classes: public abstract class ...
-3
votes
0answers
35 views

Using an OpenGL wrapper in Swing? [closed]

I'm building a custom OpenGL wrapper in Java. But I was wondering how do I link OpenGL commands to a Swing window? Thanks in advanced!
1
vote
2answers
72 views

Calling opengl32.DLL from java?

I don't like LWJGL in some cases, so I prefer to use Swing. The thing is that Swing doesn't have OpenGL. I have tried JOGL and it's a mess to install, needs external jars, and I have yet to get it ...
2
votes
1answer
74 views

MVC with looping view

For our school project we'd like to develop a game using the MVC pattern. We're all moderate new java programmers and absolutely new in game development. With our current view (containing only menu) ...
-1
votes
0answers
60 views

LWJGL - Switching from 3D to 2D to render text with NO external librarys [closed]

I want to render 2D quads on my screen by switching to a 2D scene then switching back to 3D. I dont want to use any external librarys besides LWJGL. This is what I got so far: private static void ...
0
votes
0answers
30 views

Library for asynchronous client to client messaging [closed]

I am currently developing an online game where two players can play against each other (something like Who Wants to Be a Millionaire?). And I would like to implement an asynchronous service so those ...
1
vote
0answers
49 views

How to put OpenGL in a state for drawing blended, colored, nontextured polys?

Using OpenGL1.1 (sadly) I'm trying to draw a cube, which is colored and alpha blended. It is instead showing up as opaque black. Even without including alpha in the color it still shows up as opaque ...
0
votes
1answer
63 views

Slick2d Particles loading xml returning null [closed]

I've made a particle class that creates a particle of Slick2d library, but the XML file doesn't want to load , it keeps giving me null error. I gave it the path as I do for everything but it refuses ...
-1
votes
1answer
88 views

Class equality in JAVA [closed]

I want to equalize two object like this: public abstract class Shape{...} // There is an abstract shape class public class Circle extends Shape { int radius; ... } ...
2
votes
2answers
428 views

Slick & NiftyGUI. Nifty initialize exception

I found my self into trouble when trying to run a Slick game with a Nifty Game State. This is the code: @Override protected void initGameAndGUI(GameContainer container, StateBasedGame game) ...
-2
votes
0answers
68 views

How can I create a board with Java GUI? [closed]

I am trying to create a Battleship game with MVC pattern. I have never used GUI libraries before. So can you please guide me how can I create a board with Java GUI?
-5
votes
1answer
54 views

Writing and reading from an XML file with Slick2D [closed]

I was wondering how you would go about writing and the reading from an XML file using the Java library Slick2D. I have googled for the last couple of days and have found nothing succinct and simple ...
0
votes
1answer
66 views

Hiding pixels inside a Shape

I have a player wich is a png image and I want a part of him to be able to go behind things, so I need to know how to hide pixels that are inside of a shape

1 2 3 4 5 21