Hi would like to ask some advice. I just finished reading all the documentation and would like to make my first project in jMonkey.
I decided to make a spaceship game similiar to: aero fighter (For those unfamiliar with the game or do not remember: http://www.youtube.com/watch?v=t5M4zvO3qa8 )
My big problem is how to implement the scenario. What is the best way to do this? remember that I am new in using jMonkey.
Should I use skybox? or just use a plane at bottom with a picture?
I’m not sure what to do for the background (to make it infinitely scrollable), though i dont think a skybox is what you want as they dont really behave that way. Youd probably want several background textures that can be tiled, and you can load the next part of the level as you get close. There might be better solutions.
if i did this game i’d probably add all the game objects to the gui node, since its more of a 2d game.
Yeah. I was initially hesitant to abuse guiNode for 2D games, but it’s already prepared for 2D display (camera, perspective, culling off, parallel perspective, somethine else I forgot - it’s quite a list), and you can still put your GUI stuff in front of the game itself so it’s not that you’ll be losing anything.
Skyboxes are supposed to be at a “large” distance, so they never change their appearance unless you exchange the texture (which means you transfer the bitmap to the GPU).
Just use moving images.
The tutorial keeps everything at the Z=0 plane. You should be able to get multiple planes by associating a different Z value with each.
Easiest way is to generally use Vector3f to place stuff. The demo uses Vector2f because it doesn’t need Z.
Just use a background image that’s larger than the visible screen, and move it downwards (i.e. modify its Y position via setLocalTranslation).
The Z plane is just to create the proper layering.
Normal GUI stuff (Nifty etc.) tends to be at Z=0, and I dimly remember that valid Z coordinates for the gui node are between -1 and +1 (stuff outside gets culled I think).
Not sure whether Z grows towards the player or away from him, if it’s away then I’d put shots at 0.1, enemy planes at 0.2, and enemy bosses at 0.3 (planes fly “over” the boss). Use other Z layer values as the need arises, just have a clear plan what’s going to be displayed at what layer.
TBH I wouldn’t use the GUI node for this. After all you want your planes and suchlike to be moving (or at least using) 3d.
For the background just create a quad filling the camera and either slide the texture over it or slide the quad and tile in a new one at the top as they reach the end of the previous one. (The second approach is probably simpler).
The idea is that the camera is viewed from above, as in the Aero fighter game or the game 1942. But eventually the ship will make 3D moves.
In one of the tutorials shows how to set the camera view to an orthogonal view, but i don’t know if that is not enough.
You'll want to set up the camera so that the background fills the screen exactly.
And you'll want to disable the flycam appstate so the players don't inadvertently modify the camera settings.
…actually, remove it completely. You can do this by just not adding it in the first place (in the super() call) or by detaching it in simpleInitApp().
if you do not mind, I would like to see the source code for this example.
Thank you. -
You have access to it… it was created using the tonegodGUI plugin. I used the OSRViewPort with it. Though, for your particular case, I would just kype the source code and and make it a bit more specific for your purposes.