July 24, 2008

Using pointer: download A sample pointer enabled killer game

I add a sample project for more discuss in light and cameras. it is only a camera moving in between walls(textures are from internet).I'll add gun and other effects to it in next time.You can also edit 3d model in way you want. This is my model in 3 direction:top,camera,left and perspective


This model have a camera and 3 light and you should draw your model on base of your camera(upper right picture) and if you want use another cameras also you should configure your model on base of them. In this model camera id is 14 and for loading camera in program this code is enough

Camera camera;

Camera=(Camera)(Myworld.find(14));

Camera position in this model is your person eye.You can move camera in every place with this code

m.setTranslation(x,y,z);

For example you can move it with pointer with this code

protected void pointerPressed(int x, int y) {

m.setTranslation(x,y,z);


}

Pointerpress is a function that invoked when a pointer pressed and x,y is pointer location in screen .You can say that when pointer pressed (x,y) location in screen camera can move.you can add image and text to game for this purpose also. In next post i add text and image to this project for getting better result from this project.

Download project

0 comments: