Contents |
So you have decided that you would like to make a Flash Lite game for Nokia devices.
Before you start coding the game you should be aware of a few things about Mobile Devices and Flash Lite.
Developing for a device means, we have a few limitations that we must keep in mind, when develop Flash Lite games or content.
fscommand2("SetQuality",quality)
One of the most important thing in game development is - How well Flash Lite game actually play on mobile devices. . This is determined by -
Always test the game on your handset as there are certain parts of the script that can be tested only on a physical device. Always remember that the emulator or Adobe Device Central is not completely efficient and is an approximation of the performance.
When you are developing Flash Lite 1.1 game. you may think to use the array. But in flash Lite 1.1, you don't use the array. what to do?
For example: A player eat bugs and add point with use of simulate array and predefine values.
/:max_bug=tot_bug=4
/:score=0
Define event handler
Move a player in four direction. Move X and Y position 12 pixel.
tellTarget ("/player") {
gotoAndStop(2);
if (_root.player._x>22) {
//_x and _y position and speed
posX = _x-12;
posY = _y;
_x = posX;
tellTarget ("/player") {
gotoAndStop(2);
}
Use For loop to check the bugs on screen. crate simulated array to check the bugs and collision with player x and y position. If collision happened add score and decreased one bug on screen make bug visible false on screen. if player x, y coordinate and bug X, Y coordinate collide.
if (_root.max_bug<=0) {
tellTarget ("_level0") {
gotoAndPlay("completed");
}
}
//Left Key
on (keyPress "<Left>") {
tellTarget ("/player") {
gotoAndStop(2);
if (_root.player._x>22) {
//_x and _y position and speed
posX = _x-12;
posY = _y;
_x = posX;
tellTarget ("/player") {
gotoAndStop(2);
}
//Checking for bug
for (i=1; i<=/:tot_bug; i++) {
//Simulated Array
if (eval("/:bug" add i add "0") == posX) {
if (eval("/:bug" add i add "1") == posY) {
// Add score
_root.score += 10;
_root.max_bug -= 1;
tellTarget ("/b" add i) {
_visible = false;
}
//check if bug max equal to 0 then go to completed frame
if (_root.max_bug<=0) {
tellTarget ("_level0") {
gotoAndPlay("completed");
}
}
break; // this will terminate/exit the loop
}
}
}
}
}
}
//Right key
on (keyPress "<Right>") {
tellTarget ("/player") {
gotoAndStop(3);
if (_root.player._x<140) {
//_x and _y position and speed
posX = _x+12;
posY = _y;
_x = posX;
tellTarget ("/player") {
gotoAndStop(3);
}
//Checking for bug
for (i=1; i<=/:tot_bug; i++) {
//Simulated Array
if (eval("/:bug" add i add "0") == posX) {
if (eval("/:bug" add i add "1") == posY) {
//Add score
_root.score += 10;
_root.max_bug -= 1;
trace("b" add i);
tellTarget ("/b" add i) {
_visible = false;
}
//check if bug max equal to 0 then go to completed frame
if (_root.max_bug<=0) {
tellTarget ("_level0") {
gotoAndStop("completed");
}
}
break;// this will terminate/exit the loop
}
}
}
}
}
}
//// Up key
on (keyPress "<Up>") {
///Path
tellTarget ("/player") {
gotoAndStop(1);
if (_root.player._y>24) {
//_x and _y position and speed
posX = _x;
posY = _y-12;
_y = posY;
tellTarget ("/player") {
gotoAndStop(1);
}
//Checking for bug
for (i=1; i<=/:tot_bug; i++) {
//Simulated Array
if (eval("/:bug" add i add "0") == posX) {
if (eval("/:bug" add i add "1") == posY) {
//Add score
_root.score += 10;
_root.max_bug -= 1;
trace("b" add i);
tellTarget ("/b" add i) {
_visible = false;
}
//check if bug max equal to 0 then go to completed frame
if (_root.max_bug<=0) {
tellTarget ("_level0") {
gotoAndPlay("completed");
}
}
break;// this will terminate/exit the loop
}
}
}
}
}
}
////Down Key
on (keyPress "<Down>") {
///Path
tellTarget ("/player") {
gotoAndStop(4);
if (_root.player._y<176) {
//_x and _y position and speed
posX = _x;
posY = _y+12;
_y = posY;
tellTarget ("/player") {
gotoAndStop(4);
}
//Checking for bug
for (i=1; i<=/:tot_bug; i++) {
//Simulated Array
if (eval("/:bug" add i add "0") == posX) {
if (eval("/:bug" add i add "1") == posY) {
_root.score += 10;
_root.max_bug -= 1;
trace("b" add i);
tellTarget ("/b" add i) {
_visible = false;
}
//check if bug max equal to 0 then go to completed frame
if (_root.max_bug<=0) {
tellTarget ("_level0") {
gotoAndPlay("completed");
}
}
break;// this will terminate/exit the loop
}
}
}
}
}
}
--Narender Singh Raul
No related wiki articles found