A few Questions and One Swing Problem

Hey,

Im about to start a new project where im going to be creating a side view 2D shooter game, that is multiplayer, same concept as Soldat if you have played it. So i just had a few questions;

  1. What would be the best 2D API to use? and what degree of hardness is the one you suggest to use?

  2. Does anyone know where i can find any information on how to create a level editor for something like this, where the levels will be able to be customized on a pixel by pixel basis.

And finally, One problem. Im creating a language selector in swing, and the language appear in a drop down combo box. I have a JLabel above this, with these two components in a Box layout arranged vertically. The problem is that when i add in the Combo box, the Jlabel gets indented a certain amount relative to the left hand end of the combo box, and if i move the combo box to try to align it up with the Jlabel, the Jlabel moves accordingly to keep at the same point relative to the Combo Box. Does anyone know whay this is happening and how i can stop it, and let me just put it where i want.

Thanx alot.

If you just want to place swing components by pixel and don’t want to worry about layouts, use:


myPanel.setLayout(null);

myLabel.setBounds(10,10,100,25);
muPanel.add(myLabel);

Most people refer to this as null layout manager.


If you’re going to do something like Soldat, first off you might want to check the projects on games.dev.java.net since I think there is already a Soldat clone underway. That aside, its a fairly fast action and effects packed game so raw Java2D is out. At the moment you’ll find it difficult to get the performance you’ll want from Java2D accelerated mode (due to some restrictions with alpha blending).

You might want to consider writing a sprite engine with either LWJGL or JOGL. There are a couple floating around but its not very difficult to do and there have been a few examples posted. Not to advertise too much you could always check out J2DA (in my signature) which is basically a 2D sprite engine over JOGL.


A map based on a pixel by pixel destruction! :slight_smile: The best editor I can think of would be Paint Shop Pro :slight_smile: Since you’re doing pixel by pixel design, the easiest thing is just paint the level.


HTH

Kev

If you are going to avoid using a layout manager (not generally recommended) be careful to allow for the different sizes that components might have on different platforms. If you force a specific look and feel you can avoid some of those issues.
In a game where you are going to control the look nearly 100% by overriding the paint method for buttons for instance, then it matters less.