Section 1
//Symbol2_10 (snake_fla.Symbol2_10)
package snake_fla {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.geom.*;
import flash.utils.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.system.*;
public dynamic class Symbol2_10 extends MovieClip {
public var tiles:MovieClip;
public function Symbol2_10(){
addFrameScript(0, frame1);
}
function frame1(){
tiles.gotoAndStop(1);
}
}
}//package snake_fla
Section 2
//Ball (Ball)
package {
import flash.display.*;
public class Ball extends MovieClip {
public var pattern:Sprite;
public var currentHit:int;
public var headHit:Boolean;
public function Ball(){
currentHit = -1;
}
}
}//package
Section 3
//BounceSound (BounceSound)
package {
import flash.media.*;
public dynamic class BounceSound extends Sound {
}
}//package
Section 4
//Enemy (Enemy)
package {
import flash.display.*;
public dynamic class Enemy extends MovieClip {
}
}//package
Section 5
//EnemySound (EnemySound)
package {
import flash.media.*;
public dynamic class EnemySound extends Sound {
}
}//package
Section 6
//Food (Food)
package {
import flash.display.*;
public dynamic class Food extends MovieClip {
public var sprite:MovieClip;
public var shadow:MovieClip;
}
}//package
Section 7
//GameOverSound (GameOverSound)
package {
import flash.media.*;
public dynamic class GameOverSound extends Sound {
}
}//package
Section 8
//GulpSound (GulpSound)
package {
import flash.media.*;
public dynamic class GulpSound extends Sound {
}
}//package
Section 9
//Head (Head)
package {
import flash.display.*;
public dynamic class Head extends MovieClip {
public var top:MovieClip;
public var bottom:MovieClip;
}
}//package
Section 10
//LevelSound (LevelSound)
package {
import flash.media.*;
public dynamic class LevelSound extends Sound {
}
}//package
Section 11
//Marker (Marker)
package {
import flash.display.*;
public dynamic class Marker extends MovieClip {
}
}//package
Section 12
//MusicSound (MusicSound)
package {
import flash.media.*;
public dynamic class MusicSound extends Sound {
}
}//package
Section 13
//Part (Part)
package {
import flash.display.*;
public dynamic class Part extends MovieClip {
}
}//package
Section 14
//PauseScr (PauseScr)
package {
import flash.display.*;
public dynamic class PauseScr extends MovieClip {
public var spot:MovieClip;
}
}//package
Section 15
//Snake (Snake)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
import flash.text.*;
import flash.net.*;
import flash.geom.*;
import flash.utils.*;
import flash.ui.*;
public class Snake extends MovieClip {
public var background;
public var container:Sprite;
public var scoreText;
public var levelText;
public var playerName;
public var playerScore:TextField;
public var marker:Marker;
var gameWidth;
var gameHeight;
var msX;
var msY:int;
var username:String;
var score;
var scoreDelay;
var scoreInterval;
var fadeInterval;
var fade2Interval;
var fallInterval;
var musicInterval;
var foodTimeInterval:int;
var musicVol;
var foodAlpha;
var foodAlphaTime;
var pauseTime:Number;
var parts;
var blocks;
var hiscore:Array;
var food:Food;
var holder;
var paused:Sprite;
var bounceSound:BounceSound;
var gameOverSound:GameOverSound;
var gulpSound:GulpSound;
var levelSound:LevelSound;
var enemySound:EnemySound;
var musicSound:MusicSound;
var musicChannel:SoundChannel;
var st:SoundTransform;
var currentHit:int;
var force:Number;
var frozen:Boolean;
var levelChange:int;
var enemy:Enemy;
var loader:URLLoader;
var so:SharedObject;
public function Snake(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
MovieClip(root).gotoAndStop(1);
gameWidth = 1000;
gameHeight = 700;
paused = null;
bounceSound = new BounceSound();
gulpSound = new GulpSound();
gameOverSound = new GameOverSound();
levelSound = new LevelSound();
enemySound = new EnemySound();
musicSound = new MusicSound();
st = new SoundTransform();
levelChange = 1000;
username = "";
so = SharedObject.getLocal("snake");
if (!so.data.hiscore){
so.data.hiscore = [["Master cobra", 4000], ["Python pro", 2000], ["Snake mania", 1000], ["Rookie worm", 500]];
};
hiscore = so.data.hiscore;
if (loaderInfo[((((((((String.fromCharCode(108) + String.fromCharCode(111)) + String.fromCharCode(97)) + String.fromCharCode(100)) + String.fromCharCode(101)) + String.fromCharCode(114)) + String.fromCharCode(85)) + String.fromCharCode(82)) + String.fromCharCode(76))].indexOf((((((((((((((((((((((((((((((((((String.fromCharCode(104) + String.fromCharCode(116)) + String.fromCharCode(116)) + String.fromCharCode(112)) + String.fromCharCode(58)) + String.fromCharCode(47)) + String.fromCharCode(47)) + String.fromCharCode(111)) + String.fromCharCode(110)) + String.fromCharCode(101)) + String.fromCharCode(109)) + String.fromCharCode(111)) + String.fromCharCode(116)) + String.fromCharCode(105)) + String.fromCharCode(111)) + String.fromCharCode(110)) + String.fromCharCode(46)) + String.fromCharCode(115)) + String.fromCharCode(51)) + String.fromCharCode(46)) + String.fromCharCode(97)) + String.fromCharCode(109)) + String.fromCharCode(97)) + String.fromCharCode(122)) + String.fromCharCode(111)) + String.fromCharCode(110)) + String.fromCharCode(97)) + String.fromCharCode(119)) + String.fromCharCode(115)) + String.fromCharCode(46)) + String.fromCharCode(99)) + String.fromCharCode(111)) + String.fromCharCode(109)) + String.fromCharCode(47))) == -1){
return;
};
stage.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMove);
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown);
}
function introScene(){
frozen = true;
Mouse.show();
stage.quality = StageQuality.HIGH;
if ((((stage.stageWidth > 1000)) && ((stage.stageHeight > 700)))){
stage.scaleMode = "noScale";
};
if (musicChannel != null){
musicChannel.stop();
};
musicChannel = musicSound.play(0, 9999, st);
musicVol = (st.volume = 0);
musicChannel.soundTransform = st;
clearInterval(musicInterval);
musicInterval = setInterval(musicFadeIn, 50);
updateTopList();
}
function updateTopList(){
var _local5:Array;
var _local1 = "";
var _local2 = " ";
var _local3 = 1;
var _local4:int;
while (_local4 < hiscore.length) {
_local5 = hiscore[_local4];
_local1 = (_local1 + (((((((_local3 + ". ") + _local2.substr(0, (1 - Math.floor((_local3 / 10))))) + _local5[0]) + " ") + _local2.substr(0, ((28 - _local5[0].length) - _local5[1].toString().length))) + _local5[1]) + "\n"));
_local3++;
_local4++;
};
container.topList.text = _local1;
}
function topListLoaded(_arg1:Event){
var _local7:Array;
if (MovieClip(root).currentFrame != 1){
return;
};
hiscore = new Array();
var _local2:Array = loader.data.split("&");
var _local3 = " ";
var _local4 = "";
var _local5 = 1;
var _local6:int;
while (_local6 < _local2.length) {
_local7 = _local2[_local6].split("=");
_local7[0] = unescape(_local7[0]).replace(/\+/g, " ");
_local4 = (_local4 + (((((((_local5 + ". ") + _local3.substr(0, (1 - Math.floor((_local5 / 10))))) + _local7[0]) + " ") + _local3.substr(0, ((28 - _local7[0].length) - _local7[1].length))) + _local7[1]) + "\n"));
_local5++;
if (_local2.length == 12){
hiscoreMin = _local7[1];
};
_local6++;
};
hiscore.push(_local4);
container.topList.text = hiscore[0];
}
function musicFadeIn(){
musicVol = (musicVol + 0.01);
st.volume = musicVol;
musicChannel.soundTransform = st;
if (musicVol >= 0.5){
clearInterval(musicInterval);
};
}
function musicFadeOut(){
musicVol = (musicVol - 0.02);
st.volume = musicVol;
musicChannel.soundTransform = st;
if (musicVol <= 0){
clearInterval(musicInterval);
musicChannel.stop();
};
}
function startGame(){
MovieClip(root).gotoAndStop(2);
}
function initPlay(){
var _local2:int;
var _local3:Sprite;
var _local4:Sprite;
clearInterval(musicInterval);
musicInterval = setInterval(musicFadeOut, 50);
stage.quality = StageQuality.LOW;
frozen = false;
currentHit = -1;
var _local1 = 6;
parts = new Array();
holder = new Sprite();
addChildAt(holder, 1);
_local2 = 0;
while (_local2 < _local1) {
_local3 = ((_local2 == 0)) ? new Head() : ((_local2 < (_local1 - 5))) ? new Part() : new Tail();
if (_local2 == 0){
addChildAt(_local3, 2);
} else {
if (_local2 < (_local1 - 1)){
holder.addChildAt(_local3, 0);
};
};
parts.push({x:(-10 * _local2), y:(-10 * _local2), mc:_local3});
_local2++;
};
update();
blocks = new Array();
food = new Food();
food.tabIndex = 10;
addChildAt(food, 1);
place();
score = (scoreDelay = (scoreText.text = 0));
_local2 = 0;
while (_local2 < 1) {
_local4 = new Ball();
new Ball().scaleX = (_local4.scaleY = 1);
_local4.tabIndex = 23;
_local4.x = ((Math.random() * (gameWidth - 200)) + 100);
_local4.y = ((Math.random() * (gameHeight - 200)) + 100);
_local4.gotoAndStop(((_local2 % 2) + 1));
addChildAt(_local4, 4);
blocks.push(_local4);
_local2++;
};
physics(0);
mouseMove(null);
Mouse.hide();
setLevel(1);
foodTimeInterval = 0;
}
function falling(){
var _local1:*;
var _local2:int;
do {
_local1 = ((Math.random() * (gameWidth - 20)) + 10);
_local2 = ((Math.random() * (gameHeight - 20)) + 10);
} while (((holder.hitTestPoint(_local1, _local2, true)) || ((((_local1 > (gameWidth - 270))) && ((_local2 < 100))))));
enemy = new Enemy();
enemy.x = _local1;
enemy.y = _local2;
enemy.tabIndex = 12;
enemy.alpha = 0;
enemy.rotation = (Math.random() * 360);
enemy.scaleX = (enemy.scaleY = Math.pow(1.1, (20 + 2)));
if (Math.random() < 0.5){
enemy.scaleX = (enemy.scaleX * -1);
};
addChildAt(enemy, 4);
blocks.push(enemy);
fade2Interval = setInterval(fade2Counter, 20);
}
function fade2Counter(){
enemy.alpha = (enemy.alpha + 0.05);
enemy.scaleX = (enemy.scaleX / 1.1);
enemy.scaleY = (enemy.scaleY / 1.1);
if (enemy.alpha >= 1){
enemy.alpha = (enemy.scaleY = 1);
enemy.scaleX = (enemy.scaleX / Math.abs(enemy.scaleX));
clearInterval(fade2Interval);
fade2Interval = 0;
st.volume = 0.4;
enemySound.play(0, 1, st);
};
}
function setLevel(_arg1:int){
background.tiles.gotoAndStop(_arg1);
levelText.text = ("Level " + _arg1);
}
function gameOver(){
if (fadeInterval != 0){
clearInterval(fadeInterval);
fadeInterval = 0;
};
if (foodTimeInterval != 0){
clearInterval(foodTimeInterval);
foodTimeInterval = 0;
};
gameOverSound.play();
frozen = true;
setTimeout(gameOverEnd, 1000);
}
function gameOverEnd(){
endPlay();
if ((((score == 0)) || ((((hiscore.length == 12)) && ((score < hiscore[(12 - 1)][1])))))){
MovieClip(root).gotoAndStop(1);
return;
};
MovieClip(root).gotoAndStop(3);
stage.quality = StageQuality.HIGH;
}
function endScene(){
Mouse.show();
username = "";
playerScore.text = score;
playerName.text = (username + "_");
}
function endPlay(){
var _local1:int;
removeChild(food);
removeChild(parts[0].mc);
_local1 = 1;
while (_local1 < (parts.length - 1)) {
holder.removeChild(parts[_local1].mc);
_local1++;
};
_local1 = 0;
while (_local1 < blocks.length) {
removeChild(blocks[_local1]);
_local1++;
};
removeChild(holder);
scoreText.text = "";
}
function addScore(_arg1:int){
score = (score + _arg1);
if ((score % levelChange) == 0){
setLevel((Math.floor((score / levelChange)) + 1));
levelSound.play();
};
clearInterval(scoreInterval);
scoreInterval = setInterval(scoreCounter, 100);
}
function scoreCounter(){
scoreDelay = (scoreDelay + 13);
if (scoreDelay >= score){
scoreDelay = score;
clearInterval(scoreInterval);
};
scoreText.text = scoreDelay;
}
function place(){
var _local1:*;
var _local2:int;
do {
_local1 = ((Math.random() * (gameWidth - 20)) + 10);
_local2 = ((Math.random() * (gameHeight - 20)) + 10);
} while (((holder.hitTestPoint(_local1, _local2, true)) || ((((_local1 > (gameWidth - 270))) && ((_local2 < 100))))));
if (foodTimeInterval != 0){
clearInterval(foodTimeInterval);
foodTimeInterval = 0;
};
food.alpha = 0;
food.scaleX = (food.scaleY = Math.pow(1.1, (20 + 2)));
food.x = _local1;
food.y = _local2;
food.sprite.rotation = (Math.random() * 360);
food.sprite.tail.rotation = 0;
if (fadeInterval != 0){
clearInterval(fadeInterval);
};
fadeInterval = setInterval(fadeCounter, 20);
}
function fadeCounter(){
food.alpha = (food.alpha + 0.05);
food.scaleX = (food.scaleX / 1.1);
food.scaleY = (food.scaleY / 1.1);
if (food.alpha >= 1){
food.alpha = (food.scaleX = (food.scaleY = 1));
clearInterval(fadeInterval);
foodAlpha = 1;
foodAlphaTime = new Date().getTime();
foodTimeInterval = setInterval(foodFading, 1000);
fadeInterval = 0;
};
}
function foodFading(){
var _local1:Number = new Date().getTime();
foodAlpha = (foodAlpha - ((0.03 * 0.001) * (_local1 - foodAlphaTime)));
foodAlphaTime = _local1;
food.alpha = foodAlpha;
if (foodAlpha <= 0.2){
gameOver();
};
}
function update(){
var _local1:int = parts.length;
var _local2:int;
while (_local2 < _local1) {
parts[_local2].mc.scaleY = (((Math.cos((_local2 * 0.8)) * 0.15) + 0.9) * ((_local2 == (_local1 - 2))) ? 0.4 : ((_local2 == (_local1 - 3))) ? 0.6 : ((_local2 == (_local1 - 4))) ? 0.8 : 1);
_local2++;
};
}
function extend(_arg1:int){
var _local2:Object = parts[_arg1];
var _local3:Object = parts[(_arg1 + 1)];
var _local4:Sprite = new Part();
holder.addChildAt(_local4, (holder.getChildIndex(_local3.mc) + 1));
var _local5:Object = {x:_local2.x, y:_local2.y, mc:_local4};
parts.splice((_arg1 + 1), 0, _local5);
update();
var _local6:Number = ((_local2.x - _local3.x) * 0.5);
var _local7:Number = ((_local2.y - _local3.y) * 0.5);
_local2.x = (_local2.x + _local6);
_local2.y = (_local2.y + _local7);
physics(_arg1);
_local2.x = (_local2.x - _local6);
_local2.y = (_local2.y - _local7);
physics(_arg1);
}
function extendSnake(){
var _local1:int;
while (_local1 < 4) {
extend(Math.floor((Math.random() * (parts.length - 5))));
_local1++;
};
}
function enterFrame(_arg1:Event){
food.sprite.rotation = (food.sprite.rotation + 5);
food.x = (food.x + (Math.cos(((oldAngle * Math.PI) / 180)) * 3));
food.y = (food.y + (Math.sin(((oldAngle * Math.PI) / 180)) * 3));
if (food.x > gameWidth){
food.x = (food.x - gameWidth);
} else {
if (food.x < 0){
food.x = (food.x + gameWidth);
};
};
if (food.y > gameHeight){
food.y = (food.y - gameHeight);
} else {
if (food.y < 0){
food.y = (food.y + gameHeight);
};
};
physics(0);
}
function mouseDown(_arg1:Event){
if (MovieClip(root).currentFrame == 1){
startGame();
};
if (((paused) && (paused.spot.hitTestPoint(stage.mouseX, stage.mouseY)))){
paused.parent.removeChild(paused);
paused = null;
Mouse.hide();
food.visible = (holder.visible = (parts[0].mc.visible = true));
foodTimeInterval = setInterval(foodFading, 1000);
foodAlphaTime = (foodAlphaTime + (new Date().getTime() - pauseTime));
stage.quality = StageQuality.LOW;
};
}
function mouseMove(_arg1:Event){
msX = stage.mouseX;
msY = stage.mouseY;
if (msX < 5){
msX = 5;
} else {
if (msX > (gameWidth - 5)){
msX = (gameWidth - 5);
};
};
if (msY < 5){
msY = 5;
} else {
if (msY > (gameHeight - 5)){
msY = (gameHeight - 5);
};
};
if (((frozen) || (paused))){
return;
};
var _local2:Number = food.sprite.rotation;
var _local3:Number = ((Math.atan2((msY - food.y), (msX - food.x)) * 180) / Math.PI);
food.shadow.rotation = (food.sprite.rotation = _local3);
var _local4:Number = (msX - food.x);
var _local5:Number = (msY - food.y);
var _local6:Number = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))) < 20){
gulpSound.play();
addScore(50);
place();
extendSnake();
Mouse.hide();
};
var _local7:Number = parts[0].x;
var _local8:Number = parts[0].y;
dx = (msX - _local7);
dy = (msY - _local8);
var _local9:Number = Math.sqrt(((dx * dx) + (dy * dy)));
var _local10:Number = Math.ceil((_local9 / 10));
var _local11:Number = (_local9 / _local10);
force = _local9;
var _local12:Number = (Math.cos(((parts[0].mc.rotation * Math.PI) / 180)) * 10);
var _local13:Number = (Math.sin(((parts[0].mc.rotation * Math.PI) / 180)) * 10);
_local7 = (_local7 - _local12);
_local8 = (_local8 - _local13);
var _local14:int = _local10;
while (_local14 >= 0) {
_local7 = (_local7 + ((_local11 * dx) / _local9));
_local8 = (_local8 + ((_local11 * dy) / _local9));
if (holder.hitTestPoint(_local7, _local8, true)){
gameOver();
dx = ((_local7 + _local12) - parts[0].x);
dy = ((_local8 + _local13) - parts[0].y);
break;
};
_local14--;
};
parts[0].x = (parts[0].x + dx);
parts[0].y = (parts[0].y + dy);
var _local15:int = ((((parts[0].mc.rotation > -90)) && ((parts[0].mc.rotation < 90)))) ? 1 : -1;
parts[0].mc.top.rotation = ((_local15 * Math.max((80 - _local6), 0)) * 0.5);
parts[0].mc.bottom.scaleY = -(_local15);
parts[0].mc.bottom.y = (parts[0].mc.top.rotation * -0.05);
parts[0].mc.bottom.rotation = (-(parts[0].mc.top.rotation) * 0.5);
physics(0);
}
function keyDown(_arg1:Event){
var _local2:int = _arg1.keyCode;
if (_local2 == 80){
if (((!(paused)) && ((foodTimeInterval > 0)))){
clearTimeout(foodTimeInterval);
foodTimeInterval = 0;
paused = new PauseScr();
addChild(paused);
Mouse.show();
paused.spot.x = paused.mouseX;
paused.spot.y = paused.mouseY;
pauseTime = new Date().getTime();
food.visible = (holder.visible = (parts[0].mc.visible = false));
stage.quality = StageQuality.MEDIUM;
};
};
if (MovieClip(root).currentFrame != 3){
return;
};
if (_local2 == 13){
send();
} else {
if (_local2 == 8){
playerName.text = (playerName.text.substr(0, (playerName.text.length - 2)) + "_");
} else {
if ((((_arg1.charCode >= 32)) && ((playerName.text.length < (20 + 1))))){
playerName.text = ((playerName.text.substr(0, (playerName.text.length - 1)) + String.fromCharCode(_arg1.charCode)) + "_");
};
};
};
}
function send(){
var _local1:Array;
var _local2:Boolean;
var _local3:*;
username = playerName.text.substr(0, (playerName.text.length - 1));
if (username.length > 0){
_local1 = [username, score];
_local2 = false;
_local3 = 0;
while (_local3 < hiscore.length) {
if (score >= hiscore[_local3][1]){
hiscore.splice(_local3, 0, _local1);
_local2 = true;
break;
};
_local3++;
};
if (!_local2){
hiscore.push(_local1);
};
if (hiscore.length > 12){
hiscore.pop();
};
};
MovieClip(root).gotoAndStop(1);
}
function sendDone(_arg1:Event){
introScene();
}
function roll(_arg1:Sprite, _arg2, _arg3:Number){
_arg1.x = (_arg1.x + _arg2);
_arg1.y = (_arg1.y + _arg3);
if (_arg1.pattern){
_arg1.pattern.x = (((_arg1.pattern.x + _arg2) + 50) % 50);
_arg1.pattern.y = (((_arg1.pattern.y + _arg3) + 50) % 50);
};
if (_arg1.x < 25){
_arg1.x = 25;
} else {
if (_arg1.x > (gameWidth - 25)){
_arg1.x = (gameWidth - 25);
};
};
if (_arg1.y < 25){
_arg1.y = 25;
} else {
if (_arg1.y > (gameHeight - 25)){
_arg1.y = (gameHeight - 25);
};
};
}
function physics(_arg1:int){
var _local2:*;
var _local3:*;
var _local4:Number;
var _local5:int;
var _local6:int;
var _local8:Sprite;
var _local9:Number;
var _local10:Sprite;
var _local11:Number;
var _local12:Object;
var _local13:Object;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Sprite;
var _local21:Sprite;
var _local22:Number;
var _local23:Number;
_local6 = (blocks.length - 1);
for (;_local6 >= 0;_local6--) {
_local8 = blocks[_local6];
if ((!(_local8) is Ball)){
} else {
_local2 = (_local8.x - msX);
_local3 = (_local8.y - msY);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local9 = (10 + _local8.tabIndex);
if (_local4 < _local9){
if (_local8.tabIndex == 10){
continue;
};
if (_local8.tabIndex == 12){
if (fade2Interval == 0){
gameOver();
};
continue;
};
_local2 = (((_local9 - _local4) * _local2) / _local4);
_local3 = (((_local9 - _local4) * _local3) / _local4);
roll(_local8, _local2, _local3);
if (!_local8.headHit){
st.volume = (0.2 + (Math.random() * 0.3));
bounceSound.play(0, 1, st);
_local8.headHit = true;
};
} else {
if (((_local8.headHit) && ((_local4 > 45)))){
_local8.headHit = false;
};
};
_local5 = (_local6 - 1);
while (_local5 >= 0) {
_local10 = blocks[_local5];
_local2 = (_local10.x - _local8.x);
_local3 = (_local10.y - _local8.y);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local11 = (_local8.tabIndex + _local10.tabIndex);
if (_local4 < _local11){
_local2 = (((_local11 - _local4) * _local2) / _local4);
_local3 = (((_local11 - _local4) * _local3) / _local4);
roll(_local8, -(_local2), -(_local3));
roll(_local10, _local2, _local3);
};
_local5--;
};
};
};
var _local7:int = (parts.length - 1);
_local6 = _arg1;
while (_local6 < _local7) {
_local12 = parts[_local6];
_local13 = parts[(_local6 + 1)];
_local14 = (_local13.x - _local12.x);
_local15 = (_local13.y - _local12.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local17 = (_local13.x + (((20 - _local16) * _local14) / _local16));
_local18 = (_local13.y + (((20 - _local16) * _local15) / _local16));
_local5 = (blocks.length - 1);
while (_local5 >= 0) {
_local21 = blocks[_local5];
_local2 = (_local21.x - _local17);
_local3 = (_local21.y - _local18);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local22 = (_local21.tabIndex + 10);
if (_local4 < _local22){
_local23 = ((_local21.tabIndex == 23)) ? 0.8 : 0.2;
if (_local21.headHit){
_local17 = (_local17 + ((((_local4 - _local22) * _local2) / _local4) * _local23));
_local18 = (_local18 + ((((_local4 - _local22) * _local3) / _local4) * _local23));
};
_local23 = (1 - _local23);
_local2 = ((((_local4 - _local22) * _local2) / _local4) * _local23);
_local3 = ((((_local4 - _local22) * _local3) / _local4) * _local23);
roll(_local21, -(_local2), -(_local3));
};
_local5--;
};
_local13.x = _local17;
_local13.y = _local18;
_local19 = ((Math.atan2(_local15, _local14) * 180) / Math.PI);
_local20 = _local12.mc;
if (Math.abs((_local20.x - _local12.x)) > 1){
_local20.x = _local12.x;
};
if (Math.abs((_local20.y - _local12.y)) > 1){
_local20.y = _local12.y;
};
if (Math.abs((_local20.rotation - _local19)) > 5){
_local20.rotation = _local19;
};
_local6++;
};
}
function mouseUp(_arg1:Event){
}
function frame1(){
introScene();
stop();
}
function frame2(){
initPlay();
}
function frame3(){
endScene();
}
}
}//package
Section 16
//Tail (Tail)
package {
import flash.display.*;
public dynamic class Tail extends MovieClip {
}
}//package