home *** CD-ROM | disk | FTP | other *** search
- function initGame()
- {
- pickedUpScroll = false;
- madeContact = false;
- allDone = false;
- nextScreen = false;
- healthAmount = 20;
- ninjaHit = false;
- ninjaMove = 1;
- ninjaLeft = false;
- ninjaCrouch = false;
- ninjaHealth._xscale = 100;
- ninjaSwing = false;
- ninjaStrength = power;
- jump = false;
- starCount = 10;
- keyTouch = 1;
- nextStarTime = 0;
- nextStar = 0;
- stars = [];
- enemyLeft = false;
- enemyHit = false;
- enemySwing = false;
- enemyStrength = 3;
- enemyHealth._xscale = 100;
- enemyBlock = false;
- nextfireBall = 0;
- fireBalls = [];
- fireBallCount = 30;
- nextIceBall = 0;
- iceBalls = [];
- iceBallCount = 30;
- nextSuperF = 0;
- superFs = [];
- superFCount = 30;
- swordSound = new Sound();
- swordSound.attachSound("swordsClank");
- gameSound = new Sound();
- gameSound.attachSound("soundtrack");
- }
- function throwIceball()
- {
- attachMovie("iceball","ice" + nextIceBall,nextIceBall + 10000);
- if(enemyLeft == false)
- {
- _root["ice" + nextIceBall]._x = warrior._x - 50;
- }
- if(enemyLeft == true)
- {
- _root["ice" + nextIceBall]._x = warrior._x + 50;
- }
- _root["Ice" + nextIceBall]._y = warrior._y - 40;
- iceBalls.push(nextIceBall);
- nextIceBall++;
- iceBallCount--;
- }
- function moveIceball()
- {
- c = iceBalls.length - 1;
- while(c >= 0)
- {
- i_Ball = _root["ice" + iceBalls[c]];
- if(i_Ball._x < 0 || i_Ball._x > 550)
- {
- i_Ball.removeMovieClip();
- iceBalls.splice(c,1);
- }
- else if(i_Ball.hitTest(ninja) && jump != true && ninjaCrouch != true)
- {
- i_Ball.gotoAndPlay(10);
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninjaHealth._xscale -= 10;
- }
- else if(i_Ball.hitTest(ninja) && jump != true && ninjaCrouch == true)
- {
- i_Ball.gotoAndPlay(10);
- }
- c--;
- }
- }
- function throwFireball()
- {
- attachMovie("fireball","fire" + nextfireBall,nextfireBall + 10000);
- if(enemyLeft == false)
- {
- _root["fire" + nextfireBall]._x = warrior._x - 50;
- }
- if(enemyLeft == true)
- {
- _root["fire" + nextfireBall]._x = warrior._x + 50;
- }
- _root["fire" + nextfireBall]._y = warrior._y - 40;
- fireBalls.push(nextfireBall);
- nextfireBall++;
- fireBallCount--;
- }
- function moveFireball()
- {
- f = fireBalls.length - 1;
- while(f >= 0)
- {
- f_Ball = _root["fire" + fireBalls[f]];
- if(f_Ball._x < 0 || f_Ball._x > 550)
- {
- f_Ball.removeMovieClip();
- fireBalls.splice(f,1);
- }
- else if(f_Ball.hitTest(ninja) && jump != true && ninjaCrouch != true)
- {
- f_Ball.gotoAndPlay(10);
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninjaHealth._xscale -= 10;
- }
- else if(f_Ball.hitTest(ninja) && jump != true && ninjaCrouch == true)
- {
- f_Ball.gotoAndPlay(10);
- }
- f--;
- }
- }
- function throwStars()
- {
- if(getTimer() > nextStarTime)
- {
- attachMovie("star","star" + nextStar,nextStar + 9999);
- if(ninjaLeft == true)
- {
- _root["star" + nextStar]._x = ninja._x - 50;
- }
- if(ninjaLeft == false)
- {
- _root["star" + nextStar]._x = ninja._x + 50;
- }
- _root["star" + nextStar]._y = ninja._y - 40;
- stars.push(nextStar);
- nextStar++;
- nextStarTime = getTimer() + 500;
- starCount--;
- }
- }
- function moveStars()
- {
- n = stars.length - 1;
- while(n >= 0)
- {
- star = _root["star" + stars[n]];
- if(star._x < 0 || star._x > 550)
- {
- star.removeMovieClip();
- stars.splice(n,1);
- }
- else if(star.hitTest(warrior))
- {
- warrior.gotoAndStop(3);
- star.removeMovieClip();
- enemyHealth._xscale -= 5;
- }
- n--;
- }
- }
- function superFlash()
- {
- attachMovie("superFlash","superF" + nextSuperF,nextSuperF + 9999);
- if(enemyLeft == false)
- {
- _root["superF" + nextSuperF]._x = enemyFloat._x - 30;
- }
- if(enemyLeft == true)
- {
- _root["superF" + nextSuperF]._x = enemyFloat._x + 30;
- }
- _root["superF" + nextSuperF]._y = enemyFloat._y - 60;
- superFs.push(nextSuperF);
- nextSuperF++;
- superFCount--;
- }
- function resetBonus()
- {
- if(town._currentframe == 1 or town._currentframe == 14)
- {
- scrollsAvailable = false;
- }
- else if(town._currentframe == 2 or town._currentframe == 15)
- {
- _root.healthBottle();
- }
- else if(town._currentframe == 3 or town._currentframe == 16)
- {
- scrollsAvailable = true;
- _root.oldScrolls();
- }
- else if(town._currentframe == 4 or town._currentframe == 17)
- {
- pickedUpScroll = false;
- scrollsAvailable = false;
- _root.healthBottle();
- }
- else if(town._currentframe == 5 or town._currentframe == 18)
- {
- pickedUpScroll = false;
- scrollsAvailable = true;
- _root.healthBottle();
- _root.oldScrolls();
- }
- else if(town._currentframe == 6 or town._currentframe == 19)
- {
- pickedUpScroll = false;
- scrollsAvailable = true;
- _root.oldScrolls();
- _root.healthBottle();
- }
- else if(town._currentframe == 7 or town._currentframe == 20)
- {
- pickedUpScroll = false;
- scrollsAvailable = false;
- _root.healthBottle();
- }
- else if(town._currentframe == 8 or town._currentframe == 21)
- {
- pickedUpScroll = false;
- scrollsAvailable = true;
- _root.healthBottle();
- _root.oldScrolls();
- }
- else if(town._currentframe == 9 or town._currentframe == 22)
- {
- pickedUpScroll = false;
- scrollsAvailable = false;
- if(myXtraLife == 0)
- {
- _root.extraLife();
- }
- }
- else if(town._currentframe == 10 or town._currentframe == 23)
- {
- _root.scrollsAvailable = false;
- _root.healthBottle();
- }
- else if(town._currentframe == 11 or town._currentframe == 24)
- {
- _root.scrollsAvailable = false;
- _root.healthBottle();
- }
- else if(town._currentframe == 12 or town._currentframe == 25)
- {
- _root.scrollsAvailable = false;
- _root.healthBottle();
- }
- else if(town._currentframe == 13 or town._currentframe == 26)
- {
- _root.scrollsAvailable = true;
- _root.healthBottle();
- _root.oldScrolls();
- }
- }
- function extraLife()
- {
- myXtraLife = 1;
- _root.attachMovie("life","life",100);
- life._x = Math.random() * 400 + 100;
- life._y = 145;
- }
- function healthBottle()
- {
- if(ninjaHealth._xscale < 50)
- {
- _root.attachMovie("Health","Health",100);
- Health._x = Math.random() * 400 + 100;
- if(paperScroll.hitTest(Health._x,Health._y,true) == true)
- {
- Health._x = Math.random() * 400 + 100;
- }
- Health._y = 145;
- }
- }
- function oldScrolls()
- {
- _root.attachMovie("paperScroll","paperScroll",200);
- paperScroll._x = Math.random() * 400 + 60;
- paperScroll._y = 145;
- scrollTaken = false;
- scrollsAvailable = true;
- }
- function moveNinja()
- {
- if(Key.isDown(39) && _root.keyTouch == 1 && ninjaCrouch != true)
- {
- ninjaLeft = false;
- dx = 9;
- ninja._xscale = Math.abs(ninja._xscale);
- }
- else if(Key.isDown(37) && _root.keyTouch == 1 && ninjaCrouch != true)
- {
- ninjaLeft = true;
- dx = -9;
- ninja._xscale = - Math.abs(ninja._xscale);
- }
- else
- {
- dx = 0;
- }
- if(ninjaMove == 1)
- {
- ninja._x += dx;
- }
- if(dx != 0 && ninja.swing.ninjaLegs._currentframe == 1)
- {
- ninja.swing.ninjaLegs.gotoAndPlay(2);
- }
- else if(dx == 0 && ninja.swing.ninjaLegs._currentframe != 1)
- {
- ninja.swing.ninjaLegs.gotoAndStop(1);
- }
- }
- function ninjaFight()
- {
- if(enemySwing != true && enemyBlock != true && ninjaSwing == true && enemyHit == false)
- {
- warrior.gotoAndStop(3);
- enemyHealth._xscale -= ninjaStrength;
- }
- else if(enemyBlock == true && ninjaSwing == true)
- {
- warrior.Eswing.Esparks.gotoAndPlay(2);
- if(ninjaLeft != true)
- {
- ninja._x -= 5;
- }
- else
- {
- ninja._x += 5;
- }
- }
- else if(ninja._x < warrior._x && ninjaLeft != true && enemySwing == true && ninjaSwing != true && ninjaCrouch != true)
- {
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninja._x -= 40;
- ninjaHealth._xscale -= enemyStrength;
- }
- else if(ninja._x < warrior._x && ninjaLeft == true && enemySwing == true && ninjaSwing != true && ninjaCrouch != true)
- {
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninja._x -= 40;
- ninjaHealth._xscale -= enemyStrength;
- }
- else if(ninja._x > warrior._x && ninjaLeft != true && enemySwing == true && ninjaSwing != true && ninjaCrouch != true)
- {
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninja._x += 40;
- ninjaHealth._xscale -= enemyStrength;
- }
- else if(ninja._x > warrior._x && ninjaLeft == true && enemySwing == true && ninjaSwing != true && ninjaCrouch != true)
- {
- ninjaHit = true;
- ninja.gotoAndPlay(14);
- ninja._x += 40;
- ninjaHealth._xscale -= enemyStrength;
- }
- }
- function gameTime()
- {
- time = new Date();
- hours = time.getHours();
- if(hours >= 0)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(4);
- }
- if(hours >= 1)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(5);
- }
- if(hours >= 2)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(6);
- }
- if(hours >= 3)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(7);
- }
- if(hours >= 4)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(8);
- }
- if(hours >= 5)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(9);
- }
- if(hours >= 6)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(2);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(1);
- }
- if(hours >= 7)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(3);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(2);
- }
- if(hours >= 8)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(3);
- }
- if(hours >= 9)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(4);
- }
- if(hours >= 10)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(5);
- }
- if(hours >= 11)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(6);
- }
- if(hours >= 12)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(7);
- }
- if(hours >= 13)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(8);
- }
- if(hours >= 14)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(9);
- }
- if(hours >= 15)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(10);
- }
- if(hours >= 16)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(11);
- }
- if(hours >= 17)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(12);
- }
- if(hours >= 18)
- {
- town.gotoAndStop("Daytime");
- frontStuff.gotoAndStop("stuffDay");
- _root.sky.sky_red.gotoAndStop(1);
- _root.sky.gotoAndStop(1);
- _root.sky.sun.gotoAndStop(13);
- }
- if(hours >= 19)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(6);
- _root.sky.gotoAndStop(2);
- _root.sky.sun.gotoAndStop(14);
- }
- if(hours >= 20)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(5);
- _root.sky.gotoAndStop(2);
- _root.sky.sun.gotoAndStop(15);
- }
- if(hours >= 21)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(1);
- }
- if(hours >= 22)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(2);
- }
- if(hours >= 23)
- {
- town.gotoAndStop("Nighttime");
- frontStuff.gotoAndStop("stuffNight");
- _root.sky.sky_red.gotoAndStop(4);
- _root.sky.gotoAndStop(2);
- _root.sky.moon.gotoAndStop(3);
- }
- }
- levelStart = true;
- levelEnd = false;
- myXtraLife = 0;
- stop();
-