home *** CD-ROM | disk | FTP | other *** search
- function initialize()
- {
- lives = 5;
- cash = 0;
- cashDisplay = 0;
- gameState = "stop";
- progress_bar_mc.gotoAndPlay(1);
- }
- function updateObstacle(obstacleTargetName)
- {
- if(gameState == "play")
- {
- obstacleTargetName.play();
- }
- if(gameState == "stop")
- {
- obstacleTargetName.stop();
- }
- }
- function testForCollision(xMin, xMax)
- {
- if(car_mc._x >= xMin & car_mc._x <= xMax)
- {
- car_mc._y -= 6;
- sound_mc.gotoAndPlay("crash");
- lives -= 1;
- if(lives == 0)
- {
- gotoAndPlay(88);
- }
- }
- }
- function testForCashCollision(xMin, xMax)
- {
- if(car_mc._x >= xMin & car_mc._x <= xMax)
- {
- car_mc._y -= 6;
- sound_mc.gotoAndPlay("cash_register");
- cash += 10000;
- num = String(cash).split(".");
- commanum = "";
- if(num.length == 2)
- {
- commanum = "." + num[1];
- }
- if(length(num[0]) > 3)
- {
- commanum = String(num[0]).substr(length(num[0]) - 3,3) + commanum;
- digit = length(num[0]) - 6;
- while(digit >= 0)
- {
- commanum = String(num[0]).substr(digit,3) + "," + commanum;
- digit -= 3;
- }
- if(digit > -3)
- {
- commanum = String(num[0]).substr(0,digit + 3) + "," + commanum;
- }
- }
- else
- {
- commanum = num[0] + commanum;
- }
- cashDisplay = commanum;
- }
- }
-