×
Namespaces

Variants
Actions
Revision as of 09:18, 14 May 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:How to use tiles in games in Flash Lite 1.1

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

We do not recommend Flash Lite development on current Nokia devices, and all Flash Lite articles on this wiki have been archived. Flash Lite has been removed from all Nokia Asha and recent Series 40 devices and has limited support on Symbian. Specific information for Nokia Belle is available in Flash Lite on Nokia Browser for Symbian. Specific information for OLD Series 40 and Symbian devices is available in the Flash Lite Developers Library.

Article Metadata
Code ExampleArticle
Created: narender_raul (20 Mar 2008)
Last edited: hamishwillee (14 May 2013)


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


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: Media:Dynamically.zip


--Narender Raul

This page was last modified on 14 May 2013, at 09:18.
56 page views in the last 30 days.