Tag Info

New answers tagged

2

Do some manual tracing to determine where in the water the ship is... it could be as simple as checking the Y or Z coordinate being below 0 if your world is all water with the water table at level 0. Anyway, if the ship is in water, every timestep, push it upward with a force/impulse. The deeper in the water it is, the stronger the push. This should work ...


0

You need to unbind your texture object after using it for drawing certain shape. // In Texture class add void unbind() { glBindTexture(0); } public void drawTex(Texture t, int x, int y, int width, int height) { t.bind(); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(x,y); glTexCoord2f(1,0); ...


1

I managed to implement a pause funcionality that works perfectly well in my game, based on this tutorial: Create a volatile boolean variable in StartingClass private volatile boolean isPaused = false; Inside the run() method, use wait() surrounded by a try-catch. // GAME IS PAUSED try { if (isPaused) { synchronized (this) { ...


1

The way I did it is simply calling Keyboard.create() in all the threads that I need to use Keyboard.isKeyDown(int key). I know this sounds sloppy, but it has been working perfectly for me so far.


0

If you say that y starts at bottom, I'm going to assume that +y moves upward on the screen. If this is the case, the rectangle would build "upward". So x,y of the rectangle would be in the bottom left corner, and the bounds of the rectangle would extend upward and to the right. x + width; y + height To find the location of each corner, just need to add the ...


0

public void getInput(int delta) { if(Keyboard.isKeyDown(Keyboard.KEY_A)) camX-=1; } Is usually: float camX; float speedPerWholeSecond = 1; public void getInput(float fractionalElapsedSeconds) { if(Keyboard.isKeyDown(Keyboard.KEY_A)) camX -= (speedPerWholeSecond * fractionalElapsedSeconds); } This calculation is made FrameRate ...



Top 50 recent answers are included