Main Menu

free camera

Started by drounal, May 15, 2006, 09:04:22 PM

Previous topic - Next topic

drounal

Hi everyone !

I'm a total beginner trying to make a video game using jpct. I used the sources of the examples to help me out and, so far, it works fine. but a problem raised with the camera.

In the "car" example, the camera is attached to the car: I want to set it free. For the moment, I removed the movement but I can't manage to make it move using the keyboard. Each movement done pressing a given key, is undone when releasing the key ...

Has anyone got a model or any hint ?
thx
Louis

EgonOlsen

The camera itself is quite simple to use. Just get it from the world and call the moveCamera-methods with the movement constants needed for the desired direction. The car example does a bit more to keep the camera following the car and obviously, you've removed just one part of this code but not the complete code, so that somewhere the camera is still set to...whatever. Maybe the fps-example is close to what you are looking for.

Melssj5

Look at the fps example. There you move the camera using the keyboard.

The camera can be moved using the MoveCamera methods, you just need to give a direction and a speed. place the method on the event you need. Its better to use the KeyMapper than the normal java events.
Nada por ahora

drounal

thx, it works fine !
++