Getting Started
So you want to make your own Java games for java enabled mobile phones. It's either that or you stumbled on this page by mistake.

Just like I said in the introductory post, we'll be using Netbeans IDE on the tutorials that will be presented here.

Here's a list of things you need and where to get them:

Note that you can download the NetBeans IDE 5.5 bundled with the JDK 6.0 from either site. If you're downloading NetBeans 6.0 Beta 2, you can get it bundled with Mobility pack.

The difference between NetBeans 5.5 and 6.0 is that, in NetBeans 6.0 you get to try out the nifty Game Builder that helps you create maps, sprites, and sprite animation sequences. You also get the new syntax highlighting and other new stuff improved from the previous version.

If you downloaded the bundle:

  • Install JDK-Netbeans IDE bundle.

  • Install Netbeans Mobility Pack



If you downloaded them individually:

  • Install JDK 6.0 Update 3.

  • Install Netbeans IDE 5.5.1/6.0 Beta 2.

  • Install Netbeans Mobility Pack for CLDC/Midp( only for NetBeans 5.5.1)



That's it! You can now start making J2me applications for your java enabled mobile phone.

There's one more thing we have to add to our checklist - a way to transfer your game on your mobile phone. This depends on the phone you're working on. Here's some options you might be able to choose from :

  • Bluetooth - Use this if your phone is Bluetooth capable.

  • Infrared Cable - Use this if you don't have Bluetooth.

  • USB/Serial Cable - Use this if you have neither Bluetooth nor Infrared

  • Card Reader - Use this if your phone has a memory card and you can't use any of the above.



Aside from the cable/dongle you want to use, you might also need the software and drivers to make them work. You can get these from your phone's manufacturer site or the CD-Rom that came with your phone. An example of the kind of software you might need is the Nokia PC Suite for Nokia cellphones.

Obviously, you will also need an image editor for creating the graphics you will use in your game. But for starters you can also find resources on the internet that offer sprites, tiles and other graphic content for you to practice on. Some of which I have added to the links section.

Alright, I think that's about it for our checklist. If you have some questions place a comment under this post.

2 comments   |   post a comment
said...
nid help.. nid sample game w/ sources.. i cant load my images in netbeans.. pls respond for 1 day..
said...
Dear All,

I have two java classes here.

------------------------------------------------------------------------------------
Services.java

public class Services extends MIDlet {

Display display;
private TCanvas canvas = new TCanvas(this);

public Services() {
}

public void startApp() {
Display.getDisplay(this).setCurrent(canvas);
}

public void pauseApp() {
}

public void destroyApp(boolean unconditional) {
notifyDestroyed();
}
}
-----------------------------------------------------------------------------------
TCanvas.java

public class TCanvas extends Canvas implements CommandListener {


private Image headerImage = null;
private Image smsImage = null;
private Image contactImage = null;
private Image aboutImage = null;
public Services parent;
private Command exit, select;
List list;

public TCanvas(Services midlet) {
parent = midlet;
exit = new Command("Exit", Command.EXIT, 0);
addCommand(exit);
select = new Command("Select", Command.SCREEN, 1);
addCommand(select);
setCommandListener(this);


}

protected void paint(Graphics g) {

drawBackground(g);

}

public void drawBackground(Graphics g) {
g.setColor(0x584BA5);
try {
headerImage = Image.createImage("/images/header.png");
smsImage = Image.createImage("/images/logo1.png");
aboutImage = Image.createImage("/images/logo2.png");
contactImage = Image.createImage("/images/logo3.png");
} catch (java.io.IOException e) {
throw new RuntimeException("Unable to load Image: " + e);
}
g.fillRect(0, 0, getWidth(), getHeight());
g.drawImage(headerImage, 0, 0, Graphics.LEFT | Graphics.TOP);
g.drawImage(smsImage, 0, 60, 0);
g.setColor(255, 255, 255);
g.drawString("Services", 23, 60, Graphics.LEFT | Graphics.TOP);
g.drawImage(aboutImage, 0, 87, 0);
g.setColor(255, 255, 255);
g.drawString("About Us", 23, 90, Graphics.LEFT | Graphics.TOP);
g.drawImage(contactImage, 0, 117, 0);
g.setColor(255, 255, 255);
g.drawString("Contact Us", 23, 120, Graphics.LEFT | Graphics.TOP);

}

public void commandAction(Command c, Displayable d) {
if (c == exit) {
parent.destroyApp(true);
}
}
------------------------------------------------------------------------------------


The problem i have here is i can display the image but i have a problem to navigate through the images&text, so that when i navigate to services i can use the select button to display other sub-menus in a different canvas.

Please help me.