Join Now
Quality Rating:
  • Currently 5.0 / 5
(5.0 / 5 - 2 votes cast)
Expertise Level:
  • Currently 5.0 / 5
(5.0 / 5 - 1 vote cast)

This page was last modified 07:24, 20 March 2008.

How to make dynamically game in Flashlite 1.1.

From Forum Nokia Wiki


Flash Lite 1.1

Contents

Develop game

You want to put graphics into your game, but the graphics would be too large for device to render. But, these graphics make game very heavy and run slow on devices. Then, what to do?

Make a single graphic reuse it and duplicate the graphics to make a big scene.

You can see that all boxes are 16x16. And all graphic boxes are same as 2,4,8 are all same graphics. But make a big picture

You want to reuse the graphics in different area of your game canvas. You have created the tiles.

Tile game
Tile game


You can also replace the graphics of your game. You don't have to redraw it again. You can just replace it. Also insert new graphics box in game. You got all tile boxes axis, point and tile numbers


You have to draw a rectangle box 16x16.

Make as a vector graphic, not raster graphic because vector graphics are render fast then raster graphics on device. Use raster or vector graphics it depends on the situation or device.

Create a movie and give instance name "tile"

And create a movie and write a Frame code.

You want to draw a one graphic tile around the canvas like a boundary.

First, draw form top Top Left is 0 and Right left corner 176.

Write a code

for (p=0; p<=176; p+ =16){
//16 is box size
a++
//a++ is increment of duplicate.
duplicateMovieClip("tile", "tile_a",a);
//tile_a is name A unique identifier for the duplicated movie clip.
//a is depth. A unique depth level for the duplicated movie clip. The depth level indicates a stacking order for duplicated movie clips. It is same as stacking order of layer in the timeline.*/
/:p=p;
tellTarget("tile"){
_x=164;
//Draw tile in X axis
_y=0
}

Same as for other side.

Add this code

//Top
for (p=0; p<=176; p += 16) {
	a++;
	duplicateMovieClip("/tile", "tile_a", a);
	/:p = p;
	tellTarget ("/tile") {
		_x = /:p;
		_y = 0;
	}
}
//Right
for (p=0; p<=176; p += 16) {
	a++;
	duplicateMovieClip("/tile", "tile_a", a);
	/:p = p;
	tellTarget ("/tile") {
		_x = 164;
		_y = /:p;
	}
}
//Left
for (p=0; p<=176; p += 16) {
	a++;
	duplicateMovieClip("/tile", "tile_a", a);
	/:p = p;
	tellTarget ("/tile") {
		_x = 0;
		_y = /:p;
	}
}
//Bottom
for (p=0; p<=176; p += 16) {
	a++;
	duplicateMovieClip("/tile", "tile_a", a);
	/:p = p;
	tellTarget ("/tile") {
		_x = /:p;
		_y = 192;
	}
}

Download

you can download an example with source code here: Dynamically_tile

--Narender Raul

Related Discussions
Thread Thread Starter Forum Replies Last Post
setting array in popupfield text dynamically shafalig82 Symbian User Interface 0 2005-03-11 08:38
How I install Java game into Game section (Nokia 6310i) afro22 Mobile Java General 6 2003-07-07 00:11
Nokia sound API.... game freezes at variable intervals shahzad73 Mobile Java General 0 1970-01-01 02:00
Changing Images at Runtime madankn Mobile Java General 1 2005-11-14 10:07
Loading a DLL dynamically cl_bonesbb General Symbian C++ 1 2001-12-03 20:07
 
Powered by MediaWiki