Flash Lite [ 9 ] Test hit
Flash Lite 1.1 didn't support "hitTest", so it is difficult to create the game which needs test hit. Someone will try to use objects' _x, _y, if two objects _x and _y are the same, and we could say they are hited. In this way, you need to use lots of conditional statements, if there are lots of objects need to check. It might be influence the performace, might let mobile phone out of memory.
In the game "CRAZY TAXI", I try to think of another way to test hit. I put lots of objects in this game, and they will appear randomly. User could press Left/Right to control the Taxi to avoid hit the obstacle.

I use variable po to check the Taxi in which lane, when it in the left one,
_root.op=1;
I create a MovieClip to define the obstacles, and use two variables and random the value p to define the obstacle appears in which lane and value k to show different kind of obstacle. When the k=1, it means there is no obstacle will appear.
I write down the conditional statement in the frame, when to obstacle move near to the head of car.
if(_root.po==1 and _root.obs.p==1 and _root.obs1.k!=1){
call("/:hit");
}
I use the frame to define the timing of check. If the car and the obstacle are in the same lane, the car will be defined as hitting the obstacle
In the game "CRAZY TAXI", I try to think of another way to test hit. I put lots of objects in this game, and they will appear randomly. User could press Left/Right to control the Taxi to avoid hit the obstacle.

I use variable po to check the Taxi in which lane, when it in the left one,
_root.op=1;
I create a MovieClip to define the obstacles, and use two variables and random the value p to define the obstacle appears in which lane and value k to show different kind of obstacle. When the k=1, it means there is no obstacle will appear.
I write down the conditional statement in the frame, when to obstacle move near to the head of car.
if(_root.po==1 and _root.obs.p==1 and _root.obs1.k!=1){
call("/:hit");
}
I use the frame to define the timing of check. If the car and the obstacle are in the same lane, the car will be defined as hitting the obstacle


0 Comments:
Post a Comment
<< Home