mobile gamedevelopment using flash lite
DESCRIPTION
Some information on developing flash games for mobile in flashlite version 1.1TRANSCRIPT
Game Porting in Flash Lite 1.1
Porting of game Balancing Mathai by Csharks
by Juwal Bose
Versions of Flash Lite
1.x – Most wide spread 2.x – Most capable 3.0 – For upcoming hand sets
Limitations
Screen resolution Color depth Processor power Memory Sound reproduction Flash version support Key pad layout / Controls
Our scenerio
Already have the game in flash AS1/2 We will build for Flash lite 1.1 Nokia S60 – 176 x 208
Case with Flash Lite 2.X We can directly
port our code Only Graphics
optimizations needed
Less number of devices
Require higher version of flash IDE
Tools Required
Flash – mx2004, v8, cs3 Adobe Device Central CS3 Flash Lite 1.1 CDK Flash Lite Device
Graphics Optimizations
Reduce the color palette Reduce the size – 176 x 208 Optimize graphics in flash Remove gradients used Remove transparency used Balance between vector and raster Use PNG raster graphics
Gradients
Optimizing code
Use small variable names Reuse variables Reduce nested loops Flash lite 1.1 is optimized
Design changes
Static 5 levels Pre animated graphics Left/Right arrow controls with enter
key Extensive use of movie clips and an
invisible button
The frames 6 frames labeled logo, menu, help, game, over and win
The frames cont… Invisible button is placed out side the scene to take key
presses
The frames cont… The frame code on frame 1
The frames cont…
Button code on help frame
on (keyPress "<Enter>") {tellTarget ("/") {
gotoAndPlay("menu");}
}
Button code on game over and game win frames
on (keyPress "<Enter>") {tellTarget ("/") {
gotoAndPlay("game");}
}
The menu A movie clip with 3 frames (labels s,h,c) is present with
an invisible button having the code
The game frame Dynamic text box with variable name ‘level’ Mathai animation movie clip mathai Hand movie clips hL and hR A go movieclip for starting The invisible button
Game frame code
lSTime = dT=lLTime=o;level = 1;mF = 20;sF = 10;dR = "";dN = "n";interval = 10000;tellTarget ("go") {
gotoAndStop(1);}tellTarget ("mathai") {
gotoAndStop(1);}tellTarget ("mathai/clip") {
gotoAndStop(10);}//stop();
Mathai Clip frame code
Button codeon (keyPress "<Enter>") {
if (/:dN eq "n") {/:dN = "y";tellTarget ("go") {
gotoAndStop(2);}if (random(2) == 0 && /:dR ne "l") {
tellTarget ("mathai/clip") {gotoAndPlay(_totalframes-_currentframe);/:dR = "l";
}} else {
if (/:dR ne "r") {/:dR = "r";
}}tellTarget ("mathai/clip") {
play();}///:lSTime = getTimer();//
}}
on (keyPress "<Left>") {if (/:dN eq "y") {
tellTarget ("hL") {gotoAndPlay(2);
}if (/:dR eq "r") {
fscommand2("StartVibrate", 1000, 0, 0);//change/:dR = "l";tellTarget ("mathai/clip") {
gotoAndPlay(_totalframes-_currentframe);}
} else {tellTarget ("mathai/clip") {
gotoAndPlay(_currentframe+1);}
}}
}
Button code continued
Details
Adding levels Time based level up on button events Check out source
Visit us
www.csharks.com www.csharksgames.com www.manoramaonline.com/children
A lot more coming up this year