Frame 1
var AirHockey = (new classes.smashing.AirHockey.engine(this));
AirHockey.init();
Frame 10
play();
Frame 11
if (AirHockey.isLoaded()) {
gotoAndPlay ("start");
} else {
prevFrame();
}
Frame 21
stop();
Frame 31
stop();
Frame 41
stop();
Symbol 7 MovieClip [puck] Frame 1
stop();
Symbol 7 MovieClip [puck] Frame 6
play();
Symbol 7 MovieClip [puck] Frame 33
gotoAndStop ("off");
Symbol 12 MovieClip [paddle] Frame 1
stop();
Symbol 12 MovieClip [paddle] Frame 6
play();
Symbol 12 MovieClip [paddle] Frame 33
gotoAndStop ("off");
Symbol 14 MovieClip [sfx] Frame 1
#initclip 33
Object.registerClass("sfx", classes.smashing.AirHockey.soundFX);
#endinitclip
Symbol 25 Button
on (release) {
AirHockey.start();
}
Symbol 54 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 6
stop();
Symbol 54 MovieClip Frame 11
stop();
Symbol 54 MovieClip Frame 16
stop();
Symbol 54 MovieClip Frame 21
stop();
Symbol 54 MovieClip Frame 26
stop();
Symbol 54 MovieClip Frame 31
stop();
Symbol 54 MovieClip Frame 36
stop();
Symbol 54 MovieClip Frame 41
stop();
Symbol 54 MovieClip Frame 46
stop();
Symbol 54 MovieClip Frame 51
stop();
Symbol 55 MovieClip Frame 1
stop();
Symbol 55 MovieClip Frame 6
play();
Symbol 55 MovieClip Frame 13
gotoAndPlay ("blink");
Symbol 99 MovieClip [__Packages.classes.smashing.AirHockey.engine] Frame 0
class classes.smashing.AirHockey.engine
{
var __level, __root, __dimensions, __isStarted, __updateInterval, __fps;
function engine (root) {
var _local1 = this;
_local1.__root = root;
_local1.__isStarted = false;
_local1.__updateInterval = -1;
_local1.__pctLoaded = 0;
_local1.setDimensions(600, 400);
Mouse.show();
}
function init() {
var _local1 = this;
_local1.__fps = new classes.smashing.library.utility.utilityFPS(_local1.__root.fps);
_local1.__clips = new classes.smashing.library.depth.clipBuffer(_local1.__root.objects);
_local1.__clips.reset();
_local1.__clips.addSection("GAME");
_local1.__level = new classes.smashing.AirHockey.level(_local1.__root, _local1.__clips, _local1.__dimensions);
_local1.parseXML();
_local1.__root.gotoAndPlay("load");
}
function isLoaded() {
return(true);
}
function start() {
var _local1 = this;
if (__DEBUG) {
_local1.__fps.show();
}
_local1.__root.gotoAndPlay("update");
_local1.__root.ready.gotoAndPlay("on");
_local1.__level.startLevel();
_local1.__isStarted = true;
_local1.__fps.start();
clearInterval(_local1.__updateInterval);
_local1.__updateInterval = setInterval(_local1.update, 1, _local1);
}
function stop() {
var _local1 = this;
clearInterval(_local1.__updateInterval);
_local1.__updateInterval = -1;
Mouse.show();
_local1.__level.stopLevel();
trace("game over");
}
function setReady() {
__level.setReady();
}
function update(controller) {
var _local1 = controller;
_local1.fps.update();
if (!_local1.__get__isStarted()) {
} else {
_local1.level.update(_local1.fps.deltaTimeMS);
updateAfterEvent();
if (_local1.level.isGameOver) {
_local1.stop();
}
}
}
function setDimensions(width, height) {
var _local1 = this;
if (_local1.__dimensions == undefined) {
_local1.__dimensions = new Object();
}
_local1.__dimensions.width = width;
_local1.__dimensions.height = height;
_local1.__dimensions.halfWidth = width / 2;
_local1.__dimensions.halfHeight = height / 2;
}
function parseXML() {
var _local2 = this;
__DEBUG = false;
_local2.__level.setDebug(__DEBUG);
var boardDirection = "horizontal";
_local2.__level.setBoardDirection(boardDirection);
var width = 600;
var height = 400;
_local2.setDimensions(width, height);
var _local1 = new classes.smashing.library.math.vector.vector3();
var _local3 = new classes.smashing.library.math.vector.vector3();
var moveSpeed;
_local1.__set__x(-330);
_local1.__set__y(-310);
_local1.__set__z(0);
_local2.__level.worldCorners[0].copyFrom(_local1);
_local1.__set__x(330);
_local1.__set__y(-310);
_local1.__set__z(0);
_local2.__level.worldCorners[1].copyFrom(_local1);
_local1.__set__x(330);
_local1.__set__y(310);
_local1.__set__z(0);
_local2.__level.worldCorners[2].copyFrom(_local1);
_local1.__set__x(-330);
_local1.__set__y(310);
_local1.__set__z(0);
_local2.__level.worldCorners[3].copyFrom(_local1);
_local1.__set__x(0);
_local1.__set__y(-310);
_local1.__set__z(0);
_local2.__level.midFieldWorld[0].copyFrom(_local1);
_local1.__set__x(0);
_local1.__set__y(310);
_local1.__set__z(0);
_local2.__level.midFieldWorld[1].copyFrom(_local1);
_local1.__set__x(330);
_local1.__set__y(155);
_local1.__set__z(0);
_local2.__level.goalTopWorld[0].copyFrom(_local1);
_local1.__set__x(330);
_local1.__set__y(-155);
_local1.__set__z(0);
_local2.__level.goalTopWorld[1].copyFrom(_local1);
_local1.__set__x(-330);
_local1.__set__y(155);
_local1.__set__z(0);
_local2.__level.goalBottomWorld[0].copyFrom(_local1);
_local1.__set__x(-330);
_local1.__set__y(-155);
_local1.__set__z(0);
_local2.__level.goalBottomWorld[1].copyFrom(_local1);
_local1.__set__x(0);
_local1.__set__y(0);
_local1.__set__z(0);
_local3.__set__x(300);
_local3.__set__y(300);
_local3.__set__z(0);
moveSpeed = 300;
_local2.__level.puck.spawn(_local1);
_local2.__level.puck.setMaxVelocity(_local3);
_local2.__level.puck.setMaxMoveSpeed(moveSpeed);
_local1.__set__x(200);
_local1.__set__y(0);
_local1.__set__z(0);
_local3.__set__x(350);
_local3.__set__y(350);
_local3.__set__z(0);
moveSpeed = 350;
_local2.__level.player.spawn(_local1);
_local2.__level.player.setMaxVelocity(_local3);
_local2.__level.player.setMaxMoveSpeed(moveSpeed);
_local1.__set__x(-200);
_local1.__set__y(0);
_local1.__set__z(0);
_local3.__set__x(350);
_local3.__set__y(350);
_local3.__set__z(0);
moveSpeed = 350;
_local2.__level.enemy.spawn(_local1);
_local2.__level.enemy.setMaxVelocity(_local3);
_local2.__level.enemy.setMaxMoveSpeed(moveSpeed);
}
function get root() {
return(__root);
}
function get dimensions() {
return(__dimensions);
}
function get isStarted() {
return(__isStarted);
}
function get updateInterval() {
return(__updateInterval);
}
function get fps() {
return(__fps);
}
function get level() {
return(__level);
}
function get log() {
return(classes.smashing.library.utility.utilityDebug.log);
}
static var ENGINE_XML_PATH = "data/xml/";
static var ENGINE_XML_FILENAME = "engine.xml";
static var __DEBUG = true;
}
Symbol 100 MovieClip [__Packages.classes.smashing.library.depth.clipBuffer] Frame 0
class classes.smashing.library.depth.clipBuffer
{
var __sectionRoot;
function clipBuffer (parentMovie) {
var _local1 = this;
_local1.__root = new Object();
_local1.__root.clip = parentMovie;
_local1.__root.depth = 0;
_local1.__buffer = new Array();
_local1.__buffer.push(_local1.__root);
}
function reset() {
var _local2 = this;
var _local1;
while (_local2.__buffer.length > 0) {
_local1 = _local2.__buffer.pop();
removeMovieClip(_local1.clip);
}
}
function getSectionByName(sectionName) {
var _local2 = this;
var _local3 = sectionName;
var _local1 = 0;
while (_local1 < _local2.__buffer.length) {
if (_local2.__buffer[_local1].clip._name == _local3) {
return(_local2.__buffer[_local1]);
}
_local1++;
}
return(undefined);
}
function getSectionByClip(sectionClip) {
var _local2 = this;
var _local3 = sectionClip;
var _local1 = 0;
while (_local1 < _local2.__buffer.length) {
if (_local2.__buffer[_local1].clip == _local3) {
return(_local2.__buffer[_local1]);
}
_local1++;
}
return(undefined);
}
function getSection(sectionName) {
var _local1 = getSectionByName(sectionName);
return(_local1.clip);
}
function addSectionClip(sectionClipName, sectionName) {
var _local2 = this;
var _local3 = _local2.getSectionByName(sectionName);
var _local1 = new Object();
_local1.clip = _local2.createMovieClip(sectionClipName, _local3.clip);
_local1.depth = 0;
_local2.__buffer.push(_local1);
return(_local1.clip);
}
function attachSectionClip(libraryName, sectionClipName, sectionName, initObject) {
var _local2 = this;
var _local3 = _local2.getSectionByName(sectionName);
var _local1 = new Object();
_local1.clip = _local2.attachMovieClip(libraryName, sectionClipName, _local3.clip, initObject);
_local1.depth = 0;
_local2.__buffer.push(_local1);
return(_local1.clip);
}
function addSection(sectionName) {
var _local2 = this;
var _local1 = new Object();
_local1.clip = _local2.createMovieClip(sectionName, _local2.__root.clip);
_local1.depth = 0;
_local2.__buffer.push(_local1);
return(_local1.clip);
}
function setSection(sectionName) {
__sectionRoot = getSectionByName(sectionName);
}
function setSectionClip(sectionClip) {
__sectionRoot = getSectionByClip(sectionClip);
}
function createMovieClip(instanceName, parentClip) {
var _local1;
var _local2;
_local1 = getParent(parentClip);
_local2 = _local1.clip.createEmptyMovieClip(instanceName, _local1.depth++);
return(_local2);
}
function attachMovieClip(libraryName, instanceName, parentClip, initObject) {
var _local1;
var _local2;
_local1 = getParent(parentClip);
_local2 = _local1.clip.attachMovie(libraryName, instanceName, _local1.depth++, initObject);
return(_local2);
}
function getParent(parentClip) {
var _local1 = this;
if (parentClip != undefined) {
return(_local1.getSectionByClip(parentClip));
}
if (_local1.__sectionRoot != undefined) {
return(_local1.__sectionRoot);
}
return(_local1.__root);
}
}
Symbol 101 MovieClip [__Packages.classes.smashing.library.utility.utilityFPS] Frame 0
class classes.smashing.library.utility.utilityFPS
{
var __fps, __startTime, __endTime, __deltaTime, __deltaTimeMS;
function utilityFPS (fpsClip) {
var _local1 = this;
_local1.__fpsClip = fpsClip;
_local1.__fps = 0;
_local1.hide();
_local1.startFrame();
}
function show() {
var _local1 = this;
if (_local1.__fpsClip == undefined) {
} else {
_local1.__fpsClip._visible = true;
_local1.__fpsClip.enabled = true;
}
}
function hide() {
var _local1 = this;
if (_local1.__fpsClip == undefined) {
} else {
_local1.__fpsClip._visible = false;
_local1.__fpsClip.enabled = false;
}
}
function toString() {
return("FPS: " + String(__fps));
}
function update() {
endFrame();
startFrame();
}
function start() {
startFrame();
}
function startFrame() {
__startTime = getTimer();
}
function endFrame() {
var _local1 = this;
_local1.__endTime = getTimer();
_local1.__deltaTime = _local1.__endTime - _local1.__startTime;
if (_local1.__deltaTime <= 0) {
_local1.__deltaTime = 1;
}
_local1.__deltaTimeMS = _local1.__deltaTime / 1000;
var _local2 = _local1.__fps;
_local1.__fps = Math.round(1 / _local1.__deltaTimeMS);
_local2 = _local2 + _local1.__fps;
_local2 = _local2 / 2;
if (_local1.__fpsClip == undefined) {
} else {
_local1.__fpsClip.fps.text = "FPS: " + String(_local1.__fps);
}
}
function get startTime() {
return(__startTime);
}
function get endTime() {
return(__endTime);
}
function get deltaTime() {
return(__deltaTime);
}
function get deltaTimeMS() {
return(__deltaTimeMS);
}
function get fps() {
return(__fps);
}
}
Symbol 102 MovieClip [__Packages.classes.smashing.AirHockey.level] Frame 0
class classes.smashing.AirHockey.level
{
var __isPaused, __root, __camera, __renderer, __dimensions, __isReady, __isMoving, __startMovingTime, __lastMouseX, __lastMouseY, __gameOverInterval, __collision, __worldCorners, __screenCorners, __midFieldWorld, __midFieldScreen, __goalTopWorld, __goalTopScreen, __goalBottomWorld, __goalBottomScreen, __puck, __player, __enemy;
function level (root, clips, dimensions) {
var _local1 = this;
_local1.__root = root;
_local1.__clips = clips;
_local1.__dimensions = dimensions;
_local1.__cameraBounds = _local1.initCameraBounds();
_local1.__boardDirection = "vertical";
_local1.__isPaused = true;
_local1.__isReady = false;
_local1.__gameOverInterval = -1;
_local1.isGameOver = false;
_local1.__clips.addSectionClip("ENTITIES", "GAME");
_local1.__clips.addSectionClip("PUCK", "ENTITIES");
_local1.__clips.addSectionClip("PLAYER", "ENTITIES");
_local1.__clips.addSectionClip("ENEMY", "ENTITIES");
_local1.initWorld();
_local1.initCamera();
_local1.initRenderer();
_local1.__collision = new classes.smashing.library.collision.collisionTest();
var _local2;
_local2 = _local1.__clips.attachSectionClip("puck", "puck_" + _local1.__get__nextEntityID(), "PUCK");
_local1.__puck = new classes.smashing.AirHockey.puck(_local2, undefined);
_local1.__puck.spawn(new classes.smashing.library.math.vector.vector3());
_local1.__puck.setMaxVelocity(new classes.smashing.library.math.vector.vector3());
_local1.__puck.setWorldPoints(_local1.__worldCorners, _local1.__midFieldWorld);
_local1.__puck.setGoalPoints(_local1.__goalTopWorld, _local1.__goalBottomWorld);
_local2 = _local1.__clips.attachSectionClip("paddle", "player_" + _local1.__get__nextEntityID(), "PLAYER");
_local1.__player = new classes.smashing.AirHockey.player(_local2, undefined);
_local1.__player.spawn(new classes.smashing.library.math.vector.vector3());
_local1.__player.setMaxVelocity(new classes.smashing.library.math.vector.vector3());
_local1.__player.setMaxMoveSpeed(0);
_local1.__player.setWorldPoints(_local1.__worldCorners, _local1.__midFieldWorld);
_local1.__player.setCollision(_local1.__collision);
_local2 = _local1.__clips.attachSectionClip("paddle", "enemy_" + _local1.__get__nextEntityID(), "ENEMY");
_local1.__enemy = new classes.smashing.AirHockey.enemy(_local2, undefined);
_local1.__enemy.spawn(new classes.smashing.library.math.vector.vector3());
_local1.__enemy.setMaxVelocity(new classes.smashing.library.math.vector.vector3());
_local1.__enemy.setMaxMoveSpeed(0);
_local1.__enemy.setWorldPoints(_local1.__worldCorners, _local1.__midFieldWorld);
_local1.__enemy.setCollision(_local1.__collision);
_local1.__puck.setSoundFX(_local1.__root.__sfx);
_local1.__player.setSoundFX(_local1.__root.__sfx);
_local1.__enemy.setSoundFX(_local1.__root.__sfx);
_local1.__player.setEntities(_local1.__puck, _local1.__enemy);
_local1.__enemy.setEntities(_local1.__puck, _local1.__player);
_local1.__root.hit.useHandCursor = false;
}
function setDebug(debug) {
__DEBUG = debug;
}
function setBoardDirection(boardDirection) {
var _local1 = this;
var _local2 = boardDirection;
_local1.__boardDirection = _local2;
_local1.__player.setBoardDirection(_local2);
_local1.__enemy.setBoardDirection(_local2);
_local1.__puck.setBoardDirection(_local2);
}
function startLevel() {
var _local1 = this;
_local1.addRenderObjects();
_local1.__isPaused = false;
_local1.__isReady = false;
_local1.__isMoving = false;
_local1.__startMovingTime = -1;
_local1.__lastMouseX = 0;
_local1.__lastMouseY = 0;
_local1.__timeMinutes = 1;
_local1.__timeSeconds = 0;
_local1.__player.__set__score(0);
_local1.__enemy.__set__score(0);
_local1.isGameOver = false;
_local1.__puck.setMoveX(0);
_local1.__puck.setMoveY(0);
_local1.__puck.velocity.zero();
_local1.__puck.__set__slowDownScalar(1);
_local1.__puck.respawn();
_local1.__player.respawn();
_local1.__enemy.respawn();
_local1.__puck.enable();
_local1.__player.enable();
_local1.__enemy.enable();
_local1.__player.__set__canAttack(false);
_local1.__enemy.__set__canAttack(false);
_local1.__root.hud.gotoAndStop("off");
_local1.__root.hud.away2.gotoAndStop("number0");
_local1.__root.hud.away1.gotoAndStop("number0");
_local1.__root.hud.home2.gotoAndStop("number0");
_local1.__root.hud.home1.gotoAndStop("number0");
_local1.__player.renderClip.gotoAndPlay("blink");
_local1.__puck.renderClip.gotoAndPlay("blink");
_local1.update(0.032);
_local1.__controls = new classes.smashing.library.controls.controls(_local1);
_local1.__controls.bindMouse("onMouseDown", _local1.grabPlayer);
_local1.__controls.bindMouse("onMouseUp", _local1.releasePlayer);
_local1.__controls.bindMouse("onMouseMove", _local1.movePlayer);
var controller = _local1;
_local1.__root.hit.useHandCursor = false;
_local1.__root.hit.onRollOut = (_local1.__root.hit.onDragOut = (_local1.__root.hit.onReleaseOutside = function () {
Mouse.show();
}));
_local1.__root.hit.onRollOver = (_local1.__root.hit.onDragOver = function () {
if (controller.__get__isMoving()) {
Mouse.hide();
}
});
}
function setReady() {
var _local1 = this;
_local1.__isReady = true;
_local1.__player.__set__canAttack(true);
_local1.__player.setReady();
_local1.__enemy.__set__canAttack(false);
}
function stopLevel() {
var _local1 = this;
clearInterval(_local1.__gameOverInterval);
_local1.isGameOver = true;
_local1.__gameOverInterval = -1;
delete _local1.__root.hit.onRollOut;
delete _local1.__root.hit.onDragOut;
delete _local1.__root.hit.onReleaseOutside;
delete _local1.__root.hit.onRollOver;
delete _local1.__root.hit.onDragOver;
_local1.__isPaused = true;
_local1.__puck.respawn();
_local1.__player.respawn();
_local1.__enemy.respawn();
_local1.__puck.disable();
_local1.__player.disable();
_local1.__enemy.disable();
_local1.__controls.reset();
delete _local1.__controls;
_local1.__controls = undefined;
_local1.__root.gotoAndStop("end");
if (_local1.__player.__get__score() > _local1.__enemy.__get__score()) {
_local1.__root.popup.gotoAndStop("win");
} else if (_local1.__enemy.__get__score() > _local1.__player.__get__score()) {
_local1.__root.popup.gotoAndStop("lose");
} else {
_local1.__root.popup.gotoAndStop("draw");
}
Mouse.show();
}
function pauseLevel() {
__isPaused = true;
}
function unpauseLevel() {
__isPaused = false;
}
function update(deltaTime) {
var _local1 = this;
var _local2 = deltaTime;
if (_local1.__isPaused) {
} else {
_local1.updateHud(_local2);
_local1.__controls.update(_local2);
_local1.__camera.update(_local2);
if (_local1.__player.hitPaused) {
_local1.__player.hitPausedTimer = _local1.__player.hitPausedTimer - _local2;
if (_local1.__player.hitPausedTimer <= 0) {
_local1.__player.hitPaused = false;
}
}
_local1.__player.update(_local2);
_local1.__player.postMoveUpdate();
_local1.__enemy.update(_local2);
_local1.__enemy.postMoveUpdate();
_local1.__puck.update(_local2);
_local1.__puck.postMoveUpdate();
_local1.checkScore();
_local1.__renderer.renderBegin();
_local1.__renderer.renderMeshBegin(_local1.__rendererClip);
_local1.__rendererClip.clear();
_local1.__renderer.update(_local1);
_local1.__renderer.renderMeshEnd();
_local1.__renderer.renderEnd();
}
}
function grabPlayer(gameLevel) {
var _local1 = gameLevel;
if (_local1.__get__isPaused()) {
} else if (_local1.__get__isMoving()) {
} else {
_local1.__set__isMoving(true);
_local1.__set__lastMouseX(_local1.root._xmouse);
_local1.__set__lastMouseY(_local1.root._ymouse);
_local1.__set__startMovingTime(getTimer());
_local1.player.renderClip.gotoAndStop("off");
Mouse.hide();
}
}
function releasePlayer(gameLevel) {
var _local1 = gameLevel;
if (_local1.__get__isPaused()) {
} else if (!_local1.__get__isMoving()) {
} else if ((getTimer() - _local1.__get__startMovingTime()) < 500) {
} else {
_local1.__set__startMovingTime(-1);
_local1.__set__isMoving(false);
Mouse.show();
}
}
function movePlayer(gameLevel) {
var _local2 = gameLevel;
if (_local2.__get__isPaused()) {
} else if (!_local2.__get__isMoving()) {
} else {
var _local1 = new classes.smashing.library.math.vector.vector3(_local2.root._xmouse, _local2.root._ymouse, 0);
_local1.__set__y((_local1.__get__y() * -1) + _local2.dimensions.height);
_local1.x = _local1.x - _local2.dimensions.halfWidth;
_local1.y = _local1.y - _local2.dimensions.halfHeight;
var _local3 = _local1.__get__y();
_local1.__set__y(_local1.z);
_local1.__set__z(_local3);
_local1.x = _local1.x + _local2.camera.x;
_local1.y = _local1.y + _local2.camera.y;
_local1.z = _local1.z + _local2.camera.z;
_local1.__set__y(_local1.z);
_local1.x = _local1.x + 68;
_local1.y = _local1.y - 68;
_local1.y = _local1.y * 2;
var scale = (1.33 * (1 + (_local1.__get__y() / _local2.camera.farPlane)));
_local1.x = _local1.x * scale;
_local1.__set__z(0);
_local1.y = _local1.y * 2;
_local2.player.moveTo(_local1);
_local2.__set__lastMouseX(_local2.root._xmouse);
_local2.__set__lastMouseY(_local2.root._ymouse);
}
}
function initWorld() {
var _local1 = this;
_local1.__worldCorners = new Array();
_local1.__worldCorners.push(new classes.smashing.library.math.vector.vector3());
_local1.__worldCorners.push(new classes.smashing.library.math.vector.vector3());
_local1.__worldCorners.push(new classes.smashing.library.math.vector.vector3());
_local1.__worldCorners.push(new classes.smashing.library.math.vector.vector3());
_local1.__screenCorners = new Array();
_local1.__screenCorners.push(new classes.smashing.library.math.vector.vector2());
_local1.__screenCorners.push(new classes.smashing.library.math.vector.vector2());
_local1.__screenCorners.push(new classes.smashing.library.math.vector.vector2());
_local1.__screenCorners.push(new classes.smashing.library.math.vector.vector2());
_local1.__edgeLines = new Array();
_local1.__edgeLines.push(new classes.smashing.library.math.line.line2(_local1.__screenCorners[0], _local1.__screenCorners[1]));
_local1.__edgeLines.push(new classes.smashing.library.math.line.line2(_local1.__screenCorners[1], _local1.__screenCorners[2]));
_local1.__edgeLines.push(new classes.smashing.library.math.line.line2(_local1.__screenCorners[2], _local1.__screenCorners[3]));
_local1.__edgeLines.push(new classes.smashing.library.math.line.line2(_local1.__screenCorners[3], _local1.__screenCorners[0]));
_local1.__midFieldWorld = new Array();
_local1.__midFieldWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__midFieldWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__midFieldScreen = new Array();
_local1.__midFieldScreen.push(new classes.smashing.library.math.vector.vector2());
_local1.__midFieldScreen.push(new classes.smashing.library.math.vector.vector2());
_local1.__goalTopWorld = new Array();
_local1.__goalTopWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__goalTopWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__goalTopScreen = new Array();
_local1.__goalTopScreen.push(new classes.smashing.library.math.vector.vector2());
_local1.__goalTopScreen.push(new classes.smashing.library.math.vector.vector2());
_local1.__goalBottomWorld = new Array();
_local1.__goalBottomWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__goalBottomWorld.push(new classes.smashing.library.math.vector.vector3());
_local1.__goalBottomScreen = new Array();
_local1.__goalBottomScreen.push(new classes.smashing.library.math.vector.vector2());
_local1.__goalBottomScreen.push(new classes.smashing.library.math.vector.vector2());
}
function initCamera() {
var _local1 = this;
_local1.__camera = new classes.smashing.library.camera.camera3D();
_local1.__camera.setBounds(_local1.__dimensions, _local1.__cameraBounds);
_local1.__camera.__set__x(0);
_local1.__camera.__set__y(0);
_local1.__camera.__set__z(90);
_local1.__camera.setRotation(-0.27, 0, 0);
_local1.__camera.initFrustrum(-1.33, 1.33, -1, 1, 1, 2500);
_local1.__camera.initMode();
}
function initRenderer() {
var _local1 = this;
_local1.__rendererClip = _local1.__clips.addSectionClip("RENDERER", "GAME");
_local1.__renderer = new classes.smashing.AirHockey.render(_local1.__dimensions);
_local1.__renderer.setCamera3D(_local1.__camera);
}
function initCameraBounds() {
var _local2 = this;
var _local1 = new Object();
_local1.left = -_local2.__dimensions.halfWidth;
_local1.right = _local2.__dimensions.halfWidth;
_local1.bottom = -_local2.__dimensions.halfHeight;
_local1.top = _local2.__dimensions.halfHeight;
return(_local1);
}
function addRenderObjects() {
var _local1 = this;
if (!__DEBUG) {
} else {
_local1.__renderer.lists.addLine2(_local1.__edgeLines[0]);
_local1.__renderer.lists.addLine2(_local1.__edgeLines[1]);
_local1.__renderer.lists.addLine2(_local1.__edgeLines[2]);
_local1.__renderer.lists.addLine2(_local1.__edgeLines[3]);
_local1.__renderer.lists.addVector2(_local1.__screenCorners[0]);
_local1.__renderer.lists.addVector2(_local1.__screenCorners[1]);
_local1.__renderer.lists.addVector2(_local1.__screenCorners[2]);
_local1.__renderer.lists.addVector2(_local1.__screenCorners[3]);
_local1.__renderer.lists.addVector2(_local1.__midFieldScreen[0]);
_local1.__renderer.lists.addVector2(_local1.__midFieldScreen[1]);
_local1.__renderer.lists.addVector2(_local1.__goalTopScreen[0]);
_local1.__renderer.lists.addVector2(_local1.__goalTopScreen[1]);
_local1.__renderer.lists.addVector2(_local1.__goalBottomScreen[0]);
_local1.__renderer.lists.addVector2(_local1.__goalBottomScreen[1]);
}
}
function updateHud(deltaTime) {
var _local1 = this;
if (!_local1.__isReady) {
if (_local1.__timeMinutes > 0) {
_local1.__root.hud.timeMinutes.gotoAndStop("number1");
} else {
_local1.__root.hud.timeMinutes.gotoAndStop("number0");
}
_local1.__root.hud.timeSeconds2.gotoAndStop("number0");
_local1.__root.hud.timeSeconds1.gotoAndStop("number0");
_local1.__root.hud.gotoAndStop("off");
} else {
var _local2;
_local2 = String(_local1.__player.__get__score());
if (_local2.length > 1) {
_local1.__root.hud.home2.gotoAndStop("number" + _local2.substr(0, 1));
_local1.__root.hud.home1.gotoAndStop("number" + _local2.substr(1, 1));
} else {
_local1.__root.hud.home2.gotoAndStop("number0");
_local1.__root.hud.home1.gotoAndStop("number" + _local2.substr(0, 1));
}
_local2 = String(_local1.__enemy.__get__score());
if (_local2.length > 1) {
_local1.__root.hud.away2.gotoAndStop("number" + _local2.substr(0, 1));
_local1.__root.hud.away1.gotoAndStop("number" + _local2.substr(1, 1));
} else {
_local1.__root.hud.away2.gotoAndStop("number0");
_local1.__root.hud.away1.gotoAndStop("number" + _local2.substr(0, 1));
}
if ((_local1.__timeSeconds <= 0) || (_local1.__timeSeconds < deltaTime)) {
if (_local1.__timeMinutes > 0) {
_local1.__timeMinutes--;
_local1.__timeSeconds = _local1.__timeSeconds + 60;
} else {
_local1.__isReady = false;
_local1.__player.__set__canAttack(false);
_local1.__enemy.__set__canAttack(false);
_local1.__puck.__set__slowDownScalar(0.95);
_local1.__root.__sfx.onSound("sfx_end");
_local1.__gameOverInterval = setInterval(_local1.gameOver, 3000, _local1);
}
}
_local1.__timeSeconds = _local1.__timeSeconds - deltaTime;
var _local3;
var mins = _local1.__timeMinutes;
if (mins > 9) {
mins = 9;
}
if (((_local1.__root.hud._currentframe == 1) && (_local1.__timeMinutes == 0)) && (_local1.__timeSeconds < 10)) {
_local1.__root.hud.gotoAndStop("blink");
}
_local1.__root.hud.timeMinutes.gotoAndStop("number" + mins);
_local3 = String(Math.round(_local1.__timeSeconds));
if (_local3.length > 1) {
_local1.__root.hud.timeSeconds2.gotoAndStop("number" + _local3.substr(0, 1));
_local1.__root.hud.timeSeconds1.gotoAndStop("number" + _local3.substr(1, 1));
} else {
_local1.__root.hud.timeSeconds2.gotoAndStop("number0");
_local1.__root.hud.timeSeconds1.gotoAndStop("number" + _local3.substr(0, 1));
}
}
}
function gameOver(l) {
l.stopLevel();
}
function checkScore() {
var _local1 = this;
if (_local1.__puck.__get__scoredGoal() == "player") {
_local1.__player.scored();
} else if (_local1.__puck.__get__scoredGoal() == "enemy") {
_local1.__enemy.scored();
}
}
function get root() {
return(__root);
}
function get camera() {
return(__camera);
}
function get renderer() {
return(__renderer);
}
function get dimensions() {
return(__dimensions);
}
function get isPaused() {
return(__isPaused);
}
function get isReady() {
return(__isReady);
}
function get isMoving() {
return(__isMoving);
}
function set isMoving(value) {
__isMoving = value;
//return(isMoving);
}
function get startMovingTime() {
return(__startMovingTime);
}
function set startMovingTime(value) {
__startMovingTime = value;
//return(startMovingTime);
}
function get lastMouseX() {
return(__lastMouseX);
}
function set lastMouseX(value) {
__lastMouseX = value;
//return(lastMouseX);
}
function get lastMouseY() {
return(__lastMouseY);
}
function set lastMouseY(value) {
__lastMouseY = value;
//return(lastMouseY);
}
function get gameOverInterval() {
return(__gameOverInterval);
}
function set gameOverInterval(value) {
__gameOverInterval = value;
//return(gameOverInterval);
}
function get mathUtility() {
return(__collision.__get__mathUtility());
}
function get collision() {
return(__collision);
}
function get worldCorners() {
return(__worldCorners);
}
function get screenCorners() {
return(__screenCorners);
}
function get midFieldWorld() {
return(__midFieldWorld);
}
function get midFieldScreen() {
return(__midFieldScreen);
}
function get goalTopWorld() {
return(__goalTopWorld);
}
function get goalTopScreen() {
return(__goalTopScreen);
}
function get goalBottomWorld() {
return(__goalBottomWorld);
}
function get goalBottomScreen() {
return(__goalBottomScreen);
}
function get puck() {
return(__puck);
}
function get player() {
return(__player);
}
function get enemy() {
return(__enemy);
}
function get nextEntityID() {
return(__nextEntityID++);
}
function get log() {
return(classes.smashing.library.utility.utilityDebug.log);
}
var isGameOver = false;
static var __DEBUG = false;
static var __nextEntityID = 0;
}
Symbol 103 MovieClip [__Packages.classes.smashing.library.render.render] Frame 0
class classes.smashing.library.render.render
{
var __camera2, __camera3, __isRendering, __dimensions, __isRenderingMesh, __renderMesh, __draw, __lists;
function render (dimensions) {
var _local1 = this;
_local1.__dimensions = dimensions;
_local1.__isRendering = false;
_local1.__isRenderingMesh = false;
_local1.__renderMesh = undefined;
_local1.__draw = new classes.smashing.library.render.renderDraw();
_local1.__lists = new classes.smashing.library.render.renderList();
}
function setCamera2D(c) {
__camera2 = c;
}
function setCamera3D(c) {
__camera3 = c;
}
function renderBegin() {
if (__isRendering) {
return(false);
}
__isRendering = true;
return(true);
}
function renderEnd() {
if (!__isRendering) {
return(undefined);
}
__isRendering = false;
}
function renderMeshBegin(renderMesh) {
var _local1 = this;
var _local2 = renderMesh;
if (!_local1.__isRendering) {
return(false);
}
if (_local1.__isRenderingMesh) {
return(false);
}
if (_local2 == undefined) {
return(false);
}
_local1.__draw.renderMesh = _local2;
_local1.__renderMesh = _local2;
_local1.__isRenderingMesh = true;
return(true);
}
function renderMeshEnd() {
var _local1 = this;
if (!_local1.__isRendering) {
} else if (!_local1.__isRenderingMesh) {
} else {
_local1.__draw.renderMesh = undefined;
_local1.__renderMesh = undefined;
_local1.__isRenderingMesh = false;
}
}
function update(gameLevel) {
var _local2 = this;
var _local1;
_local1 = 0;
while (_local1 < _local2.__lists.sphere3List.length) {
_local2.__draw.drawCircle2(_local2.__lists.sphere3List[_local1]);
_local1++;
}
_local1 = 0;
while (_local1 < _local2.__lists.sphere2List.length) {
_local2.__draw.drawCircle2(_local2.__lists.sphere2List[_local1]);
_local1++;
}
_local1 = 0;
while (_local1 < _local2.__lists.line3List.length) {
_local2.__draw.drawLine3(_local2.__lists.line3List[_local1].v0, _local2.__lists.line3List[_local1].v1);
_local1++;
}
_local1 = 0;
while (_local1 < _local2.__lists.line2List.length) {
_local2.__draw.drawLine2(_local2.__lists.line2List[_local1].v0, _local2.__lists.line2List[_local1].v1);
_local1++;
}
_local1 = 0;
while (_local1 < _local2.__lists.vector3List.length) {
_local2.__draw.drawPoint3(_local2.__lists.vector3List[_local1]);
_local1++;
}
_local1 = 0;
while (_local1 < _local2.__lists.vector2List.length) {
_local2.__draw.drawPoint2(_local2.__lists.vector2List[_local1]);
_local1++;
}
}
function transform(position) {
var _local2 = this;
var _local1 = new classes.smashing.library.math.vector.vector3();
_local1.__set__x(position.__get__x() - _local2.__camera2.__get__x());
_local1.__set__y(position.__get__y() - _local2.__camera2.__get__y());
_local2.centerOnScreen(_local1);
_local2.worldToFlash(_local1);
return(_local1);
}
function clipAgainstScreen(e) {
var _local1 = e;
if (((_local1.renderClip._y + _local1.height) < 0) || ((_local1.renderClip._y - _local1.height) > __dimensions.height)) {
_local1.hideRenderClip();
} else {
_local1.showRenderClip();
}
}
function worldToFlash(wPosition) {
wPosition.__set__y((wPosition.__get__y() - __dimensions.height) * -1);
}
function flashToWorld(fPosition) {
fPosition.__set__y((fPosition.__get__y() * -1) + __dimensions.height);
}
function transform3D(position) {
var _local2 = this;
var _local1 = new classes.smashing.library.math.vector.vector3();
_local1.copyFrom(position);
_local1.subtract(_local2.__camera3.__get__position());
_local1.multiplyByMatrix(_local2.__camera3.__get__rotationGlobal());
var temp = _local1.__get__y();
_local1.__set__y(_local1.z);
_local1.__set__z(temp);
var _local3 = 1 - (position.__get__y() / _local2.__camera3.__get__farPlane());
_local1.x = _local1.x * _local3;
_local1.y = _local1.y * _local3;
_local1.multiplyByMatrix(_local2.__camera3.__get__perspective());
_local2.centerOnScreen(_local1);
_local2.worldToFlash(_local1);
return(_local1);
}
function get3DScale(depthZ) {
return((1 - (depthZ / __camera3.__get__farPlane())) * 100);
}
function centerOnScreen(wPosition) {
wPosition.x = wPosition.x + __dimensions.halfWidth;
wPosition.y = wPosition.y + __dimensions.halfHeight;
}
function get isRendering() {
return(__isRendering);
}
function get isRenderingMesh() {
return(__isRenderingMesh);
}
function get renderMesh() {
return(__renderMesh);
}
function get draw() {
return(__draw);
}
function get lists() {
return(__lists);
}
function get dimensions() {
return(__dimensions);
}
}
Symbol 104 MovieClip [__Packages.classes.smashing.library.render.renderDraw] Frame 0
class classes.smashing.library.render.renderDraw
{
var __drawPoint, renderMesh;
function renderDraw () {
var _local1 = this;
_local1.renderMesh = undefined;
_local1.__drawPoint = new Object();
_local1.__drawPoint = {x:0, y:0};
_local1.__drawLine = new Object();
_local1.__drawLine.p0 = new Object();
_local1.__drawLine.p1 = new Object();
_local1.__drawLine.p0 = {x:0, y:0};
_local1.__drawLine.p1 = {x:0, y:0};
_local1.__drawTriangle = new Object();
_local1.__drawTriangle.p0 = new Object();
_local1.__drawTriangle.p1 = new Object();
_local1.__drawTriangle.p2 = new Object();
_local1.__drawTriangle.p0 = {x:0, y:0};
_local1.__drawTriangle.p1 = {x:0, y:0};
_local1.__drawTriangle.p2 = {x:0, y:0};
_local1.__drawQuadratic = new Object();
_local1.__drawQuadratic.p0 = new Object();
_local1.__drawQuadratic.p1 = new Object();
_local1.__drawQuadratic.p2 = new Object();
_local1.__drawQuadratic.p3 = new Object();
_local1.__drawQuadratic.p0 = {x:0, y:0};
_local1.__drawQuadratic.p1 = {x:0, y:0};
_local1.__drawQuadratic.p2 = {x:0, y:0};
_local1.__drawQuadratic.p3 = {x:0, y:0};
}
function drawPoint2(v, color) {
__drawPoint = {x:v.__get__x(), y:v.__get__y()};
drawPoint(((color == undefined) ? 16711680 : (color)));
}
function drawPoint3(v, color) {
__drawPoint = {x:v.__get__x(), y:v.__get__y()};
drawPoint(((color == undefined) ? 16711680 : (color)));
}
function drawLine2(v0, v1, color) {
var _local1 = this;
_local1.__drawLine.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawLine.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.drawLine(((color == undefined) ? 65280 : (color)));
}
function drawLine3(v0, v1, color) {
var _local1 = this;
_local1.__drawLine.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawLine.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.drawLine(((color == undefined) ? 65280 : (color)));
}
function drawTriangle2(v0, v1, v2, color) {
var _local1 = this;
_local1.__drawTriangle.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawTriangle.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.__drawTriangle.p2 = {x:v2.__get__x(), y:v2.__get__y()};
_local1.drawTriangle(((color == undefined) ? 255 : (color)));
}
function drawTriangle3(v0, v1, v2, color) {
var _local1 = this;
_local1.__drawTriangle.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawTriangle.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.__drawTriangle.p2 = {x:v2.__get__x(), y:v2.__get__y()};
_local1.drawTriangle(((color == undefined) ? 255 : (color)));
}
function drawQuadradic2(v0, v1, v2, v3, color) {
var _local1 = this;
_local1.__drawQuadratic.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawQuadratic.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.__drawQuadratic.p2 = {x:v2.__get__x(), y:v2.__get__y()};
_local1.__drawQuadratic.p3 = {x:v3.__get__x(), y:v3.__get__y()};
_local1.drawQuadratic(((color == undefined) ? 65535 : (color)));
}
function drawQuadradic3(v0, v1, v2, v3, color) {
var _local1 = this;
_local1.__drawQuadratic.p0 = {x:v0.__get__x(), y:v0.__get__y()};
_local1.__drawQuadratic.p1 = {x:v1.__get__x(), y:v1.__get__y()};
_local1.__drawQuadratic.p2 = {x:v2.__get__x(), y:v2.__get__y()};
_local1.__drawQuadratic.p3 = {x:v3.__get__x(), y:v3.__get__y()};
_local1.drawQuadratic(((color == undefined) ? 65535 : (color)));
}
function drawCircle2(s) {
var _local1 = s;
drawCircle(_local1.__get__x(), _local1.__get__y(), _local1.__get__radius(), ((_local1.color == undefined) ? 16711680 : (_local1.color)));
}
function drawPoint(color) {
var _local1 = this;
_local1.renderMesh.beginFill(255);
_local1.renderMesh.lineStyle(1, color, 100);
_local1.renderMesh.moveTo(_local1.__drawPoint.x - 2, _local1.__drawPoint.y - 2);
_local1.renderMesh.lineTo(_local1.__drawPoint.x + 2, _local1.__drawPoint.y - 2);
_local1.renderMesh.lineTo(_local1.__drawPoint.x + 2, _local1.__drawPoint.y + 2);
_local1.renderMesh.lineTo(_local1.__drawPoint.x - 2, _local1.__drawPoint.y + 2);
_local1.renderMesh.lineTo(_local1.__drawPoint.x - 2, _local1.__drawPoint.y - 2);
_local1.renderMesh.endFill();
}
function drawLine(color) {
var _local1 = this;
_local1.renderMesh.beginFill(color);
_local1.renderMesh.lineStyle(1, color, 100);
_local1.renderMesh.moveTo(_local1.__drawLine.p0.x, _local1.__drawLine.p0.y);
_local1.renderMesh.lineTo(_local1.__drawLine.p1.x, _local1.__drawLine.p1.y);
_local1.renderMesh.endFill();
}
function drawTriangle(color) {
var _local1 = this;
_local1.renderMesh.beginFill(color);
_local1.renderMesh.lineStyle(1, color, 100);
_local1.renderMesh.moveTo(_local1.__drawTriangle.p0.x, _local1.__drawTriangle.p0.y);
_local1.renderMesh.lineTo(_local1.__drawTriangle.p1.x, _local1.__drawTriangle.p1.y);
_local1.renderMesh.lineTo(_local1.__drawTriangle.p2.x, _local1.__drawTriangle.p2.y);
_local1.renderMesh.lineTo(_local1.__drawTriangle.p0.x, _local1.__drawTriangle.p0.y);
_local1.renderMesh.endFill();
}
function drawQuadratic(color) {
var _local1 = this;
_local1.renderMesh.beginFill(color);
_local1.renderMesh.lineStyle(1, color, 100);
_local1.renderMesh.moveTo(_local1.__drawQuadratic.p0.x, _local1.__drawQuadratic.p0.y);
_local1.renderMesh.lineTo(_local1.__drawQuadratic.p1.x, _local1.__drawQuadratic.p1.y);
_local1.renderMesh.lineTo(_local1.__drawQuadratic.p2.x, _local1.__drawQuadratic.p2.y);
_local1.renderMesh.lineTo(_local1.__drawQuadratic.p3.x, _local1.__drawQuadratic.p3.y);
_local1.renderMesh.lineTo(_local1.__drawQuadratic.p0.x, _local1.__drawQuadratic.p0.y);
_local1.renderMesh.endFill();
}
function drawCircle(x, y, r, color) {
var _local1 = r;
var _local2 = y;
var _local3 = x;
renderMesh.lineStyle(1, color);
renderMesh.moveTo(_local3 + _local1, _local2);
renderMesh.curveTo(_local1 + _local3, (0.414213562373095 * _local1) + _local2, (0.707106781186547 * _local1) + _local3, (0.707106781186547 * _local1) + _local2);
renderMesh.curveTo((0.414213562373095 * _local1) + _local3, _local1 + _local2, _local3, _local1 + _local2);
renderMesh.curveTo((-0.414213562373095 * _local1) + _local3, _local1 + _local2, (-0.707106781186547 * _local1) + _local3, (0.707106781186547 * _local1) + _local2);
renderMesh.curveTo((-_local1) + _local3, (0.414213562373095 * _local1) + _local2, (-_local1) + _local3, _local2);
renderMesh.curveTo((-_local1) + _local3, (-0.414213562373095 * _local1) + _local2, (-0.707106781186547 * _local1) + _local3, (-0.707106781186547 * _local1) + _local2);
renderMesh.curveTo((-0.414213562373095 * _local1) + _local3, (-_local1) + _local2, _local3, (-_local1) + _local2);
renderMesh.curveTo((0.414213562373095 * _local1) + _local3, (-_local1) + _local2, (0.707106781186547 * _local1) + _local3, (-0.707106781186547 * _local1) + _local2);
renderMesh.curveTo(_local1 + _local3, (-0.414213562373095 * _local1) + _local2, _local1 + _local3, _local2);
}
}
Symbol 105 MovieClip [__Packages.classes.smashing.library.math.vector.vector2] Frame 0
class classes.smashing.library.math.vector.vector2
{
var __x, __y;
function vector2 (x, y) {
__x = ((x == undefined) ? 0 : (x));
__y = ((y == undefined) ? 0 : (y));
}
function copyTo(vector) {
vector.__set__x(__x);
vector.__set__y(__y);
}
function copyFrom(vector) {
__x = vector.x;
__y = vector.y;
}
function setXY(valueX, valueY) {
__x = valueX;
__y = valueY;
}
function addition(vector) {
var _local1 = this;
_local1.setXY(_local1.__x + vector.__get__x(), _local1.__y + vector.__get__y());
}
function additionXY(valueX, valueY) {
var _local1 = this;
_local1.setXY(_local1.__x + valueX, _local1.__y + valueY);
}
function subtract(vector) {
var _local1 = this;
_local1.setXY(_local1.__x - vector.__get__x(), _local1.__y - vector.__get__y());
}
function subtractXY(valueX, valueY) {
var _local1 = this;
_local1.setXY(_local1.__x - valueX, _local1.__y - valueY);
}
function divide(scalar) {
var _local1 = this;
_local1.setXY(_local1.__x / scalar, _local1.__y / scalar);
}
function multiplyByVector(vector) {
var _local1 = this;
_local1.setXY(_local1.__x * vector.__get__x(), _local1.__y * vector.__get__y());
}
function multiplyByVectorComponents(valueX, valueY) {
var _local1 = this;
_local1.setXY(_local1.__get__x() * valueX, _local1.__get__y() * valueY);
}
function scale(scalar) {
var _local1 = this;
_local1.setXY(_local1.__get__x() * scalar, _local1.__get__y() * scalar);
}
function normalize() {
divide(getLength());
}
function dot(vector) {
var _local1;
_local1 = (x * vector.__get__x()) + (y * vector.__get__y());
return(_local1);
}
function getLength2() {
var _local1 = this;
return((_local1.__x * _local1.__x) + (_local1.__y * _local1.__y));
}
function getLength() {
return(Math.sqrt(getLength2()));
}
function zero() {
setXY(0, 0);
}
function toString() {
return(((("VECTOR [" + __x) + ", ") + __y) + "]");
}
function set x(value) {
__x = value;
//return(x);
}
function get x() {
return(__x);
}
function set y(value) {
__y = value;
//return(y);
}
function get y() {
return(__y);
}
}
Symbol 106 MovieClip [__Packages.classes.smashing.library.math.vector.vector3] Frame 0
class classes.smashing.library.math.vector.vector3
{
var __x, __y, __z;
function vector3 (x, y, z) {
var _local1 = this;
_local1.__x = ((x == undefined) ? 0 : (x));
_local1.__y = ((y == undefined) ? 0 : (y));
_local1.__z = ((z == undefined) ? 0 : (z));
}
function copyTo(vector) {
var _local1 = this;
var _local2 = vector;
_local2.__set__x(_local1.__x);
_local2.__set__y(_local1.__y);
_local2.__set__z(_local1.__z);
}
function copyFrom(vector) {
var _local1 = this;
var _local2 = vector;
_local1.__x = _local2.x;
_local1.__y = _local2.y;
_local1.__z = _local2.z;
}
function setXYZ(valueX, valueY, valueZ) {
var _local1 = this;
_local1.__x = valueX;
_local1.__y = valueY;
if (valueZ != undefined) {
_local1.__z = valueZ;
}
}
function addition(vector) {
var _local1 = this;
var _local2 = vector;
_local1.setXYZ(_local1.__x + _local2.__get__x(), _local1.__y + _local2.__get__y(), _local1.__z + _local2.__get__z());
}
function additionXYZ(valueX, valueY, valueZ) {
var _local1 = this;
_local1.setXYZ(_local1.__x + valueX, _local1.__y + valueY, _local1.__z + valueZ);
}
function subtract(vector) {
var _local1 = this;
var _local2 = vector;
_local1.setXYZ(_local1.__x - _local2.__get__x(), _local1.__y - _local2.__get__y(), _local1.__z - _local2.__get__z());
}
function subtractXYZ(valueX, valueY, valueZ) {
var _local1 = this;
_local1.setXYZ(_local1.__x - valueX, _local1.__y - valueY, _local1.__z - valueZ);
}
function divide(scalar) {
var _local1 = this;
var _local2 = scalar;
_local1.setXYZ(_local1.__x / _local2, _local1.__y / _local2, _local1.__z / _local2);
}
function multiplyByVector(vector) {
var _local1 = this;
var _local2 = vector;
_local1.setXYZ(_local1.__x * _local2.__get__x(), _local1.__y * _local2.__get__y(), _local1.__z * _local2.__get__z());
}
function multiplyByVectorComponents(valueX, valueY, valueZ) {
var _local1 = this;
if (valueZ != undefined) {
_local1.setXYZ(_local1.__get__x() * valueX, _local1.__get__y() * valueY, _local1.__get__z() * valueZ);
}
_local1.setXYZ(_local1.__get__x() * valueX, _local1.__get__y() * valueY);
}
function multiplyByMatrix(matrix) {
var _local1 = this;
var _local2 = {x:0, y:0, z:0};
var m0 = matrix.__get__matrix0();
var m1 = matrix.__get__matrix1();
var m2 = matrix.__get__matrix2();
var _local3 = matrix.__get__matrix3();
_local2.x = (((_local1.__get__x() * m0[0]) + (_local1.__get__y() * m1[0])) + (_local1.__get__z() * m2[0])) + _local3[0];
_local2.y = (((_local1.__get__x() * m0[1]) + (_local1.__get__y() * m1[1])) + (_local1.__get__z() * m2[1])) + _local3[1];
_local2.z = (((_local1.__get__x() * m0[2]) + (_local1.__get__y() * m1[2])) + (_local1.__get__z() * m2[2])) + _local3[2];
_local1.setXYZ(_local2.x, _local2.y, _local2.z);
}
function scale(scalar) {
var _local1 = this;
var _local2 = scalar;
_local1.setXYZ(_local1.__get__x() * _local2, _local1.__get__y() * _local2, _local1.__get__z() * _local2);
}
function normalize() {
divide(getLength());
}
function dot(vector) {
var _local2 = this;
var _local3 = vector;
var _local1;
_local1 = ((_local2.__get__x() * _local3.__get__x()) + (_local2.__get__y() * _local3.__get__y())) + (_local2.__get__z() * _local3.__get__z());
return(_local1);
}
function cross(vector) {
var _local2 = this;
var _local3 = vector;
var _local1 = new classes.smashing.library.math.vector.vector3();
_local1.__set__x((_local2.__get__y() * _local3.__get__z()) - (_local3.__get__y() * _local2.__get__z()));
_local1.__set__y((_local2.__get__z() * _local3.__get__x()) - (_local3.__get__z() * _local2.__get__x()));
_local1.__set__z((_local2.__get__x() * _local3.__get__y()) - (_local3.__get__x() * _local2.__get__y()));
return(_local1);
}
function getLength2() {
var _local1 = this;
return(((_local1.__x * _local1.__x) + (_local1.__y * _local1.__y)) + (_local1.__z * _local1.__z));
}
function getLength() {
return(Math.sqrt(getLength2()));
}
function zero() {
setXYZ(0, 0, 0);
}
function toString() {
var _local1 = this;
return(((((("VECTOR [" + _local1.__x) + ", ") + _local1.__y) + ", ") + _local1.__z) + "]");
}
function set x(value) {
__x = value;
//return(x);
}
function get x() {
return(__x);
}
function set y(value) {
__y = value;
//return(y);
}
function get y() {
return(__y);
}
function set z(value) {
__z = value;
//return(z);
}
function get z() {
return(__z);
}
function get v2() {
return(new classes.smashing.library.math.vector.vector2(__x, __y));
}
}
Symbol 107 MovieClip [__Packages.classes.smashing.library.math.matrix.matrix4] Frame 0
class classes.smashing.library.math.matrix.matrix4
{
var __matrix0, __matrix1, __matrix2, __matrix3;
function matrix4 () {
var _local1 = this;
_local1.__matrix0 = new Array();
_local1.__matrix1 = new Array();
_local1.__matrix2 = new Array();
_local1.__matrix3 = new Array();
}
function copyFrom(matrix) {
var _local1 = matrix;
var _local2 = this;
_local2.matrix0[0] = _local1.matrix0[0];
_local2.matrix1[0] = _local1.matrix1[0];
_local2.matrix2[0] = _local1.matrix2[0];
_local2.matrix3[0] = _local1.matrix3[0];
_local2.matrix0[1] = _local1.matrix0[1];
_local2.matrix1[1] = _local1.matrix1[1];
_local2.matrix2[1] = _local1.matrix2[1];
_local2.matrix3[1] = _local1.matrix3[1];
_local2.matrix0[2] = _local1.matrix0[2];
_local2.matrix1[2] = _local1.matrix1[2];
_local2.matrix2[2] = _local1.matrix2[2];
_local2.matrix3[2] = _local1.matrix3[2];
_local2.matrix0[3] = _local1.matrix0[3];
_local2.matrix1[3] = _local1.matrix1[3];
_local2.matrix2[3] = _local1.matrix2[3];
_local2.matrix3[3] = _local1.matrix3[3];
}
function copyTo(matrix) {
var _local1 = matrix;
var _local2 = this;
_local1.matrix0[0] = _local2.matrix0[0];
_local1.matrix1[0] = _local2.matrix1[0];
_local1.matrix2[0] = _local2.matrix2[0];
_local1.matrix3[0] = _local2.matrix3[0];
_local1.matrix0[1] = _local2.matrix0[1];
_local1.matrix1[1] = _local2.matrix1[1];
_local1.matrix2[1] = _local2.matrix2[1];
_local1.matrix3[1] = _local2.matrix3[1];
_local1.matrix0[2] = _local2.matrix0[2];
_local1.matrix1[2] = _local2.matrix1[2];
_local1.matrix2[2] = _local2.matrix2[2];
_local1.matrix3[2] = _local2.matrix3[2];
_local1.matrix0[3] = _local2.matrix0[3];
_local1.matrix1[3] = _local2.matrix1[3];
_local1.matrix2[3] = _local2.matrix2[3];
_local1.matrix3[3] = _local2.matrix3[3];
}
function identity() {
var _local1 = this;
_local1.matrix0[0] = 1;
_local1.matrix1[0] = 0;
_local1.matrix2[0] = 0;
_local1.matrix3[0] = 0;
_local1.matrix0[1] = 0;
_local1.matrix1[1] = 1;
_local1.matrix2[1] = 0;
_local1.matrix3[1] = 0;
_local1.matrix0[2] = 0;
_local1.matrix1[2] = 0;
_local1.matrix2[2] = 1;
_local1.matrix3[2] = 0;
_local1.matrix0[3] = 0;
_local1.matrix1[3] = 0;
_local1.matrix2[3] = 0;
_local1.matrix3[3] = 1;
}
function transform(x, y, z) {
var _local1 = this;
_local1.matrix3[0] = x;
_local1.matrix3[1] = y;
_local1.matrix3[2] = z;
}
function rotation(vector) {
var _local1 = this;
var A = Math.cos(vector.__get__x());
var B = Math.sin(vector.__get__x());
var C = Math.cos(vector.__get__y());
var D = Math.sin(vector.__get__y());
var _local2 = Math.cos(vector.__get__z());
var _local3 = Math.sin(vector.__get__z());
var AD = (A * D);
var BD = (B * D);
_local1.matrix0[0] = C * _local2;
_local1.matrix1[0] = (-C) * _local3;
_local1.matrix2[0] = D;
_local1.matrix3[0] = 0;
_local1.matrix0[1] = (BD * _local2) + (A * _local3);
_local1.matrix1[1] = ((-BD) * _local3) + (A * _local2);
_local1.matrix2[1] = (-B) * C;
_local1.matrix3[1] = 0;
_local1.matrix0[2] = ((-AD) * _local2) + (B * _local3);
_local1.matrix1[2] = (AD * _local3) + (B * _local2);
_local1.matrix2[2] = A * C;
_local1.matrix3[2] = 0;
_local1.matrix0[3] = 0;
_local1.matrix1[3] = 0;
_local1.matrix2[3] = 0;
_local1.matrix3[3] = 1;
}
function inverseRotationAxisY() {
var _local1 = this;
_local1.matrix2[0] = _local1.matrix2[0] * -1;
_local1.matrix0[1] = _local1.matrix0[1] * -1;
_local1.matrix1[1] = _local1.matrix1[1] * -1;
_local1.matrix0[2] = _local1.matrix0[2] * -1;
_local1.matrix1[2] = _local1.matrix1[2] * -1;
}
function rotationX(degs) {
var _local3 = this;
var _local1 = Math.sin(degs);
var _local2 = Math.cos(degs);
_local3.matrix1[1] = _local2;
_local3.matrix2[1] = -_local1;
_local3.matrix1[2] = _local1;
_local3.matrix2[2] = _local2;
}
function rotationY(degs) {
var _local3 = this;
var _local1 = Math.sin(degs);
var _local2 = Math.cos(degs);
_local3.matrix0[0] = _local2;
_local3.matrix2[0] = _local1;
_local3.matrix0[2] = -_local1;
_local3.matrix2[2] = _local2;
}
function rotationZ(degs) {
var _local3 = this;
var _local1 = Math.sin(degs);
var _local2 = Math.cos(degs);
_local3.matrix0[0] = _local2;
_local3.matrix1[0] = -_local1;
_local3.matrix0[1] = _local1;
_local3.matrix1[1] = _local2;
}
function perspective(l, r, b, t, n, f) {
var _local1 = this;
var _local3 = n;
var _2n = (2 * _local3);
var _2fn = ((2 * f) * _local3);
var _rml = (r - l);
var _rpl = (r + l);
var _local2 = f - _local3;
var _fpn = (f + _local3);
var _tmb = (t - b);
var _tpb = (t + b);
_local1.matrix0[0] = _2n / _rml;
_local1.matrix1[0] = 0;
_local1.matrix2[0] = (-_rpl) / _rml;
_local1.matrix3[0] = 0;
_local1.matrix0[1] = 0;
_local1.matrix1[1] = _2n / _tmb;
_local1.matrix2[1] = (-_tpb) / _tmb;
_local1.matrix3[1] = 0;
_local1.matrix0[2] = 0;
_local1.matrix1[2] = 0;
_local1.matrix2[2] = _fpn / _local2;
_local1.matrix3[2] = (-_2fn) / _local2;
_local1.matrix0[3] = 0;
_local1.matrix1[3] = 0;
_local1.matrix2[3] = 1;
_local1.matrix3[3] = 1;
}
function toString() {
var _local1 = this;
return((((((((((((((((((((((((((((((((((("[" + _local1.__matrix0[0]) + ", ") + _local1.__matrix1[0]) + ", ") + _local1.__matrix2[0]) + ", ") + _local1.__matrix3[0]) + "]\n") + "[") + _local1.__matrix0[1]) + ", ") + _local1.__matrix1[1]) + ", ") + _local1.__matrix2[1]) + ", ") + _local1.__matrix3[1]) + "]\n") + "[") + _local1.__matrix0[2]) + ", ") + _local1.__matrix1[2]) + ", ") + _local1.__matrix2[2]) + ", ") + _local1.__matrix3[2]) + "]\n") + "[") + _local1.__matrix0[3]) + ", ") + _local1.__matrix1[3]) + ", ") + _local1.__matrix2[3]) + ", ") + _local1.__matrix3[3]) + "]\n");
}
function set matrix0(value) {
__matrix0 = value;
//return(matrix0);
}
function get matrix0() {
return(__matrix0);
}
function set matrix1(value) {
__matrix1 = value;
//return(matrix1);
}
function get matrix1() {
return(__matrix1);
}
function set matrix2(value) {
__matrix2 = value;
//return(matrix2);
}
function get matrix2() {
return(__matrix2);
}
function set matrix3(value) {
__matrix3 = value;
//return(matrix3);
}
function get matrix3() {
return(__matrix3);
}
}
Symbol 108 MovieClip [__Packages.classes.smashing.library.math.sphere.sphere2] Frame 0
class classes.smashing.library.math.sphere.sphere2
{
var __position, __radius;
function sphere2 (position, radius) {
__position = new classes.smashing.library.math.vector.vector2(position.__get__x(), position.__get__y());
__radius = radius;
}
function toString() {
return(((("SPHERE [" + __position) + ", ") + __radius) + "]");
}
function get x() {
return(__position.__get__x());
}
function set x(value) {
__position.__set__x(value);
//return(x);
}
function get y() {
return(__position.__get__y());
}
function set y(value) {
__position.__set__y(value);
//return(y);
}
function get position() {
return(__position);
}
function get radius() {
return(__radius);
}
function set radius(value) {
__radius = value;
//return(radius);
}
}
Symbol 109 MovieClip [__Packages.classes.smashing.library.render.renderList] Frame 0
class classes.smashing.library.render.renderList
{
var __vector2List, __vector3List, __line2List, __line3List, __sphere2List, __sphere3List;
function renderList () {
var _local1 = this;
_local1.__vector2List = new Array();
_local1.__vector3List = new Array();
_local1.__line2List = new Array();
_local1.__line3List = new Array();
_local1.__sphere2List = new Array();
_local1.__sphere3List = new Array();
}
function addVector2(v) {
__vector2List.push(v);
}
function addVector3(v) {
__vector3List.push(v);
}
function addLine2(l) {
__line2List.push(l);
}
function addLine3(l) {
__line3List.push(l);
}
function addSphere2(s) {
__sphere2List.push(s);
}
function addSphere3(s) {
__sphere3List.push(s);
}
function removeVector2(v) {
var _local2 = this;
var _local3 = v;
var _local1 = 0;
while (_local1 < _local2.__vector2List.length) {
if (_local2.__vector2List[_local1] == _local3) {
_local2.__vector2List.splice(_local1, 1);
return;
}
_local1++;
}
}
function removeVector3(v) {
var _local2 = this;
var _local3 = v;
var _local1 = 0;
while (_local1 < _local2.__vector3List.length) {
if (_local2.__vector3List[_local1] == _local3) {
_local2.__vector3List.splice(_local1, 1);
return;
}
_local1++;
}
}
function removeLine2(l) {
var _local2 = this;
var _local3 = l;
var _local1 = 0;
while (_local1 < _local2.__line2List.length) {
if (_local2.__line2List[_local1] == _local3) {
_local2.__line2List.splice(_local1, 1);
return;
}
_local1++;
}
}
function removeLine3(l) {
var _local2 = this;
var _local3 = l;
var _local1 = 0;
while (_local1 < _local2.__line3List.length) {
if (_local2.__line3List[_local1] == _local3) {
_local2.__line3List.splice(_local1, 1);
return;
}
_local1++;
}
}
function removeSphere2(s) {
var _local2 = this;
var _local3 = s;
var _local1 = 0;
while (_local1 < _local2.__sphere2List.length) {
if (_local2.__sphere2List[_local1] == _local3) {
_local2.__sphere2List.splice(_local1, 1);
return;
}
_local1++;
}
}
function removeSphere3(s) {
var _local2 = this;
var _local3 = s;
var _local1 = 0;
while (_local1 < _local2.__sphere3List.length) {
if (_local2.__sphere3List[_local1] == _local3) {
_local2.__sphere3List.splice(_local1, 1);
return;
}
_local1++;
}
}
function get vector2List() {
return(__vector2List);
}
function get vector3List() {
return(__vector3List);
}
function get line2List() {
return(__line2List);
}
function get line3List() {
return(__line3List);
}
function get sphere2List() {
return(__sphere2List);
}
function get sphere3List() {
return(__sphere3List);
}
}
Symbol 110 MovieClip [__Packages.classes.smashing.library.math.line.line2] Frame 0
class classes.smashing.library.math.line.line2
{
var __v0, __v1, __radius;
function line2 (v0, v1, radius) {
var _local1 = this;
if (v0 != undefined) {
_local1.__v0 = v0;
} else {
_local1.__v0 = new classes.smashing.library.math.vector.vector2(0, 0);
}
if (v1 != undefined) {
_local1.__v1 = v1;
} else {
_local1.__v1 = new classes.smashing.library.math.vector.vector2(0, 0);
}
_local1.__radius = ((radius == undefined) ? 0 : (radius));
}
function copyTo(line) {
__v0.copyTo(line.__get__v0());
__v1.copyTo(line.__get__v1());
}
function copyFrom(line) {
__v0.copyFrom(line.__get__v0());
__v1.copyFrom(line.__get__v1());
}
function getLength2() {
var _local1 = new classes.smashing.library.math.vector.vector2();
_local1.copyFrom(__v1);
_local1.subtract(__v0);
var _local2 = _local1.getLength2();
return(_local2);
}
function getLength() {
return(Math.sqrt(getLength2()));
}
function toString() {
return(((("LINE [" + __v0) + ", ") + __v1) + "]");
}
function get v0() {
return(__v0);
}
function get v1() {
return(__v1);
}
function get radius() {
return(__radius);
}
function set radius(value) {
__radius = value;
//return(radius);
}
}
Symbol 111 MovieClip [__Packages.classes.smashing.library.math.line.line3] Frame 0
class classes.smashing.library.math.line.line3
{
var __v0, __v1, __radius;
function line3 (v0, v1, radius) {
var _local1 = this;
if (v0 != undefined) {
_local1.__v0 = v0;
} else {
_local1.__v0 = new classes.smashing.library.math.vector.vector3(0, 0);
}
if (v1 != undefined) {
_local1.__v1 = v1;
} else {
_local1.__v1 = new classes.smashing.library.math.vector.vector3(0, 0);
}
_local1.__radius = ((radius == undefined) ? 0 : (radius));
}
function copyTo(line) {
__v0.copyTo(line.__get__v0());
__v1.copyTo(line.__get__v1());
}
function copyFrom(line) {
__v0.copyFrom(line.__get__v0());
__v1.copyFrom(line.__get__v1());
}
function getLength2() {
var _local1 = new classes.smashing.library.math.vector.vector3();
_local1.copyFrom(__v1);
_local1.subtract(__v0);
var _local2 = _local1.getLength2();
return(_local2);
}
function getLength() {
return(Math.sqrt(getLength2()));
}
function toString() {
return(((("LINE [" + __v0) + ", ") + __v1) + "]");
}
function get v0() {
return(__v0);
}
function get v1() {
return(__v1);
}
function get radius() {
return(__radius);
}
function set radius(value) {
__radius = value;
//return(radius);
}
}
Symbol 112 MovieClip [__Packages.classes.smashing.library.math.sphere.sphere3] Frame 0
class classes.smashing.library.math.sphere.sphere3
{
var __position, __radius;
function sphere3 (position, radius) {
var _local1 = position;
__position = new classes.smashing.library.math.vector.vector3(_local1.__get__x(), _local1.__get__y(), _local1.__get__z());
__radius = radius;
}
function toString() {
return(((("SPHERE [" + __position) + ", ") + __radius) + "]");
}
function get x() {
return(__position.__get__x());
}
function set x(value) {
__position.__set__x(value);
//return(x);
}
function get y() {
return(__position.__get__y());
}
function set y(value) {
__position.__set__y(value);
//return(y);
}
function get z() {
return(__position.__get__z());
}
function set z(value) {
__position.__set__z(value);
//return(z);
}
function get position() {
return(__position);
}
function get radius() {
return(__radius);
}
function set radius(value) {
__radius = value;
//return(radius);
}
}
Symbol 113 MovieClip [__Packages.classes.smashing.library.camera.camera2D] Frame 0
class classes.smashing.library.camera.camera2D
{
var __position, __lastPosition, __desiredPosition, __bounds, __target;
function camera2D (target) {
var _local1 = this;
_local1.__target = target;
_local1.__position = new classes.smashing.library.math.vector.vector2();
_local1.__desiredPosition = new classes.smashing.library.math.vector.vector2();
_local1.__lastPosition = new classes.smashing.library.math.vector.vector2();
_local1.__velocity = new classes.smashing.library.math.vector.vector2();
_local1.__bounds = new Object();
_local1.__dimensions = undefined;
_local1.__bounds.left = 0;
_local1.__bounds.right = 0;
_local1.__bounds.top = 0;
_local1.__bounds.bottom = 0;
_local1.__lastPosition.copyFrom(_local1.__position);
_local1.__desiredPosition.copyFrom(_local1.__position);
_local1.minBoundry = 0;
_local1.minScreen = 0;
_local1.dampener = 1;
}
function setBounds(dimensions, bounds) {
var _local1 = this;
var _local2 = bounds;
_local1.__dimensions = dimensions;
_local1.__bounds.left = _local2.left;
_local1.__bounds.right = _local2.right;
_local1.__bounds.top = _local2.top;
_local1.__bounds.bottom = _local2.bottom;
_local1.minBoundry = 0;
}
function update(deltaTime) {
var _local1 = this;
_local1.last.x = _local1.x;
_local1.last.y = _local1.y;
_local1.move(deltaTime);
}
function move(deltaTime) {
var _local1 = this;
if (_local1.__target == undefined) {
} else {
var left = (_local1.__get__x() + _local1.__bounds.left);
var right = (_local1.__get__x() + _local1.__bounds.right);
var top = (_local1.__get__y() + _local1.__bounds.top);
var bottom = (_local1.__get__y() + _local1.__bounds.bottom);
var _local2 = {x:0, y:0};
var _local3 = _local1.__target.halfWidth;
var deltaX = 0;
var deltaY = 0;
var distance;
if ((_local1.__target.x - _local3) < left) {
_local2.x = (_local1.__target.x - _local3) - left;
} else if ((_local1.__target.x + _local3) > right) {
_local2.x = (_local1.__target.x + _local3) - right;
}
if ((_local1.__target.y + _local1.__target.height) > top) {
_local2.y = (_local1.__target.y + _local1.__target.height) - top;
} else if ((_local1.__target.y < bottom) && (bottom > _local1.minBoundry)) {
_local2.y = _local1.__target.y - bottom;
}
_local1.x = _local1.x + (_local2.x * _local1.dampener);
_local1.y = _local1.y + (_local2.y * _local1.dampener);
_local1.minScreen = _local1.__get__y() - (_local1.__dimensions.height / 2);
}
}
function get x() {
return(__position.__get__x());
}
function set x(value) {
__position.__set__x(value);
//return(x);
}
function get y() {
return(__position.__get__y());
}
function set y(value) {
__position.__set__y(value);
//return(y);
}
function get last() {
return(__lastPosition);
}
function get desired() {
return(__desiredPosition);
}
function get bounds() {
return(__bounds);
}
function get target() {
return(__target);
}
function set target(value) {
__target = value;
//return(target);
}
}
Symbol 114 MovieClip [__Packages.classes.smashing.library.camera.camera3D] Frame 0
class classes.smashing.library.camera.camera3D
{
var __mode, __aspectRatio, __viewAngle, __position, __orientation, __viewVector, __upVector, __rightVector, __rotationLocal, __rotationGlobal, __perspective, __viewFrustrum, __target;
function camera3D (target) {
var _local1 = this;
_local1.__target = target;
_local1.__mode = _local1.CAMERA_MODE_STATIC;
_local1.__position = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__orientation = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__rightVector = new classes.smashing.library.math.vector.vector3(1, 0, 0);
_local1.__viewVector = new classes.smashing.library.math.vector.vector3(0, 1, 0);
_local1.__upVector = new classes.smashing.library.math.vector.vector3(0, 0, 1);
_local1.__lastPosition = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__delta = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__rotationLocal = new classes.smashing.library.math.matrix.matrix4();
_local1.__rotationGlobal = new classes.smashing.library.math.matrix.matrix4();
_local1.__perspective = new classes.smashing.library.math.matrix.matrix4();
_local1.__viewAngle = 0;
_local1.__aspectRatio = 0;
_local1.__viewFrustrum = new Object();
_local1.__viewFrustrum.left = 0;
_local1.__viewFrustrum.right = 0;
_local1.__viewFrustrum.top = 0;
_local1.__viewFrustrum.bottom = 0;
_local1.__viewFrustrum.near = 0;
_local1.__viewFrustrum.far = 0;
_local1.__bounds = new Object();
_local1.__dimensions = undefined;
_local1.__rotationLocal.identity();
_local1.__rotationGlobal.identity();
_local1.__perspective.identity();
_local1.minBoundry = 0;
_local1.minScreen = 0;
_local1.dampener = 1;
_local1.initMode();
}
function setBounds(dimensions, bounds) {
var _local1 = this;
var _local2 = bounds;
_local1.__dimensions = dimensions;
_local1.__bounds.left = _local2.left * 0.5;
_local1.__bounds.right = _local2.right * 0.5;
_local1.__bounds.top = _local2.top * 0.5;
_local1.__bounds.bottom = _local2.bottom * 0.5;
}
function initFrustrum(l, r, b, t, n, f) {
var _local1 = this;
var _local2 = r;
var _local3 = n;
_local1.__viewFrustrum.left = l;
_local1.__viewFrustrum.right = _local2;
_local1.__viewFrustrum.bottom = b;
_local1.__viewFrustrum.top = t;
_local1.__viewFrustrum.near = _local3;
_local1.__viewFrustrum.far = f;
_local1.__perspective.perspective(l, _local2, b, t, _local3, f);
_local1.__viewAngle = Math.asin(_local2 / Math.sqrt((_local3 * _local3) + (_local2 * _local2)));
_local1.__aspectRatio = _local2 / t;
}
function initMode() {
var _local1 = this;
_local1.calculateRotationMatracies();
_local1.calculateViewVector();
_local1.calculateDeltaMoveVector();
_local1.saveLastPosition();
}
function setRotation(pitch, yaw, roll) {
var _local1 = this;
_local1.__orientation.__set__x(((pitch == undefined) ? 0 : (pitch)));
_local1.__orientation.__set__y(((yaw == undefined) ? 0 : (yaw)));
_local1.__orientation.__set__z(((roll == undefined) ? 0 : (roll)));
}
function update(deltaTime) {
var _local1 = this;
switch (_local1.__mode) {
case _local1.CAMERA_MODE_FREE :
_local1.updateFree();
return;
case _local1.CAMERA_MODE_STATIC :
_local1.updateStatic();
return;
case _local1.CAMERA_MODE_FOLLOW :
_local1.updateFollow(deltaTime);
}
}
function updateStatic() {
}
function updateFree() {
var _local1 = this;
_local1.calculateRotationMatracies();
_local1.calculateViewVector();
_local1.calculateDeltaMoveVector();
_local1.saveLastPosition();
}
function updateFollow(deltaTime) {
var _local1 = this;
_local1.calculateRotationMatracies();
_local1.calculateViewVector();
_local1.calculateDeltaMoveVector();
_local1.saveLastPosition();
_local1.moveFollow(deltaTime);
}
function moveFollow(deltaTime) {
var _local1 = this;
if (_local1.__target == undefined) {
} else {
var left = (_local1.__get__x() + _local1.__bounds.left);
var right = (_local1.__get__x() + _local1.__bounds.right);
var top = (_local1.__get__z() + _local1.__bounds.top);
var bottom = (_local1.__get__z() + _local1.__bounds.bottom);
var _local2 = {x:0, z:0};
var _local3 = _local1.__target.halfWidth;
var deltaX = 0;
var deltaY = 0;
var distance;
if ((_local1.__target.x - _local3) < left) {
_local2.x = (_local1.__target.x - _local3) - left;
} else if ((_local1.__target.x + _local3) > right) {
_local2.x = (_local1.__target.x + _local3) - right;
}
if ((_local1.__target.z + _local1.__target.height) > top) {
_local2.z = (_local1.__target.z + _local1.__target.height) - top;
} else if ((_local1.__target.z < bottom) && (bottom > _local1.minBoundry)) {
_local2.z = _local1.__target.z - bottom;
}
_local1.x = _local1.x + (_local2.x * _local1.dampener);
_local1.z = _local1.z + (_local2.z * _local1.dampener);
_local1.minScreen = _local1.__get__z() - (_local1.__dimensions.height / 2);
}
}
function calculateRotationMatracies() {
var _local1 = this;
_local1.__rotationLocal.rotation(_local1.__orientation);
_local1.__rotationGlobal.copyFrom(_local1.__rotationLocal);
_local1.__rotationGlobal.inverseRotationAxisY();
}
function calculateViewVector() {
var _local1 = this;
_local1.__rightVector.setXYZ(1, 0, 0);
_local1.__viewVector.setXYZ(0, 1, 0);
_local1.__upVector.setXYZ(0, 0, 1);
_local1.__rightVector.multiplyByMatrix(_local1.__rotationLocal);
_local1.__viewVector.multiplyByMatrix(_local1.__rotationLocal);
_local1.__upVector.multiplyByMatrix(_local1.__rotationLocal);
}
function calculateDeltaMoveVector() {
var _local1 = this;
_local1.__delta.setXYZ(_local1.__position.__get__x(), _local1.__position.__get__y(), _local1.__position.__get__z());
_local1.__delta.subtract(_local1.__lastPosition);
}
function saveLastPosition() {
var _local1 = this;
_local1.__lastPosition.setXYZ(_local1.__position.__get__x(), _local1.__position.__get__y(), _local1.__position.__get__z());
}
function get mode() {
return(__mode);
}
function set mode(value) {
__mode = value;
//return(mode);
}
function get aspectRatio() {
return(__aspectRatio);
}
function get viewAngle() {
return(__viewAngle);
}
function get x() {
return(__position.__get__x());
}
function set x(value) {
__position.__set__x(value);
//return(x);
}
function get y() {
return(__position.__get__y());
}
function set y(value) {
__position.__set__y(value);
//return(y);
}
function get z() {
return(__position.__get__z());
}
function set z(value) {
__position.__set__z(value);
//return(z);
}
function get position() {
return(__position);
}
function get orientation() {
return(__orientation);
}
function get viewVector() {
return(__viewVector);
}
function get upVector() {
return(__upVector);
}
function get rightVector() {
return(__rightVector);
}
function get rotationLocal() {
return(__rotationLocal);
}
function get rotationGlobal() {
return(__rotationGlobal);
}
function get perspective() {
return(__perspective);
}
function get leftPlane() {
return(__viewFrustrum.left);
}
function get rightPlane() {
return(__viewFrustrum.right);
}
function get topPlane() {
return(__viewFrustrum.top);
}
function get bottomPlane() {
return(__viewFrustrum.bottom);
}
function get nearPlane() {
return(__viewFrustrum.near);
}
function get farPlane() {
return(__viewFrustrum.far);
}
function get target() {
return(__target);
}
function set target(value) {
__target = value;
//return(target);
}
var CAMERA_MODE_STATIC = "static";
var CAMERA_MODE_FREE = "free";
var CAMERA_MODE_FOLLOW = "follow";
}
Symbol 115 MovieClip [__Packages.classes.smashing.AirHockey.render] Frame 0
class classes.smashing.AirHockey.render extends classes.smashing.library.render.render
{
var transform3D, get3DScale;
function render (dimensions) {
super(dimensions);
}
function update(gameLevel) {
var _local1 = gameLevel;
var _local3;
if (!__didOnce) {
var _local2 = 0;
while (_local2 < _local1.worldCorners.length) {
_local3 = transform3D(_local1.worldCorners[_local2]);
_local1.screenCorners[_local2].copyFrom(_local3);
_local2++;
}
_local3 = transform3D(_local1.midFieldWorld[0]);
_local1.midFieldScreen[0].copyFrom(_local3);
_local3 = transform3D(_local1.midFieldWorld[1]);
_local1.midFieldScreen[1].copyFrom(_local3);
_local3 = transform3D(_local1.goalTopWorld[0]);
_local1.goalTopScreen[0].copyFrom(_local3);
_local3 = transform3D(_local1.goalTopWorld[1]);
_local1.goalTopScreen[1].copyFrom(_local3);
_local3 = transform3D(_local1.goalBottomWorld[0]);
_local1.goalBottomScreen[0].copyFrom(_local3);
_local3 = transform3D(_local1.goalBottomWorld[1]);
_local1.goalBottomScreen[1].copyFrom(_local3);
__didOnce = true;
}
_local3 = transform3D(_local1.puck.position);
_local1.puck.moveClip(_local3);
_local1.puck.scale(get3DScale(_local1.puck.position.y));
_local3 = transform3D(_local1.player.position);
_local1.player.moveClip(_local3);
_local1.player.scale(get3DScale(_local1.player.position.y));
_local3 = transform3D(_local1.enemy.position);
_local1.enemy.moveClip(_local3);
_local1.enemy.scale(get3DScale(_local1.enemy.position.y));
super.update(classes.smashing.AirHockey.level);
}
var __didOnce = false;
}
Symbol 116 MovieClip [__Packages.classes.smashing.library.controls.controls] Frame 0
class classes.smashing.library.controls.controls
{
var __engine, __keyBindings;
function controls (e) {
var _local1 = this;
var me = _local1;
_local1.__engine = e;
_local1.__keyListener = new Object();
_local1.__keyBindings = new Array();
_local1.__mouseListener = new Object();
_local1.__mouseBinding = new Object();
_local1.__mouseBinding.onMouseDown = null;
_local1.__mouseBinding.onMouseUp = null;
_local1.__mouseBinding.onMouseMove = null;
_local1.__keyListener.onKeyDown = function () {
me.onKeyDown(Key.getCode());
};
_local1.__keyListener.onKeyUp = function () {
me.onKeyUp(Key.getCode());
};
Key.addListener(_local1.__keyListener);
_local1.__mouseListener.onMouseDown = function () {
me.onMouseDown();
};
_local1.__mouseListener.onMouseUp = function () {
me.onMouseUp();
};
_local1.__mouseListener.onMouseMove = function () {
me.onMouseMove();
};
Mouse.addListener(_local1.__mouseListener);
}
function onKeyDown(code) {
var _local1 = getKeyEventBinding(code, "onKeyPress");
if (_local1 != undefined) {
_local1.handler(__engine);
}
}
function onKeyUp(code) {
var _local1 = getKeyEventBinding(code, "onKeyRelease");
if (_local1 != undefined) {
_local1.handler(__engine);
}
}
function onMouseDown() {
var _local1 = this;
if (_local1.__mouseBinding.onMouseDown == null) {
} else {
_local1.__mouseBinding.onMouseDown(_local1.__engine);
}
}
function onMouseUp() {
var _local1 = this;
if (_local1.__mouseBinding.onMouseUp == null) {
} else {
_local1.__mouseBinding.onMouseUp(_local1.__engine);
}
}
function onMouseMove() {
var _local1 = this;
if (_local1.__mouseBinding.onMouseMove == null) {
} else {
_local1.__mouseBinding.onMouseMove(_local1.__engine);
}
}
function getKeyBinding(code) {
var _local2 = this;
var _local3 = code;
var _local1 = 0;
while (_local1 < _local2.__keyBindings.length) {
if (_local2.__keyBindings[_local1].code == _local3) {
return(_local2.__keyBindings[_local1]);
}
_local1++;
}
return(undefined);
}
function getKeyEventBinding(code, event) {
var _local2 = this;
var _local3 = code;
var _local1 = 0;
while (_local1 < _local2.__keyBindings.length) {
if ((_local2.__keyBindings[_local1].code == _local3) && (_local2.__keyBindings[_local1].event == event)) {
return(_local2.__keyBindings[_local1]);
}
_local1++;
}
return(undefined);
}
function bindKey(code, event, handler) {
var _local2 = event;
var _local1 = getKeyEventBinding(code, _local2);
if (_local1 == undefined) {
_local1 = new Object();
__keyBindings.push(_local1);
}
switch (_local2) {
case "onKeyDown" :
case "onKeyPress" :
case "onKeyRelease" :
_local1.code = code;
_local1.event = _local2;
_local1.handler = handler;
return;
}
}
function bindMouse(event, handler) {
var _local1 = this;
var _local2 = handler;
switch (event) {
case "onMouseDown" :
_local1.__mouseBinding.onMouseDown = _local2;
return;
case "onMouseUp" :
_local1.__mouseBinding.onMouseUp = _local2;
return;
case "onMouseMove" :
_local1.__mouseBinding.onMouseMove = _local2;
return;
}
}
function reset() {
var _local2 = this;
var _local1 = 0;
while (_local1 < _local2.__keyBindings.length) {
_local2.__keyBindings.pop();
_local1++;
}
_local2.__mouseBinding.onMouseDown = null;
_local2.__mouseBinding.onMouseUp = null;
_local2.__mouseBinding.onMouseMove = null;
Key.removeListener(_local2.__keyListener);
Mouse.removeListener(_local2.__mouseListener);
}
function update(deltaTime) {
var _local2 = this;
var _local1 = 0;
while (_local1 < _local2.__keyBindings.length) {
if (_local2.__keyBindings[_local1].event != "onKeyDown") {
} else if (Key.isDown(_local2.__keyBindings[_local1].code)) {
_local2.__keyBindings[_local1].handler(_local2.__engine);
}
_local1++;
}
}
}
Symbol 117 MovieClip [__Packages.classes.smashing.library.collision.collisionTest] Frame 0
class classes.smashing.library.collision.collisionTest
{
var __mathUtility;
function collisionTest () {
__mathUtility = new classes.smashing.library.utility.utilityMath();
}
function test2DLineIntersect(p, line0, line1, line1Slope, line1Intercept) {
var _local1 = p;
var _local2 = line1;
var _local3 = line0;
var m0 = __mathUtility.get2DLineSlope(_local3);
var b0 = __mathUtility.get2DLineIntercept(_local3, m0);
var m1;
var b1;
m1 = ((line1Slope != undefined) ? (line1Slope) : (__mathUtility.get2DLineSlope(_local2)));
b1 = ((line1Intercept != undefined) ? (line1Intercept) : (__mathUtility.get2DLineIntercept(_local2, m1)));
if (m0 != m1) {
if (m0 == Infinity) {
if (_local3.v0.x == _local3.v1.x) {
_local1.__set__x(_local3.v0.x);
_local1.__set__y((m1 * _local1.__get__x()) + b1);
if ((_local3.v0.y <= _local1.__get__y()) && (_local1.__get__y() <= _local3.v1.y)) {
return(true);
}
// unexpected jump
}
_local1.__set__y(_local3.v0.y);
_local1.__set__x((_local1.__get__y() - b1) / m1);
if ((_local3.v0.x <= _local1.__get__x()) && (_local1.__get__x() <= _local3.v1.x)) {
return(true);
}
} else if (m1 == Infinity) {
if (_local2.v0.x == _local2.v1.x) {
_local1.__set__x(_local2.v0.x);
_local1.__set__y((m0 * _local1.__get__x()) + b0);
if ((_local2.v0.y <= _local1.__get__y()) && (_local1.__get__y() <= _local2.v1.y)) {
return(true);
}
// unexpected jump
}
_local1.__set__y(_local2.v0.y);
_local1.__set__x((_local1.__get__y() - b0) / m0);
if ((_local2.v0.x <= _local1.__get__x()) && (_local1.__get__x() <= _local2.v1.x)) {
return(true);
}
} else {
var left = Math.min(Math.min(_local3.v0.x, _local3.v1.x), Math.min(_local2.v0.x, _local2.v1.x));
var right = Math.max(Math.max(_local3.v0.x, _local3.v1.x), Math.max(_local2.v0.x, _local2.v1.x));
var top = Math.min(Math.min(_local3.v0.y, _local3.v1.y), Math.min(_local2.v0.y, _local2.v1.y));
var bottom = Math.max(Math.max(_local3.v0.y, _local3.v1.y), Math.max(_local2.v0.y, _local2.v1.y));
_local1.__set__x((b1 - b0) / (m0 - m1));
_local1.__set__y((m0 * _local1.__get__x()) + b0);
if ((((left <= _local1.__get__x()) && (_local1.__get__x() <= right)) && (top <= _local1.__get__y())) && (_local1.__get__y() <= bottom)) {
return(true);
}
}
}
return(false);
}
function test2DSphereIntersect(s0, s1) {
var _local2 = s0.__get__radius() + s1.__get__radius();
var _local1 = __mathUtility.get2DDistance(s0.__get__position(), s1.__get__position());
return(_local1 <= _local2);
}
function test3DSphereIntersect(s0, s1) {
var _local2 = s0.__get__radius() + s1.__get__radius();
var _local1 = __mathUtility.get3DDistance(s0.__get__position(), s1.__get__position());
return(_local1 <= _local2);
}
function test2DLineSphereIntersect(p, sphere, line) {
var _local2 = sphere;
var _local3 = line;
var _local1 = _local2.__get__radius() + _local3.__get__radius();
if ((_local3.v0.x == _local3.v1.x) && (_local3.v0.y == _local3.v1.y)) {
var distance = __mathUtility.get2DDistance(_local3.__get__v0(), _local2.__get__position());
p.copyFrom(_local3.__get__v0());
if (distance <= _local1) {
return(true);
}
return(false);
}
var start = _local3.__get__v0();
var end = _local3.__get__v1();
var lineOffset;
var p0Distance = __mathUtility.get2DDistance(start, _local2.__get__position());
var p1Distance = __mathUtility.get2DDistance(end, _local2.__get__position());
var lineLength = _local3.getLength();
var p0 = (new classes.smashing.library.math.vector.vector2(start.__get__x(), start.__get__y()));
var p1 = (new classes.smashing.library.math.vector.vector2(end.__get__x(), end.__get__y()));
var dx10 = (p1.__get__x() - p0.__get__x());
var dy10 = (p1.__get__y() - p0.__get__y());
var deltaX = (dx10 / lineLength);
var deltaY = (dy10 / lineLength);
p0.subtractXY(deltaX * _local1, deltaY * _local1);
p1.additionXY(deltaX * _local1, deltaY * _local1);
var real = getLineSeparations(start, _local2.__get__position(), dx10, dy10);
dx10 = p1.__get__x() - p0.__get__x();
dy10 = p1.__get__y() - p0.__get__y();
var fake = getLineSeparations(p0, _local2.__get__position(), dx10, dy10);
if (real.distance <= _local1) {
if (p1Distance >= lineLength) {
lineOffset = Math.sqrt((_local1 * _local1) - (fake.distance * fake.distance));
deltaX = deltaX * lineOffset;
deltaY = deltaY * lineOffset;
p.setXY((_local2.__get__x() + fake.xSeparation) + deltaX, (_local2.__get__y() + fake.ySeparation) + deltaY);
} else {
lineOffset = Math.sqrt((_local1 * _local1) - (real.distance * real.distance));
deltaX = deltaX * lineOffset;
deltaY = deltaY * lineOffset;
p.setXY((_local2.__get__x() + real.xSeparation) + deltaX, (_local2.__get__y() + real.ySeparation) + deltaY);
}
if (__mathUtility.get2DDistance(start, p) >= lineLength) {
p.copyFrom(end);
}
return(true);
}
p.setXY(0, 0);
return(false);
}
function test2DSimpleLineSphereIntersect(p, sphere, line) {
var _local1 = line;
var _local2 = sphere.__get__radius() + _local1.__get__radius();
if ((_local1.v0.x == _local1.v1.x) && (_local1.v0.y == _local1.v1.y)) {
var deltaX = (_local1.v0.x - sphere.position.x);
var _local3 = _local1.v0.y - sphere.position.y;
var distance = Math.sqrt((deltaX * deltaX) + (_local3 * _local3));
deltaX = deltaX / distance;
_local3 = _local3 / distance;
p.setXY(deltaX * _local2, _local3 * _local2);
return(distance <= _local2);
}
var dx10 = (_local1.v0.x - _local1.v1.x);
var dy10 = (_local1.v0.y - _local1.v1.y);
var real = getLineSeparations(_local1.__get__v1(), sphere.__get__position(), dx10, dy10);
if (real.distance <= _local2) {
p.setXY(_local1.v0.x + real.xSeparation, _local1.v0.y + real.ySeparation);
return(true);
}
p.setXY(0, 0);
return(false);
}
function getLineSeparations(p0, s, dx, dy) {
var _local3 = dy;
var _local1 = new Object();
var dx0p = (p0.__get__x() - s.__get__x());
var dy0p = (p0.__get__y() - s.__get__y());
var fractal = ((dx * dx) + (_local3 * _local3));
var _local2 = (-((dx0p * dx) + (dy0p * _local3))) / fractal;
if (fractal == 0) {
_local2 = 0;
} else {
_local2 = (-((dx0p * dx) + (dy0p * _local3))) / fractal;
}
_local2 = Math.min(Math.max(_local2, 0), 1);
_local1.xSeparation = dx0p + (_local2 * dx);
_local1.ySeparation = dy0p + (_local2 * _local3);
_local1.distance = Math.sqrt((_local1.xSeparation * _local1.xSeparation) + (_local1.ySeparation * _local1.ySeparation));
return(_local1);
}
function get mathUtility() {
return(__mathUtility);
}
}
Symbol 118 MovieClip [__Packages.classes.smashing.library.utility.utilityMath] Frame 0
class classes.smashing.library.utility.utilityMath
{
var __180OverPI, __PIOver180, __PI, __TwoPI, __PIOver2;
function utilityMath () {
var _local1 = this;
_local1.__PI = Math.PI;
_local1.__TwoPI = 2 * _local1.__PI;
_local1.__PIOver2 = _local1.__PI / 2;
_local1.__PIOver180 = _local1.__PI / 180;
_local1.__180OverPI = 180 / _local1.__PI;
}
function radToDeg(radians) {
return(radians * __180OverPI);
}
function degToRad(degrees) {
return(degrees * __PIOver180);
}
function normalizeAngleDeg(degrees) {
var _local1 = degrees;
if (_local1 < 0) {
return(_local1 + 360);
}
if (_local1 > 360) {
return(_local1 - 360);
}
return(_local1);
}
function normalizeAngleRad(radians) {
var _local1 = radians;
var _local2 = this;
if (_local1 < 0) {
return(_local1 + _local2.__TwoPI);
}
if (_local1 > _local2.__TwoPI) {
return(_local1 - _local2.__TwoPI);
}
return(_local1);
}
function normalizeAngleDegNegPiToPi(degrees) {
var _local1 = degrees;
if (_local1 > 180) {
return(_local1 - 360);
}
if (_local1 < -180) {
return(_local1 + 360);
}
return(_local1);
}
function normalizeAngleRadNegPiToPi(radians) {
var _local1 = radians;
var _local2 = this;
if (_local1 > _local2.__PI) {
return(_local1 - _local2.__TwoPI);
}
if (_local1 < _local2.__PI) {
return(_local1 + _local2.__TwoPI);
}
return(_local1);
}
function get2DDistance2(p0, p1) {
var _local2 = p1.__get__x() - p0.__get__x();
var _local1 = p1.__get__y() - p0.__get__y();
return((_local2 * _local2) + (_local1 * _local1));
}
function get3DDistance2(p0, p1) {
var _local3 = p1.__get__x() - p0.__get__x();
var _local2 = p1.__get__y() - p0.__get__y();
var _local1 = p1.__get__z() - p0.__get__z();
return(((_local3 * _local3) + (_local2 * _local2)) + (_local1 * _local1));
}
function get2DDistance(p0, p1) {
return(Math.sqrt(get2DDistance2(p0, p1)));
}
function get3DDistance(p0, p1) {
return(Math.sqrt(get3DDistance2(p0, p1)));
}
function get2DLineSlope(line) {
var _local1 = line;
var _local2 = Infinity;
if (_local1.v0.x != _local1.v1.x) {
_local2 = (_local1.v1.y - _local1.v0.y) / (_local1.v1.x - _local1.v0.x);
}
return(_local2);
}
function get2DLineIntercept(line, slope) {
var _local1 = slope;
var _local2 = line;
if (_local1 == Infinity) {
return(-Infinity);
}
if (_local1 == 0) {
return(_local2.v0.y);
}
return(_local2.v0.y - (_local1 * _local2.v0.x));
}
function get PI() {
return(__PI);
}
function get TwoPI() {
return(__TwoPI);
}
function get getPIOver2() {
return(__PIOver2);
}
function get getPIOver180() {
return(__PIOver180);
}
function get get180OverPI() {
return(__180OverPI);
}
}
Symbol 119 MovieClip [__Packages.classes.smashing.library.entity.baseEntity] Frame 0
class classes.smashing.library.entity.baseEntity extends MovieClip
{
var isActive, __renderClip, __position, __dimensions, __thisBounds, __lastBounds, __type, __lastPosition;
function baseEntity (renderClip) {
var _local1 = this;
super();
_local1.__type = "entity";
_local1.__renderClip = renderClip;
_local1.__dimensions = new Object();
_local1.__thisBounds = new Object();
_local1.__lastBounds = new Object();
_local1.__position = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__lastPosition = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.updateBounds();
_local1.isActive = false;
_local1.updateDimentions();
_local1.hideRenderClip();
}
function enable() {
isActive = true;
showRenderClip();
}
function disable() {
isActive = false;
hideRenderClip();
}
function showRenderClip() {
var _local1 = this;
if (_local1.__renderClip != undefined) {
_local1.__renderClip.enabled = true;
_local1.__renderClip._visible = true;
}
}
function hideRenderClip() {
var _local1 = this;
if (_local1.__renderClip != undefined) {
_local1.__renderClip._visible = false;
_local1.__renderClip.enabled = false;
}
}
function moveClip(position) {
var _local1 = this;
if (_local1.__renderClip != undefined) {
_local1.__renderClip._x = position.x;
_local1.__renderClip._y = position.y;
}
}
function rotateClip(rotation) {
if (__renderClip != undefined) {
__renderClip._rotation = rotation;
}
}
function moveTo(position) {
__position.copyFrom(position);
}
function moveToXYZ(x, y, z) {
__position.setXYZ(x, y, z);
}
function moveBy(offset) {
__position.addition(offset);
}
function moveByXYZ(x, y, z) {
__position.additionXYZ(x, y, z);
}
function respawn(position) {
spawn(position);
}
function spawn(position) {
var _local1 = position;
var _local2 = this;
_local2.__position.setXYZ(_local1.__get__x(), _local1.__get__y(), _local1.__get__z());
_local2.__lastPosition.setXYZ(_local1.__get__x(), _local1.__get__y(), _local1.__get__z());
_local2.updateBounds();
}
function scale(pctScale) {
__renderClip._xscale = pctScale;
__renderClip._yscale = pctScale;
}
function update(deltaTime) {
var _local1 = this;
_local1.__lastPosition.__set__x(_local1.__position.x);
_local1.__lastPosition.__set__y(_local1.__position.y);
_local1.__lastPosition.__set__z(_local1.__position.z);
}
function postMoveUpdate() {
updateBounds();
}
function updateDimentions() {
var _local1 = this;
if (_local1.__renderClip) {
_local1.__dimensions.width = _local1.__renderClip._width;
_local1.__dimensions.height = _local1.__renderClip._height;
_local1.__dimensions.halfWidth = _local1.__dimensions.width / 2;
_local1.__dimensions.halfHeight = _local1.__dimensions.height / 2;
}
}
function updateBounds() {
var _local1 = this;
_local1.__lastBounds.left = _local1.__lastPosition.__get__x() - _local1.__dimensions.halfWidth;
_local1.__lastBounds.right = _local1.__lastPosition.__get__x() + _local1.__dimensions.halfWidth;
_local1.__lastBounds.top = _local1.__lastPosition.__get__y() + _local1.__dimensions.halfHeight;
_local1.__lastBounds.bottom = _local1.__lastPosition.__get__y() - _local1.__dimensions.halfHeight;
_local1.__thisBounds.left = _local1.__position.__get__x() - _local1.__dimensions.halfWidth;
_local1.__thisBounds.right = _local1.__position.__get__x() + _local1.__dimensions.halfWidth;
_local1.__thisBounds.top = _local1.__position.__get__y() + _local1.__dimensions.halfHeight;
_local1.__thisBounds.bottom = _local1.__position.__get__y() - _local1.__dimensions.halfHeight;
}
function get renderClip() {
return(__renderClip);
}
function get dimensions() {
return(__dimensions);
}
function get thisBounds() {
return(__thisBounds);
}
function get lastBounds() {
return(__lastBounds);
}
function get type() {
return(__type);
}
function set type(value) {
__type = value;
//return(type);
}
function get x() {
return(__position.__get__x());
}
function set x(value) {
__position.__set__x(value);
//return(x);
}
function get y() {
return(__position.__get__y());
}
function set y(value) {
__position.__set__y(value);
//return(y);
}
function get z() {
return(__position.__get__z());
}
function set z(value) {
__position.__set__z(value);
//return(z);
}
function get last() {
return(__lastPosition);
}
function get position() {
return(__position);
}
function get width() {
return(__dimensions.width);
}
function get height() {
return(__dimensions.height);
}
function get halfWidth() {
return(__dimensions.halfWidth);
}
function get halfHeight() {
return(__dimensions.halfHeight);
}
function get visible() {
return(__renderClip._visible);
}
function get log() {
return(classes.smashing.library.utility.utilityDebug.log);
}
}
Symbol 120 MovieClip [__Packages.classes.smashing.library.utility.utilityDebug] Frame 0
class classes.smashing.library.utility.utilityDebug extends Object
{
function utilityDebug () {
super();
}
static function log(message) {
var _local1 = new LocalConnection();
_local1.send("_SILCtrace", "trace", message.toString());
_local1.close();
trace(message);
}
}
Symbol 121 MovieClip [__Packages.classes.smashing.library.entity.staticEntity] Frame 0
class classes.smashing.library.entity.staticEntity extends classes.smashing.library.entity.baseEntity
{
var __collisionClip;
function staticEntity (renderClip, collisionClip) {
var _local1 = this;
super(renderClip);
_local1.__type = "static";
_local1.__collisionClip = collisionClip;
_local1.hideCollisionClip();
}
function showCollisionClip() {
var _local1 = this;
if (_local1.__collisionClip != undefined) {
_local1.__collisionClip.enabled = true;
_local1.__collisionClip._visible = true;
}
}
function hideCollisionClip() {
var _local1 = this;
if (_local1.__collisionClip != undefined) {
_local1.__collisionClip._visible = false;
_local1.__collisionClip.enabled = false;
}
}
function moveClip(position) {
var _local1 = this;
var _local2 = position;
super.moveClip(_local2);
if (_local1.__collisionClip != undefined) {
_local1.__collisionClip._x = _local2.x;
_local1.__collisionClip._y = _local2.y;
}
}
function scale(pctScale) {
var _local1 = pctScale;
super.scale(_local1);
__collisionClip._xscale = _local1;
__collisionClip._yscale = _local1;
}
function update(deltaTime) {
super.update(deltaTime);
}
function postMoveUpdate() {
super.postMoveUpdate();
}
function get collisionClip() {
return(__collisionClip);
}
}
Symbol 122 MovieClip [__Packages.classes.smashing.library.entity.dynamicEntity] Frame 0
class classes.smashing.library.entity.dynamicEntity extends classes.smashing.library.entity.staticEntity
{
var __maxVelocity, __maxSpeed, __maxAngularVelocity, __maxAngularSpeed, __desiredMove, __velocity, __desiredPosition, __orientation, __desiredOrientation, __angularVelocity, __facing, __speed, __angularSpeed, __moveDistance, __moveDistance2;
function dynamicEntity (renderClip, collisionClip) {
var _local1 = this;
super(renderClip, collisionClip);
_local1.__desiredPosition = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__startPosition = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__desiredMove = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__velocity = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__maxVelocity = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__desiredOrientation = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__startOrientation = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__orientation = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__angularVelocity = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__maxAngularVelocity = new classes.smashing.library.math.vector.vector3(0, 0, 0);
_local1.__facing = new classes.smashing.library.math.vector.vector3(1, 0, 0);
_local1.__type = "dynamic";
_local1.moveType = "simple";
_local1.__moveDistance = 0;
_local1.__moveDistance2 = 0;
_local1.__anglesRotated = 0;
_local1.__anglesRotated2 = 0;
_local1.__speed = 0;
_local1.__maxSpeed = 0;
_local1.__angularSpeed = 0;
_local1.__maxAngularSpeed = 0;
}
function setMaxVelocity(velocity) {
var _local1 = velocity;
__maxVelocity.setXYZ(_local1.x, _local1.y, _local1.z);
}
function setMaxMoveSpeed(speed) {
__maxSpeed = speed;
}
function setMaxAngularVelocity(velocity) {
var _local1 = velocity;
__maxAngularVelocity.setXYZ(_local1.x, _local1.y, _local1.z);
}
function setMaxAngularSpeed(speed) {
__maxAngularSpeed = speed;
}
function setDesiredPosition(desiredPosition) {
var _local1 = this;
_local1.__desiredPosition.copyFrom(desiredPosition);
_local1.__startPosition.copyFrom(_local1.__position);
_local1.__moveDistance = _local1.getDistance(_local1.__startPosition, _local1.__desiredPosition);
_local1.__moveDistance2 = _local1.__moveDistance * _local1.__moveDistance;
}
function setDesiredPositionXYZ(x, y, z) {
var _local1 = this;
_local1.__desiredPosition.setXYZ(x, y, z);
_local1.__startPosition.copyFrom(_local1.__position);
_local1.__moveDistance = _local1.getDistance(_local1.__startPosition, _local1.__desiredPosition);
_local1.__moveDistance2 = _local1.__moveDistance * _local1.__moveDistance;
}
function setDesiredOrientation(desiredOrientation) {
var _local1 = this;
_local1.__desiredOrientation.copyFrom(desiredOrientation);
_local1.__startOrientation.copyFrom(_local1.__orientation);
_local1.__anglesRotated = _local1.getDistance(_local1.__startOrientation, _local1.__desiredOrientation);
_local1.__anglesRotated2 = _local1.__anglesRotated * _local1.__anglesRotated;
}
function setDesiredOrientationXYZ(x, y, z) {
var _local1 = this;
_local1.__desiredOrientation.setXYZ(x, y, z);
_local1.__startOrientation.copyFrom(_local1.__orientation);
_local1.__anglesRotated = _local1.getDistance(_local1.__startOrientation, _local1.__desiredOrientation);
_local1.__anglesRotated2 = _local1.__anglesRotated * _local1.__anglesRotated;
}
function setMoveX(dir) {
__desiredMove.__set__x(dir);
}
function setMoveY(dir) {
__desiredMove.__set__y(dir);
}
function setMoveZ(dir) {
__desiredMove.__set__z(dir);
}
function update(deltaTime) {
var _local1 = this;
var _local2 = deltaTime;
super.update(_local2);
if (_local1.moveType == "simple") {
_local1.moveSimple(_local2);
_local1.__position.additionXYZ(_local1.__velocity.__get__x() * _local2, _local1.__velocity.__get__y() * _local2, _local1.__velocity.__get__z() * _local2);
} else if (_local1.moveType == "advanced") {
_local1.moveAdvanced(_local2);
_local1.__position.additionXYZ(_local1.__velocity.__get__x() * _local2, _local1.__velocity.__get__y() * _local2, _local1.__velocity.__get__z() * _local2);
} else if (_local1.moveType == "vector") {
var _local3 = new classes.smashing.library.math.vector.vector3();
_local1.moveAdvanced(_local2);
_local3.setXYZ(_local1.__facing.__get__x(), -_local1.__facing.__get__y(), _local1.__facing.__get__z());
_local3.scale(_local1.__velocity.getLength() * _local2);
_local1.__position.addition(_local3);
}
_local1.rotateAdvanced(_local2);
_local1.__orientation.additionXYZ(_local1.__angularVelocity.__get__x() * _local2, _local1.__angularVelocity.__get__y() * _local2, _local1.__angularVelocity.__get__z() * _local2);
}
function postMoveUpdate() {
super.postMoveUpdate();
}
function getDistance2(p0, p1) {
var _local3 = p1.__get__x() - p0.__get__x();
var _local2 = p1.__get__y() - p0.__get__y();
var _local1 = p1.__get__z() - p0.__get__z();
return(((_local3 * _local3) + (_local2 * _local2)) + (_local1 * _local1));
}
function getDistance(p0, p1) {
return(Math.sqrt(getDistance2(p0, p1)));
}
function moveSimple(deltaTime) {
var _local1 = this;
var _local2 = deltaTime;
if (Math.abs(_local1.__desiredMove.__get__x()) > 0) {
_local1.moveX(_local2);
} else {
_local1.stopMoveX();
}
if (Math.abs(_local1.__desiredMove.__get__y()) > 0) {
_local1.moveY(_local2);
} else {
_local1.stopMoveY();
}
if (Math.abs(_local1.__desiredMove.__get__z()) > 0) {
_local1.moveZ(_local2);
} else {
_local1.stopMoveZ();
}
}
function moveAdvanced(deltaTime) {
var _local1 = this;
var _local2 = new classes.smashing.library.math.vector.vector3();
var distanceMoved2;
var _local3;
_local2.copyFrom(_local1.__desiredPosition);
_local2.subtract(_local1.__position);
distanceMoved2 = _local1.getDistance2(_local1.__startPosition, _local1.__position);
if (distanceMoved2 >= _local1.__moveDistance2) {
_local1.__speed = 0;
_local3 = _local1.__moveDistance;
} else {
_local1.__speed = _local1.__speed + (_local1.__maxSpeed * deltaTime);
if (_local1.__speed > _local1.__maxSpeed) {
_local1.__speed = _local1.__maxSpeed;
}
_local3 = Math.sqrt(_local1.__moveDistance2 - distanceMoved2);
}
if (_local1.__speed > 0) {
_local1.__velocity.setXYZ((_local2.__get__x() / _local3) * _local1.__speed, (_local2.__get__y() / _local3) * _local1.__speed, (_local2.__get__z() / _local3) * _local1.__speed);
if (_local1.__velocity.__get__x() > _local1.__maxVelocity.__get__x()) {
_local1.__velocity.__set__x(_local1.__maxVelocity.x);
} else if (_local1.__velocity.__get__x() < (-_local1.__maxVelocity.__get__x())) {
_local1.__velocity.__set__x(-_local1.__maxVelocity.__get__x());
}
if (_local1.__velocity.__get__y() > _local1.__maxVelocity.__get__y()) {
_local1.__velocity.__set__y(_local1.__maxVelocity.y);
} else if (_local1.__velocity.__get__y() < (-_local1.__maxVelocity.__get__y())) {
_local1.__velocity.__set__y(-_local1.__maxVelocity.__get__y());
}
if (_local1.__velocity.__get__z() > _local1.__maxVelocity.__get__z()) {
_local1.__velocity.__set__z(_local1.__maxVelocity.z);
} else if (_local1.__velocity.__get__z() < (-_local1.__maxVelocity.__get__z())) {
_local1.__velocity.__set__z(-_local1.__maxVelocity.__get__z());
}
} else {
_local1.__velocity.setXYZ(0, 0, 0);
}
}
function rotateAdvanced(deltaTime) {
var _local1 = this;
var _local2 = new classes.smashing.library.math.vector.vector3();
var anglesRotated2;
var _local3;
_local2.copyFrom(_local1.__desiredOrientation);
_local2.subtract(_local1.__orientation);
anglesRotated2 = _local1.getDistance2(_local1.__startOrientation, _local1.__orientation);
if (anglesRotated2 >= _local1.__anglesRotated2) {
_local1.__angularSpeed = 0;
_local3 = _local1.__anglesRotated;
} else {
_local1.__angularSpeed = _local1.__angularSpeed + (_local1.__maxAngularSpeed * deltaTime);
if (_local1.__angularSpeed > _local1.__maxAngularSpeed) {
_local1.__angularSpeed = _local1.__maxAngularSpeed;
}
_local3 = Math.sqrt(_local1.__anglesRotated2 - anglesRotated2);
}
if (_local1.__angularSpeed > 0) {
_local1.__angularVelocity.setXYZ((_local2.__get__x() / _local3) * _local1.__angularSpeed, (_local2.__get__y() / _local3) * _local1.__angularSpeed, (_local2.__get__z() / _local3) * _local1.__angularSpeed);
if (_local1.__angularVelocity.__get__x() > _local1.__maxAngularVelocity.__get__x()) {
_local1.__angularVelocity.__set__x(_local1.__maxAngularVelocity.x);
} else if (_local1.__angularVelocity.__get__x() < (-_local1.__maxAngularVelocity.__get__x())) {
_local1.__angularVelocity.__set__x(-_local1.__maxAngularVelocity.__get__x());
}
if (_local1.__angularVelocity.__get__y() > _local1.__maxAngularVelocity.__get__y()) {
_local1.__angularVelocity.__set__y(_local1.__maxAngularVelocity.y);
} else if (_local1.__angularVelocity.__get__y() < (-_local1.__maxAngularVelocity.__get__y())) {
_local1.__angularVelocity.__set__y(-_local1.__maxAngularVelocity.__get__y());
}
if (_local1.__angularVelocity.__get__z() > _local1.__maxAngularVelocity.__get__z()) {
_local1.__angularVelocity.__set__z(_local1.__maxAngularVelocity.z);
} else if (_local1.__angularVelocity.__get__z() < (-_local1.__maxAngularVelocity.__get__z())) {
_local1.__angularVelocity.__set__z(-_local1.__maxAngularVelocity.__get__z());
}
} else {
_local1.__angularVelocity.setXYZ(0, 0, 0);
}
}
function moveX(deltaTime) {
var _local1 = this;
_local1.__velocity.__set__x(_local1.__desiredMove.__get__x() * _local1.__maxVelocity.__get__x());
}
function moveY(deltaTime) {
var _local1 = this;
_local1.__velocity.__set__y(_local1.__desiredMove.__get__y() * _local1.__maxVelocity.__get__y());
}
function moveZ(deltaTime) {
var _local1 = this;
_local1.__velocity.__set__z(_local1.__desiredMove.__get__z() * _local1.__maxVelocity.__get__z());
}
function stopMoveX() {
__velocity.x = __velocity.x * 0.75;
}
function stopMoveY() {
__velocity.y = __velocity.y * 0.75;
}
function stopMoveZ() {
__velocity.z = __velocity.z * 0.75;
}
function get desired() {
return(__desiredPosition);
}
function get velocity() {
return(__velocity);
}
function get maxVelocity() {
return(__maxVelocity);
}
function get orientation() {
return(__orientation);
}
function get desiredOrientation() {
return(__desiredOrientation);
}
function get desiredMove() {
return(__desiredMove);
}
function get angularVelocity() {
return(__angularVelocity);
}
function get maxAngularVelocity() {
return(__maxAngularVelocity);
}
function get facing() {
return(__facing);
}
function get desiredX() {
return(__desiredMove.__get__x());
}
function set desiredX(value) {
__desiredMove.__set__x(value);
//return(desiredX);
}
function get desiredY() {
return(__desiredMove.__get__y());
}
function set desiredY(value) {
__desiredMove.__set__y(value);
//return(desiredY);
}
function get desiredZ() {
return(__desiredMove.__get__z());
}
function set desiredZ(value) {
__desiredMove.__set__z(value);
//return(desiredZ);
}
function get speed() {
return(__speed);
}
function set speed(value) {
__speed = value;
//return(speed);
}
function get maxSpeed() {
return(__maxSpeed);
}
function get angularSpeed() {
return(__angularSpeed);
}
function set angularSpeed(value) {
__angularSpeed = value;
//return(angularSpeed);
}
function get maxAngularSpeed() {
return(__maxAngularSpeed);
}
function get moveDistance() {
return(__moveDistance);
}
function get moveDistance2() {
return(__moveDistance2);
}
}
Symbol 123 MovieClip [__Packages.classes.smashing.AirHockey.puck] Frame 0
class classes.smashing.AirHockey.puck extends classes.smashing.library.entity.dynamicEntity
{
var __sfx, __player, __worldCorners, __midFieldWorld, __goalTopWorld, __goalBottomWorld, __boardDirection, isActive, spawnPosition, __radius, __scoredGoal, __slowDownScalar;
function puck (renderClip, collisionClip) {
var _local1 = this;
super(renderClip, collisionClip);
_local1.__radius = _local1.__dimensions.halfWidth + 10;
_local1.__worldCorners = undefined;
_local1.__midFieldWorld = undefined;
_local1.__goalTopWorld = undefined;
_local1.__goalBottomWorld = undefined;
_local1.__scoredGoal = "";
_local1.__boardDirection = "vertical";
_local1.__stuckTimer = 0;
_local1.__stuckOn = "";
_local1.__slowDownScalar = 1;
_local1.__player = undefined;
_local1.spawnPosition = new classes.smashing.library.math.vector.vector3();
}
function setSoundFX(sfx) {
__sfx = sfx;
}
function setPlayer(p) {
__player = p;
}
function setWorldPoints(worldCorners, midFieldWorld) {
__worldCorners = worldCorners;
__midFieldWorld = midFieldWorld;
}
function setGoalPoints(goalTopWorld, goalBottomWorld) {
__goalTopWorld = goalTopWorld;
__goalBottomWorld = goalBottomWorld;
}
function setBoardDirection(boardDirection) {
__boardDirection = boardDirection;
}
function update(deltaTime) {
var _local1 = this;
var _local2 = deltaTime;
if (!_local1.isActive) {
} else {
super.update(_local2);
_local1.checkWorldCollision();
_local1.checkCorners(_local2);
if (_local1.__stuckTimer > 1) {
_local1.setMoveX(0);
_local1.setMoveY(0);
switch (_local1.__boardDirection) {
case "vartical" :
_local1.__position.setXYZ(_local1.spawnPosition.__get__x(), _local1.spawnPosition.__get__y() + ((_local1.__stuckOn == "player") ? 50 : -50), _local1.spawnPosition.__get__z());
break;
case "horizontal" :
_local1.__position.setXYZ(_local1.spawnPosition.__get__x() + ((_local1.__stuckOn == "player") ? 50 : -50), _local1.spawnPosition.__get__y(), _local1.spawnPosition.__get__z());
}
_local1.__lastPosition.setXYZ(_local1.position.x, _local1.position.y, _local1.position.z);
_local1.__stuckTimer = 0;
_local1.__stuckOn = "";
}
_local1.stopMove(_local2);
}
}
function postMoveUpdate() {
if (!isActive) {
return(undefined);
}
super.postMoveUpdate();
}
function spawn(position) {
var _local1 = this;
super.spawn(position);
_local1.setMoveX(0);
_local1.setMoveY(0);
_local1.__scoredGoal = "";
_local1.showRenderClip();
_local1.spawnPosition.copyFrom(position);
}
function respawn() {
spawn(spawnPosition);
}
function checkWorldCollision() {
var _local1 = this;
var _local3 = _local1.__position.__get__x();
var _local2 = _local1.__position.__get__y();
switch (_local1.__boardDirection) {
case "vertical" :
// unexpected jump
case "horizontal" :
if ((_local1.__goalBottomWorld[1].y <= (_local1.__position.__get__y() - (_local1.__radius + 5))) && ((_local1.__position.__get__y() + (_local1.__radius + 5)) <= _local1.__goalBottomWorld[0].y)) {
if ((_local1.__position.__get__x() - _local1.__radius) > _local1.__worldCorners[1].x) {
_local1.setMoveX(0);
_local1.setMoveY(0);
_local1.__scoredGoal = "enemy";
} else if ((_local1.__position.__get__x() + _local1.__radius) < _local1.__worldCorners[0].x) {
_local1.setMoveX(0);
_local1.setMoveY(0);
_local1.__scoredGoal = "player";
}
return;
}
default :
if ((_local1.__position.__get__x() - _local1.__radius) < _local1.__worldCorners[0].x) {
_local3 = _local1.__worldCorners[0].x + _local1.__radius;
_local1.__desiredMove.x = _local1.__desiredMove.x * -1;
_local1.__sfx.onSound("sfx_puck");
_local1.__player.hitPaused = false;
} else if ((_local1.__position.__get__x() + _local1.__radius) > _local1.__worldCorners[1].x) {
_local3 = _local1.__worldCorners[1].x - _local1.__radius;
_local1.__desiredMove.x = _local1.__desiredMove.x * -1;
_local1.__sfx.onSound("sfx_puck");
_local1.__player.hitPaused = false;
}
if ((_local1.__position.__get__y() - _local1.__radius) < _local1.__worldCorners[0].y) {
_local2 = _local1.__worldCorners[0].y + _local1.__radius;
_local1.__desiredMove.y = _local1.__desiredMove.y * -1;
_local1.__sfx.onSound("sfx_puck");
_local1.__player.hitPaused = false;
}
if ((_local1.__position.__get__y() + _local1.__radius) > _local1.__worldCorners[3].y) {
_local2 = _local1.__worldCorners[3].y - _local1.__radius;
_local1.__desiredMove.y = _local1.__desiredMove.y * -1;
_local1.__sfx.onSound("sfx_puck");
_local1.__player.hitPaused = false;
}
_local1.moveToXYZ(_local3, _local2, 0);
}
}
function checkCorners(deltaTime) {
var _local1 = this;
var _local3;
var _local2;
var distance;
_local3 = _local1.__worldCorners[0].x - _local1.__position.__get__x();
_local2 = _local1.__worldCorners[0].y - _local1.__position.__get__y();
distance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (distance < (_local1.__radius * 3)) {
_local1.__stuckTimer = _local1.__stuckTimer + deltaTime;
_local1.__stuckOn = "enemy";
} else {
_local3 = _local1.__worldCorners[1].x - _local1.__position.__get__x();
_local2 = _local1.__worldCorners[1].y - _local1.__position.__get__y();
distance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (distance < (_local1.__radius * 3)) {
_local1.__stuckTimer = _local1.__stuckTimer + deltaTime;
_local1.__stuckOn = "player";
} else {
_local3 = _local1.__worldCorners[2].x - _local1.__position.__get__x();
_local2 = _local1.__worldCorners[2].y - _local1.__position.__get__y();
distance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (distance < (_local1.__radius * 3)) {
_local1.__stuckTimer = _local1.__stuckTimer + deltaTime;
_local1.__stuckOn = "player";
} else {
_local3 = _local1.__worldCorners[3].x - _local1.__position.__get__x();
_local2 = _local1.__worldCorners[3].y - _local1.__position.__get__y();
distance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
if (distance < (_local1.__radius * 3)) {
_local1.__stuckTimer = _local1.__stuckTimer + deltaTime;
_local1.__stuckOn = "enemy";
} else {
_local1.__stuckTimer = 0;
_local1.__stuckOn = "";
}
}
}
}
}
function stopMove(deltaTime) {
var _local1 = this;
var _local2 = deltaTime / 0.032;
if (_local2 > 1) {
_local2 = 1;
}
var _local3 = 100 - _local2;
var scalar = ((_local3 / 100) * _local1.__slowDownScalar);
_local1.__desiredMove.scale(scalar);
if (Math.abs(_local1.__desiredMove.__get__x()) < 0.01) {
_local1.__desiredMove.__set__x(0);
_local1.__velocity.__set__x(0);
}
if (Math.abs(_local1.__desiredMove.__get__y()) < 0.01) {
_local1.__desiredMove.__set__y(0);
_local1.__velocity.__set__y(0);
}
}
function stopMoveX() {
}
function stopMoveY() {
}
function stopMoveZ() {
}
function get radius() {
return(__radius);
}
function get player() {
return(__player);
}
function get scoredGoal() {
return(__scoredGoal);
}
function set scoredGoal(value) {
__scoredGoal = value;
//return(scoredGoal);
}
function get slowDownScalar() {
return(__slowDownScalar);
}
function set slowDownScalar(value) {
__slowDownScalar = value;
//return(slowDownScalar);
}
}
Symbol 124 MovieClip [__Packages.classes.smashing.library.sound.soundFX] Frame 0
class classes.smashing.library.sound.soundFX extends MovieClip
{
var __isLoaded, __muteSound, __muteMusic;
function soundFX () {
var _local1 = this;
super();
_local1.__muteSound = false;
_local1.__muteMusic = false;
_local1.__isLoaded = false;
_local1.__soundStartedThisFrame = false;
_local1.musicVolume = 0;
_local1.__fadeInMusic = false;
_local1.__fadeOutMusic = false;
_local1.fadeSpeed = 3;
mx.events.EventDispatcher.initialize(_local1);
}
function onLoad() {
__isLoaded = true;
}
function set muteSound(mute) {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__muteSound == mute) {
} else {
_local1.__muteSound = mute;
_local1.__soundFX.setVolume((_local1.__muteSound ? 0 : 100));
//return(_local1.__get__muteSound());
}
return;
}
function get muteSound() {
return(__muteSound);
}
function set muteMusic(mute) {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__muteMusic == mute) {
} else {
_local1.__muteMusic = mute;
if (_local1.__muteMusic) {
_local1.__musicFX.stop();
} else {
_local1.__musicFX.start();
}
//return(_local1.__get__muteMusic());
}
return;
}
function get muteMusic() {
return(__muteMusic);
}
function isVoiceOver(soundID) {
return(true);
}
function onEnterFrame() {
var _local1 = this;
_local1.__soundStartedThisFrame = false;
if (_local1.__fadeInMusic) {
if (_local1.musicVolume < 100) {
_local1.musicVolume = _local1.musicVolume + _local1.fadeSpeed;
if (_local1.musicVolume >= 100) {
_local1.musicVolume = 100;
}
_local1.__musicFX.setVolume(_local1.musicVolume);
} else {
_local1.__fadeInMusic = false;
}
} else if (_local1.__fadeOutMusic) {
if (_local1.musicVolume > 0) {
_local1.musicVolume = _local1.musicVolume - _local1.fadeSpeed;
if (_local1.musicVolume < 0) {
_local1.musicVolume = 0;
}
_local1.__musicFX.setVolume(_local1.musicVolume);
} else {
_local1.__musicFX.stop();
_local1.__fadeOutMusic = false;
}
}
}
function onSound(soundID) {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__get__muteSound()) {
} else if (_local1.isVoiceOver(soundID)) {
if (_local1.__soundStartedThisFrame) {
return;
}
if ((_local1.__voiceFX != undefined) && (_local1.__voiceFX.position < _local1.__voiceFX.duration)) {
_local1.__voiceFX.stop();
delete _local1.__voiceFX;
}
_local1.__soundStartedThisFrame = true;
_local1.__voiceFX = new Sound(_local1.voice);
_local1.__voiceFX.attachSound(soundID);
_local1.__voiceFX.start();
_local1.__voiceFX.setVolume(80);
_local1.__voiceFX.controller = _local1;
_local1.__voiceFX.soundid = soundID;
_local1.__voiceFX.onSoundComplete = function () {
this.controller.dispatchEvent({type:"onVoiceComplete", soundid:this.soundid});
};
} else {
_local1.__soundFX = new Sound(_local1.sound);
_local1.__soundFX.attachSound(soundID);
_local1.__soundFX.start();
_local1.__soundFX.setVolume(80);
_local1.__soundFX.controller = _local1;
_local1.__soundFX.soundid = soundID;
_local1.__soundFX.onSoundComplete = function () {
this.controller.dispatchEvent({type:"onSoundComplete", soundid:this.soundid});
};
}
}
function onMusic() {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__get__muteMusic()) {
} else {
if (_local1.__musicFX != undefined) {
_local1.__musicFX.stop();
delete _local1.__musicFX;
}
_local1.musicVolume = 100;
_local1.__musicFX = new Sound(_local1.music);
_local1.__musicFX.onSoundComplete = function () {
this.start();
};
_local1.__musicFX.attachSound("musicloop");
_local1.__musicFX.start();
_local1.__musicFX.setVolume(_local1.musicVolume);
_local1.__fadeInMusic = false;
_local1.__fadeOutMusic = false;
}
}
function stopSound() {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__get__muteSound()) {
} else {
_local1.__soundFX.stop();
}
}
function fadeInMusic(speed) {
var _local1 = this;
if (!_local1.__isLoaded) {
} else {
if (speed != undefined) {
_local1.fadeSpeed = speed;
} else {
_local1.fadeSpeed = 3;
}
_local1.onMusic();
_local1.musicVolume = 0;
_local1.__musicFX.setVolume(_local1.musicVolume);
_local1.__set__muteMusic(false);
_local1.__fadeInMusic = true;
}
}
function fadeOutMusic(speed) {
var _local1 = this;
if (!_local1.__isLoaded) {
} else if (_local1.__get__muteMusic()) {
} else {
if (speed != undefined) {
_local1.fadeSpeed = speed;
}
_local1.__fadeOutMusic = true;
}
}
function get log() {
return(classes.smashing.library.utility.utilityDebug.log);
}
}
Symbol 125 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
var _local3 = queue;
if (_local3 != undefined) {
var l = _local3.length;
var _local1;
_local1 = 0;
while (_local1 < l) {
var _local2 = _local3[_local1];
if (_local2 == handler) {
_local3.splice(_local1, 1);
return;
}
_local1++;
}
}
}
static function initialize(object) {
var _local1 = object;
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
_local1.addEventListener = _fEventDispatcher.addEventListener;
_local1.removeEventListener = _fEventDispatcher.removeEventListener;
_local1.dispatchEvent = _fEventDispatcher.dispatchEvent;
_local1.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local2 = eventObj;
var queueName = ("__q_" + _local2.type);
var queue = queueObj[queueName];
if (queue != undefined) {
var i;
for (i in queue) {
var _local1 = queue[i];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(_local2);
}
if (_local1[_local2.type] != undefined) {
if (exceptions[_local2.type] == undefined) {
_local1[_local2.type](_local2);
}
}
} else {
_local1.apply(queueObj, [_local2]);
}
}
}
}
function dispatchEvent(eventObj) {
var _local1 = eventObj;
var _local2 = this;
if (_local1.target == undefined) {
_local1.target = _local2;
}
_local2[_local1.type + "Handler"](_local1);
_local2.dispatchQueue(_local2, _local1);
}
function addEventListener(event, handler) {
var _local2 = this;
var _local1 = "__q_" + event;
if (_local2[_local1] == undefined) {
_local2[_local1] = new Array();
}
_global.ASSetPropFlags(_local2, _local1, 1);
_removeEventListener(_local2[_local1], event, handler);
_local2[_local1].push(handler);
}
function removeEventListener(event, handler) {
var _local1 = "__q_" + event;
_removeEventListener(this[_local1], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1};
}
Symbol 126 MovieClip [__Packages.classes.smashing.AirHockey.soundFX] Frame 0
class classes.smashing.AirHockey.soundFX extends classes.smashing.library.sound.soundFX
{
function soundFX () {
super();
}
function isVoiceOver(soundID) {
return(false);
}
}
Symbol 127 MovieClip [__Packages.classes.smashing.library.entity.npcEntity] Frame 0
class classes.smashing.library.entity.npcEntity extends classes.smashing.library.entity.dynamicEntity
{
var __type;
function npcEntity (renderClip, collisionClip) {
super(renderClip, collisionClip);
__type = "npc";
}
function update(deltaTime) {
super.update(deltaTime);
}
function postMoveUpdate() {
super.postMoveUpdate();
}
}
Symbol 128 MovieClip [__Packages.classes.smashing.library.entity.playerEntity] Frame 0
class classes.smashing.library.entity.playerEntity extends classes.smashing.library.entity.npcEntity
{
var __type;
function playerEntity (renderClip, collisionClip) {
super(renderClip, collisionClip);
__type = "player";
}
function update(deltaTime) {
super.update(deltaTime);
}
function postMoveUpdate() {
super.postMoveUpdate();
}
}
Symbol 129 MovieClip [__Packages.classes.smashing.AirHockey.player] Frame 0
class classes.smashing.AirHockey.player extends classes.smashing.library.entity.playerEntity
{
var __isReady, __sfx, __worldCorners, __midFieldWorld, __puck, __enemy, __collision, __boardDirection, isActive, spawnPosition, __radius, __lastPosition2, __score, __canAttack;
function player (renderClip, collisionClip) {
var _local1 = this;
super(renderClip, collisionClip);
_local1.__radius = _local1.__dimensions.halfWidth + 10;
_local1.__worldCorners = undefined;
_local1.__midFieldWorld = undefined;
_local1.__puck = undefined;
_local1.__hitPuck = false;
_local1.__hitPuckTimer = 0;
_local1.__lastPosition2 = new classes.smashing.library.math.vector.vector3();
_local1.__boardDirection = "vertical";
_local1.__score = 0;
_local1.__canAttack = false;
_local1.__isReady = false;
renderClip.onRelease = function () {
};
_local1.spawnPosition = new classes.smashing.library.math.vector.vector3();
}
function setReady() {
__isReady = true;
}
function setSoundFX(sfx) {
__sfx = sfx;
}
function setWorldPoints(worldCorners, midFieldWorld) {
__worldCorners = worldCorners;
__midFieldWorld = midFieldWorld;
}
function setEntities(p, e) {
__puck = p;
__enemy = e;
}
function setCollision(collision) {
__collision = collision;
}
function setBoardDirection(boardDirection) {
__boardDirection = boardDirection;
}
function update(deltaTime) {
var _local1 = this;
if (!_local1.isActive) {
} else {
if (_local1.__hitPuck) {
_local1.__hitPuckTimer = _local1.__hitPuckTimer - deltaTime;
if (_local1.__hitPuckTimer <= 0) {
_local1.__hitPuckTimer = 0;
_local1.__hitPuck = false;
}
}
_local1.__lastPosition2.copyFrom(_local1.__lastPosition);
super.update(deltaTime);
_local1.checkWorldCollision();
_local1.checkPuckCollision();
}
}
function postMoveUpdate() {
if (!isActive) {
return(undefined);
}
super.postMoveUpdate();
}
function spawn(position) {
super.spawn(position);
spawnPosition.copyFrom(position);
}
function respawn() {
spawn(spawnPosition);
}
function setHitPuck() {
var _local1 = this;
_local1.__hitPuck = true;
_local1.__hitPuckTimer = 0;
_local1.__enemy.__set__canAttack(true);
_local1.__sfx.onSound("sfx_puck");
}
function scored() {
var _local1 = this;
_local1.__score++;
_local1.__sfx.onSound("sfx_goal");
_local1.__puck.setMoveX(0);
_local1.__puck.setMoveY(0);
_local1.__puck.__set__scoredGoal("");
switch (_local1.__boardDirection) {
case "vartical" :
_local1.__puck.moveToXYZ(_local1.__puck.spawnPosition.__get__x(), _local1.__puck.spawnPosition.__get__y() - 50, _local1.__puck.spawnPosition.__get__z());
break;
case "horizontal" :
_local1.__puck.moveToXYZ(_local1.__puck.spawnPosition.__get__x() - 50, _local1.__puck.spawnPosition.__get__y(), _local1.__puck.spawnPosition.__get__z());
}
_local1.__canAttack = false;
}
function isPuckOnOwnHalf() {
var _local1 = this;
switch (_local1.__boardDirection) {
case "horizontal" :
return(_local1.__puck.__get__x() >= (_local1.__midFieldWorld[0].x - _local1.__puck.__get__radius()));
case "vertical" :
return(_local1.__puck.__get__y() >= (_local1.__midFieldWorld[0].y - _local1.__puck.__get__radius()));
}
return(false);
}
function checkPuckCollision() {
var _local1 = this;
if (!_local1.isActive) {
} else if (_local1.__hitPuck) {
} else if (!_local1.__canAttack) {
} else if (_local1.isPuckOnOwnHalf()) {
var l = (new classes.smashing.library.math.line.line2(_local1.__position.__get__v2(), _local1.__lastPosition2.__get__v2(), _local1.__radius));
var s = (new classes.smashing.library.math.sphere.sphere2(_local1.__puck.position.v2, _local1.__puck.__get__radius()));
var hit = (new classes.smashing.library.math.vector.vector2());
if (_local1.__collision.test2DLineSphereIntersect(hit, s, l)) {
var deltaX = (_local1.__puck.__get__x() - hit.__get__x());
var _local3 = _local1.__puck.__get__y() - hit.__get__y();
var distance = Math.sqrt((deltaX * deltaX) + (_local3 * _local3));
var offsetX = (deltaX / distance);
var offsetY = (_local3 / distance);
var radii = (_local1.__radius + _local1.__puck.__get__radius());
if (!_local1.hitPaused) {
deltaX = _local1.__position.__get__x() - _local1.__lastPosition2.__get__x();
_local3 = _local1.__position.__get__y() - _local1.__lastPosition2.__get__y();
distance = Math.sqrt((deltaX * deltaX) + (_local3 * _local3));
var _local2 = 1;
if (distance > 25) {
_local2 = distance / 25;
_local2 = ((_local2 > 2) ? 2 : _local2);
}
var puckMove = _local1.__puck.desiredMove.getLength();
if (puckMove < 1) {
puckMove = 1;
offsetX = offsetX * puckMove;
offsetY = offsetY * puckMove;
}
_local1.__puck.moveToXYZ(_local1.__position.__get__x() + (offsetX * radii), _local1.__position.__get__y() + (offsetY * radii), 0);
_local1.__puck.setMoveX(offsetX * _local2);
_local1.__puck.setMoveY(offsetY * _local2);
_local1.__puck.renderClip.gotoAndStop("off");
if (_local1.__puck.desiredMove.getLength() > 5) {
_local1.__puck.desiredMove.normalize();
_local1.__puck.desiredMove.scale(5);
}
_local1.setHitPuck();
_local1.hitPausedTimer = 0.1;
} else {
_local1.__puck.moveToXYZ(_local1.__position.__get__x() + (offsetX * radii), _local1.__position.__get__y() + (offsetY * radii), 0);
}
}
}
}
function checkMoveDirections() {
var _local1 = this;
var _local3 = new classes.smashing.library.math.vector.vector2(_local1.__puck.last.x - _local1.__position.__get__x(), _local1.__puck.last.y - _local1.__position.__get__y());
var _local2 = new classes.smashing.library.math.vector.vector2(_local1.__puck.last.x - _local1.__lastPosition2.__get__x(), _local1.__puck.last.y - _local1.__lastPosition2.__get__y());
var p1D = _local3.getLength();
var p2D = _local2.getLength();
return(p1D > p2D);
}
function checkWorldCollision() {
var _local1 = this;
var _local3 = _local1.__position.__get__x();
var _local2 = _local1.__position.__get__y();
var offset = 0;
if (!_local1.__isReady) {
offset = 25;
}
switch (_local1.__boardDirection) {
case "horizontal" :
if ((_local1.__position.__get__x() - _local1.__radius) < (_local1.__midFieldWorld[0].x + offset)) {
_local3 = (_local1.__midFieldWorld[0].x + _local1.__radius) + offset;
} else if ((_local1.__position.__get__x() + _local1.__radius) >= (_local1.__worldCorners[1].x - 0)) {
_local3 = _local1.__worldCorners[1].x - (_local1.__radius + 0);
}
if ((_local1.__position.__get__y() - _local1.__radius) < _local1.__midFieldWorld[0].y) {
_local2 = _local1.__midFieldWorld[0].y + _local1.__radius;
} else if ((_local1.__position.__get__y() + _local1.__radius) > _local1.__midFieldWorld[1].y) {
_local2 = _local1.__midFieldWorld[1].y - _local1.__radius;
}
break;
case "vertical" :
}
_local1.moveToXYZ(_local3, _local2, 0);
}
function get radius() {
return(__radius);
}
function get last2() {
return(__lastPosition2);
}
function get score() {
return(__score);
}
function set score(value) {
__score = value;
//return(score);
}
function get canAttack() {
return(__canAttack);
}
function set canAttack(value) {
__canAttack = value;
//return(canAttack);
}
var hitPaused = false;
var hitPausedTimer = 0;
}
Symbol 130 MovieClip [__Packages.classes.smashing.AirHockey.enemy] Frame 0
class classes.smashing.AirHockey.enemy extends classes.smashing.library.entity.npcEntity
{
var __sfx, __worldCorners, __midFieldWorld, __puck, __player, __collision, __boardDirection, isActive, setDesiredPosition, spawnPosition, __radius, __score, __canAttack;
function enemy (renderClip, collisionClip) {
var _local1 = this;
super(renderClip, collisionClip);
_local1.moveType = "advanced";
_local1.__radius = _local1.__dimensions.halfWidth + 10;
_local1.__worldCorners = undefined;
_local1.__midFieldWorld = undefined;
_local1.__puck = undefined;
_local1.__hitPuck = false;
_local1.__hitPuckTimer = 0;
_local1.__boardDirection = "vertical";
_local1.__score = 0;
_local1.__canAttack = false;
_local1.spawnPosition = new classes.smashing.library.math.vector.vector3();
}
function setSoundFX(sfx) {
__sfx = sfx;
}
function setWorldPoints(worldCorners, midFieldWorld) {
__worldCorners = worldCorners;
__midFieldWorld = midFieldWorld;
}
function setEntities(p, e) {
__puck = p;
__player = e;
}
function setCollision(collision) {
__collision = collision;
}
function setBoardDirection(boardDirection) {
__boardDirection = boardDirection;
}
function scored() {
var _local1 = this;
_local1.__score++;
_local1.__sfx.onSound("sfx_goal");
_local1.__puck.setMoveX(0);
_local1.__puck.setMoveY(0);
_local1.__puck.__set__scoredGoal("");
switch (_local1.__boardDirection) {
case "vartical" :
_local1.__puck.moveToXYZ(_local1.__puck.spawnPosition.__get__x(), _local1.__puck.spawnPosition.__get__y() + 50, _local1.__puck.spawnPosition.__get__z());
break;
case "horizontal" :
_local1.__puck.moveToXYZ(_local1.__puck.spawnPosition.__get__x() + 50, _local1.__puck.spawnPosition.__get__y(), _local1.__puck.spawnPosition.__get__z());
}
_local1.__puck.renderClip.gotoAndPlay("blink");
_local1.__canAttack = false;
}
function update(deltaTime) {
var _local1 = this;
if (!_local1.isActive) {
} else {
if (!_local1.__canAttack) {
switch (_local1.__boardDirection) {
case "horizontal" :
_local1.setDesiredPositionXYZ(_local1.spawnPosition.__get__x(), _local1.spawnPosition.__get__y(), 0);
break;
case "vertical" :
_local1.setDesiredPositionXYZ(_local1.spawnPosition.__get__x(), _local1.spawnPosition.__get__y(), 0);
}
} else if (_local1.__hitPuck) {
_local1.__hitPuckTimer = _local1.__hitPuckTimer - deltaTime;
if ((_local1.__hitPuckTimer <= 0) || (!_local1.isPuckOnOwnHalf())) {
_local1.__hitPuckTimer = 0;
_local1.__hitPuck = false;
}
} else if (_local1.isPuckOnOwnHalf() && (_local1.__canAttack)) {
switch (_local1.__boardDirection) {
case "vertical" :
_local1.setDesiredPositionXYZ(_local1.__puck.position.x, _local1.__puck.position.y - 30, _local1.__puck.position.z);
break;
case "horizontal" :
_local1.setDesiredPositionXYZ(_local1.__puck.position.x - 30, _local1.__puck.position.y, _local1.__puck.position.z);
}
} else {
switch (_local1.__boardDirection) {
case "horizontal" :
_local1.setDesiredPositionXYZ(_local1.spawnPosition.__get__x(), _local1.__puck.__get__y(), 0);
break;
case "vertical" :
_local1.setDesiredPositionXYZ(_local1.__puck.__get__x(), _local1.spawnPosition.__get__y(), 0);
}
}
_local1.__moveDistance = 100;
_local1.__moveDistance2 = 10000;
super.update(deltaTime);
_local1.checkPuckCollision();
_local1.checkWorldCollision();
}
}
function postMoveUpdate() {
if (!isActive) {
return(undefined);
}
super.postMoveUpdate();
}
function spawn(position) {
var _local1 = position;
super.spawn(_local1);
setDesiredPosition(_local1);
spawnPosition.copyFrom(_local1);
}
function respawn() {
spawn(spawnPosition);
}
function setHitPuck() {
var _local1 = this;
_local1.__hitPuck = true;
_local1.__hitPuckTimer = 0;
_local1.__player.__set__canAttack(true);
_local1.__sfx.onSound("sfx_puck");
}
function isPuckOnOwnHalf() {
var _local1 = this;
switch (_local1.__boardDirection) {
case "horizontal" :
return(_local1.__puck.__get__x() <= (_local1.__midFieldWorld[0].x + _local1.__puck.__get__radius()));
case "vertical" :
return(_local1.__puck.__get__y() <= (_local1.__midFieldWorld[0].y + _local1.__puck.__get__radius()));
}
return(false);
}
function checkPuckCollision() {
var _local1 = this;
if (!_local1.isActive) {
} else if (_local1.__hitPuck) {
} else if (!_local1.__canAttack) {
} else if (_local1.isPuckOnOwnHalf()) {
var l = (new classes.smashing.library.math.line.line2(_local1.__position.__get__v2(), _local1.__lastPosition.__get__v2(), _local1.__radius));
var s = (new classes.smashing.library.math.sphere.sphere2(_local1.__puck.position.v2, _local1.__puck.__get__radius()));
var hit = (new classes.smashing.library.math.vector.vector2());
if (_local1.__collision.test2DLineSphereIntersect(hit, s, l)) {
var _local3 = _local1.__puck.__get__x() - _local1.__position.__get__x();
var _local2 = _local1.__puck.__get__y() - _local1.__position.__get__y();
var distance = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
var offsetX = (_local3 / distance);
var offsetY = (_local2 / distance);
var radii = (_local1.__radius + _local1.__puck.__get__radius());
_local1.__puck.moveToXYZ(_local1.__position.__get__x() + (offsetX * radii), _local1.__position.__get__y() + (offsetY * radii), 0);
_local1.__puck.setMoveX(offsetX);
_local1.__puck.setMoveY(offsetY);
_local1.__puck.renderClip.gotoAndStop("off");
_local1.__player.hitPaused = false;
_local1.setHitPuck();
}
}
}
function checkWorldCollision() {
var _local1 = this;
var _local3 = _local1.__position.__get__x();
var _local2 = _local1.__position.__get__y();
switch (_local1.__boardDirection) {
case "horizontal" :
if ((_local1.__position.__get__x() - _local1.__radius) < _local1.__worldCorners[0].x) {
_local3 = _local1.__worldCorners[0].x + _local1.__radius;
} else if ((_local1.__position.__get__x() + _local1.__radius) > _local1.__midFieldWorld[0].x) {
_local3 = _local1.__midFieldWorld[0].x - _local1.__radius;
}
if ((_local1.__position.__get__y() - _local1.__radius) < _local1.__midFieldWorld[0].y) {
_local2 = _local1.__midFieldWorld[0].y + _local1.__radius;
} else if ((_local1.__position.__get__y() + _local1.__radius) > _local1.__midFieldWorld[1].y) {
_local2 = _local1.__midFieldWorld[1].y - _local1.__radius;
}
break;
case "vertical" :
}
_local1.moveToXYZ(_local3, _local2, 0);
}
function get radius() {
return(__radius);
}
function get score() {
return(__score);
}
function set score(value) {
__score = value;
//return(score);
}
function get canAttack() {
return(__canAttack);
}
function set canAttack(value) {
__canAttack = value;
//return(canAttack);
}
}
Symbol 76 MovieClip Frame 1
stop();
Symbol 76 MovieClip Frame 6
play();
Symbol 76 MovieClip Frame 51
_parent.AirHockey.setReady();
gotoAndStop ("off");
Symbol 91 Button
on (release) {
AirHockey.start();
}
Symbol 97 Button
on (release) {
getURL ("http://www.marioparty.com/", "_parent");
}