Thursday, January 25, 2007


'Casual Game' game engine source code

Its been a while since i last posted an article. I'm quite busy working on my first game..

Anyway did you remember the game like bejeweled and other casual games wherein you match objects of the same type, color and etc..?

The past 2 weeks i've been working on 2 different types of game engine. The first is a game engine for tile based games and the second is a game engine for a casual game. This game engine still needs a lot of work but the idea on how to create this kind of things is already finished.

Some screenshots:

[screenshot 1]

[screenshot 2]

You can download the whole source code here

Note that you will wait for a couple of seconds before the download starts.

Wednesday, November 08, 2006


Scrolling Pane / Scrolling Canvas

This is an example on how to create a scrolling pane or a scrolling canvas. I dont have time to explain this but the code is really easy. You can download the whole project including the ScrollingPane class here

Some screenshots:

Thursday, October 26, 2006


bitmap font creator, fnt to j2me converter and sample source code

This is a really nice tool so you can easily create bitmap fonts from a true type fonts.

Sample code and fnt to j2me converter

BMFont - bitmap font coverter official site

I have'nt tried this yet but from the comments i read, this will surely work. It also have a word wrap functionality.

btw, you may need to wait really really long if you try to convert .fnt file to j2me using the converter.

Saturday, October 21, 2006


File naming convention in Symbian OS is case sensitive !!!

Keep in mind that file naming in Symbian OS is case sensitive. For example you have a file named "myimage.PNG". Take a look at the following code:

Image img = Image.createImage("myimage.png");

On your emulator, the file will be loaded since windows file naming convention is not case sensitive. But if you try to run the MIDlet on your phone, the application will immediatly close after you try to run it.

I have experienced this problem and it took me a while to solve it.

Wednesday, October 11, 2006


setFullscreen() not working on phone

Have you ever experienced a problem where your MIDlet seems to be in fullscreen mode on your emulator but on your actual device the image is only about 3/4 of your screen is used? You can check the following sites:

Link 1
Link 2

I encountered this bug when i tested my MIDlet on my Nokia 6630 phone. Not sure if this is applicable to any other models.

Saturday, October 07, 2006


Blending / Image Transparency

This article will help you create a transparent image effect. Before we start with the actual coding you need to first understand some important things. The following are the things that you need to keep in mind so that you can properly blend an image:

By the way, I'll be using my game engine framework on this one.

1. Lets declare the image that we will be using

private Image img;

2. Now lets load the image:

// This loads the image that will serve as the background
img = Tools.loadImage("/img1.png");

3. Now lets declare the function that will convert the mutable image to immutable image and change its opacity level:

private Image blend(Image img, int opacity) {
Get the rgb data of the image; You can use the Image.getRGB() if you dont want to use my framework method
int[] rgbdata = Tools.getRGBData(img);

for(int i=0; i int pixel = rgbdata[i];

// get the rgb data of the pixel by masking the bits using & bitwise operator
int r = ((pixel & 0x00ff0000) >> 16);
int g = ((pixel & 0x0000ff00) >> 8);
int b = ((pixel & 0x000000ff) >> 0);

// rearrange the pixel using its previous color channel values.
// we will only modify the alpha.
rgbdata[i] = (opacity << 24) + (r << 16) + (g << 8) + b;
return Image.createRGBImage(rgbdata, img.getWidth(), img.getHeight(), true);
You can use this method to set the level of transparency of the image. 0 is the transparent 255 is fully opaque. This function will also automatically convert mutable image to immutable image.

4. Lets now render the images. We will render a fully opaque copy of the image and a transparent image.

protected void render(Graphics g) {
// clear the buffer

// render the image without transparency
g.drawImage(img, 0, 0, Tools.GRAPHICS_TOP_LEFT);

// render the transparent image
g.drawImage(blend(img, 70), 0, img.getHeight()/2, Tools.GRAPHICS_TOP_LEFT);

Some notice:

I could have used the Tools.setOpacity() method but since the Tools class on my framework is not yet clean i redeclared it to reduce some confusions.

If you dont understand why i'm using render(Graphics g) instead of paint(Graphics g) you can check out my article on how to use my game engine framework here

5. The output.

You can download the complete source code including the game engine used in this project here


Game engine framework updated!!

I have made some updates on my game engine framework

You can download the updated game engine framework here.

An example on how to use the game engine can be found here.

Friday, September 22, 2006


Manipulating the color channel of a pixel

This is a nice tutorial on manipulating the color channel of a pixel

thank you very much shmoove :) you rock!

This page is powered by Blogger. Isn't yours?