Frame 1
_root.gamemode = 2;
var game = (new com.midasplayer.game.itsybitsyspider.Game());
stop();
Symbol 346 MovieClip [__Packages.com.midasplayer.util.GameBase] Frame 0
class com.midasplayer.util.GameBase
{
static var gameData, game_, checkGameDataIntervalId_;
function GameBase () {
gameMode_ = GAME_MODE_MONEY;
}
function startGame() {
}
static function setGameMode(gameMode) {
gameMode_ = gameMode;
}
static function getGameMode() {
return(gameMode_);
}
static function setGameType(gameType) {
gameType_ = gameType;
}
static function getGameType() {
return(gameType_);
}
static function getGameData() {
return(gameData);
}
static function reportGameStart() {
com.midasplayer.util.Log.debug("gameStart");
fscommand ("gameStart");
}
static function reportGameEnd(score) {
com.midasplayer.util.Log.debug("gameEnd " + String(score));
fscommand ("gameEnd", String(score));
}
static function reportGameQuit() {
com.midasplayer.util.Log.debug("gameQuit");
fscommand ("gameQuit");
}
function reportGameOver(score) {
com.midasplayer.util.Log.debug("gameOver " + String(score));
fscommand ("gameOver", String(score));
}
static function reportPlayData(pCode, pData, pScore) {
if (gameMode_ != GAME_MODE_MONEY) {
return(undefined);
}
var _local1;
_local1 = String(pCode);
if ((pData != null) && (pData.length > 0)) {
_local1 = _local1 + ("," + pData);
}
if (((pScore != undefined) && (pScore != null)) && (pScore.length > 0)) {
_local1 = _local1 + ("=" + pScore);
}
trace(_local1);
com.midasplayer.util.Log.debug("playData " + _local1);
fscommand ("playData", "" + _local1);
}
static function runsLocal() {
return(_root._URL.substr(0, 5).toLowerCase() == "file:");
}
function init(game) {
game_ = game;
checkGameDataIntervalId_ = setInterval(this, "checkGameData", 200);
}
function checkGameData() {
if (!hasGameData_) {
if (((_root.gameData != null) && (_root.gameData != undefined)) && (_root.gameData != "")) {
hasGameData_ = true;
parseGameData(_root.gameData);
clearInterval(checkGameDataIntervalId_);
game_.startGame();
}
}
}
function parseGameData(myData) {
gameData = new com.midasplayer.util.Map();
var _local7 = new XML();
_local7.ignoreWhite = true;
_local7.parseXML(myData);
var _local4 = _local7.firstChild;
if (_local4.nodeName == "gamedata") {
for (var _local6 in _local4.attributes) {
var _local5;
var _local2 = _local4.attributes[_local6];
gameData.put(_local6, _local2);
}
var _local1 = _local4.firstChild;
while (_local1 != null) {
if (_local1.nodeName == "text") {
com.midasplayer.util.I18n.addTranslation(String(_local1.attributes.id), String(_local1.firstChild));
} else {
var _local3 = "0";
for (var _local6 in _local1.attributes) {
var _local2 = _local1.attributes[_local6];
if (_local6 == "id") {
_local3 = _local2;
} else {
gameData.put((((_local1.nodeName + ".") + _local3) + ".") + _local6, _local2);
}
}
}
_local1 = _local1.nextSibling;
}
}
}
static var GAME_MODE_DEBUG = 0;
static var GAME_MODE_PRACTICE = 1;
static var GAME_MODE_MONEY = 2;
static var GAME_TYPE_SINGLE = 0;
static var GAME_TYPE_MULTI = 1;
static var gameMode_ = GAME_MODE_DEBUG;
static var gameType_ = GAME_TYPE_SINGLE;
static var hasGameData_ = false;
}
Symbol 347 MovieClip [__Packages.com.midasplayer.util.Map] Frame 0
class com.midasplayer.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["@" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["@" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["@" + key]);
}
function remove(key) {
var _local2 = map["@" + key];
delete map["@" + key];
lastSize = -1;
return(_local2);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + "x";
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3.substring(1);
}
return(_local2);
}
function foreach(fn) {
do {
if ((in map) == null) {
break;
}
var _local3 = in map;
} while (fn(_local3.substring(1), map[_local3]) != false);
do {
} while ("foreach" != null);
lastSize = -1;
}
}
Symbol 348 MovieClip [__Packages.com.midasplayer.util.ArrayList] Frame 0
class com.midasplayer.util.ArrayList
{
var value;
function ArrayList () {
value = new Array();
}
function insert(obj, pos) {
var _local3 = value.length;
if (pos == undefined) {
value.push(obj);
return(_local3);
}
if (pos > _local3) {
pos = _local3;
}
var _local2 = _local3 - 1;
while (_local2 > (pos - 1)) {
value[_local2 + 1] = value[_local2];
_local2--;
}
value[pos] = obj;
return(pos);
}
function get(pos) {
return(value[pos]);
}
function indexOf(obj) {
var _local2 = 0;
while (_local2 < value.length) {
if (obj == value[_local2]) {
return(_local2);
}
_local2++;
}
return(-1);
}
function remove(obj) {
return(removeByIndex(indexOf(obj)));
}
function removeByIndex(pos) {
var _local5;
var _local3 = value.length;
if ((pos < _local3) && (pos >= 0)) {
_local5 = value[pos];
delete value[pos];
var _local2 = pos;
while (_local2 < (_local3 - 1)) {
value[_local2] = value[_local2 + 1];
_local2++;
}
value.length = _local3 - 1;
}
return(_local5);
}
function size() {
return(value.length);
}
function clear() {
value = new Array();
}
function toArray() {
return(value);
}
function foreach(fn) {
var _local2 = 0;
var _local3 = value.length;
while (_local2 < _local3) {
if (fn(_local2, value[_local2]) == false) {
break;
}
_local2++;
}
}
function sortOn(field) {
value.sortOn(field);
}
function sort() {
value.sort();
}
function subList(from, to) {
if (!to) {
to = value.length;
}
var a = (new com.midasplayer.util.ArrayList());
var i = from;
while (i < to) {
a.insert(eval (i));
i++;
}
return(a);
}
}
Symbol 349 MovieClip [__Packages.com.midasplayer.util.Log] Frame 0
class com.midasplayer.util.Log
{
function Log () {
}
static function setLevel(level) {
level_ = level;
}
static function debug(msg) {
if (level_ <= LEVEL_DEBUG) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_DEBUG, msg));
}
}
static function warning(msg) {
if (level_ <= LEVEL_WARNING) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_WARNING, msg));
}
}
static function error(msg) {
if (level_ <= LEVEL_ERROR) {
log_.insert(new com.midasplayer.util.LogEntry(LEVEL_ERROR, msg));
}
}
static function getLog() {
if (log_.size() != logStringLastUpdatedSize_) {
logString_ = "";
var _local1 = 0;
while (_local1 < log_.size()) {
var _local2 = com.midasplayer.util.LogEntry(log_.get(_local1));
if (_local1 > 0) {
logString_ = logString_ + newline;
}
logString_ = logString_ + LEVEL_STRINGS[_local2.getLevel()];
logString_ = logString_ + ": ";
logString_ = logString_ + _local2.getMessage();
logStringLastUpdatedSize_ = log_.size();
_local1++;
}
}
return(logString_);
}
static var LEVEL_ALL = -1;
static var LEVEL_NONE = 1000;
static var LEVEL_DEBUG = 0;
static var LEVEL_WARNING = 1;
static var LEVEL_ERROR = 2;
static var LEVEL_STRINGS = ["DEBUG", "WARNING", "ERROR"];
static var level_ = LEVEL_ALL;
static var log_ = new com.midasplayer.util.ArrayList();
static var logString_ = "";
static var logStringLastUpdatedSize_ = 0;
}
Symbol 350 MovieClip [__Packages.com.midasplayer.util.LogEntry] Frame 0
class com.midasplayer.util.LogEntry
{
var level_, message_;
function LogEntry (level, msg) {
level_ = level;
message_ = msg;
}
function getLevel() {
return(level_);
}
function getMessage() {
return(message_);
}
}
Symbol 351 MovieClip [__Packages.com.midasplayer.util.I18n] Frame 0
class com.midasplayer.util.I18n
{
function I18n () {
}
static function addTranslation(name, val) {
val = val.split("'").join("'");
val = val.split("\r\n").join(newline);
translations_.put(name, val);
}
static function format(name, replace0, replace1, replace2) {
var _local2 = translations_.get(name);
if (_local2 == undefined) {
return(("{" + name) + "}");
}
var _local1 = _local2.toString();
if (replace0 != undefined) {
var _local3 = _local1.split("{0}");
_local1 = _local3.join(replace0);
if (replace1 != undefined) {
_local3 = _local1.split("{1}");
_local1 = _local3.join(replace1);
if (replace2 != undefined) {
_local3 = _local1.split("{2}");
_local1 = _local3.join(replace2);
}
}
}
return(_local1);
}
static var translations_ = new com.midasplayer.util.Map();
}
Symbol 352 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Game] Frame 0
class com.midasplayer.game.itsybitsyspider.Game extends com.midasplayer.util.GameBase
{
static var score_, livesLeft_, roundNum_, random_, boardLayer_, infoLayer_, board_, gameEnded_, animId_, timeLeftAlerted_, bonusAdded_, alertTimeAnimId_, quitIntervalId_, timeLeft_;
var init;
function Game () {
super();
Stage.showMenu = false;
Stage.scaleMode = "noScale";
_root._focusrect = false;
com.midasplayer.util.GameBase.setGameMode(_root.gamemode);
com.midasplayer.util.Log.setLevel(com.midasplayer.util.Log.LEVEL_NONE);
init(this);
}
function startGame() {
score_ = 0;
livesLeft_ = 3;
roundNum_ = 1;
random_ = new com.midasplayer.util.Random(Number(com.midasplayer.util.GameBase.gameData.get("seed")));
boardLayer_ = _root.createEmptyMovieClip("boardlayer", _root.getNextHighestDepth());
infoLayer_ = _root.createEmptyMovieClip("infolayer", _root.getNextHighestDepth());
_root.attachMovie("bar", "bar", _root.getNextHighestDepth());
_root.bar.timelefth.text = com.midasplayer.util.I18n.format("time_left");
_root.bar.scoreh.text = com.midasplayer.util.I18n.format("score").toUpperCase();
_root.bar.clearedh.text = com.midasplayer.util.I18n.format("cleared");
_root.bar.lefth.text = com.midasplayer.util.I18n.format("left");
_root.attachMovie("lowerbar", "lowerbar", _root.getNextHighestDepth());
_root.lowerbar._y = 500;
_root.lowerbar.endgame.txt.text = com.midasplayer.util.I18n.format("end_game");
_root.lowerbar.sound.txt.text = com.midasplayer.util.I18n.format("sound_off");
_root.lowerbar.sound.onRelease = function () {
com.midasplayer.game.itsybitsyspider.Game.switchSound();
};
_root.lowerbar.endgame.onRelease = function () {
com.midasplayer.game.itsybitsyspider.Game.endGamePressed();
};
displayScore();
displayTimeLeft();
displayPercentFilled();
displayPercentLeft();
com.midasplayer.util.GameBase.reportGameStart();
com.midasplayer.util.GameBase.reportPlayData(19, VERSION, "0");
board_ = new com.midasplayer.game.itsybitsyspider.Board(roundNum_, boardLayer_, 0);
showInstructions();
}
static function getBoard() {
return(board_);
}
static function switchSound() {
var _local2 = com.midasplayer.fx.SoundManager.isSoundEnabled();
com.midasplayer.fx.SoundManager.enableSounds(!_local2);
if (_local2) {
_root.lowerbar.sound.txt.text = com.midasplayer.util.I18n.format("sound_on");
} else {
_root.lowerbar.sound.txt.text = com.midasplayer.util.I18n.format("sound_off");
}
}
static function endGamePressed() {
if (gameEnded_) {
return(undefined);
}
_root.lowerbar.endgame.onRelease = undefined;
_root.lowerbar.endgame.useHandCursor = false;
if (!board_.isStopped()) {
board_.stop();
}
com.midasplayer.util.AnimPlayer.stop(animId_);
infoLayer_.box.removeMovieClip();
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.util.GameBase.reportPlayData(77, "", "0");
_root.game.gameOver();
}
function showInstructions() {
com.midasplayer.fx.SoundManager.play("itty bitty intro#1", 100);
infoLayer_.attachMovie("instructions", "box", infoLayer_.getNextHighestDepth());
infoLayer_.box._y = infoLayer_.box._height;
infoLayer_.box.header.text = com.midasplayer.util.I18n.format("instructions_header");
var _local5 = (((com.midasplayer.util.I18n.format("instructions_text1") + "\n\n") + com.midasplayer.util.I18n.format("instructions_text2")) + "\n\n") + com.midasplayer.util.I18n.format("instructions_text3");
infoLayer_.box.text1.text = _local5;
infoLayer_.box.start.text = com.midasplayer.util.I18n.format("start");
infoLayer_.box.start.autoSize = true;
var _local4 = infoLayer_.box.start._width;
var _local6 = infoLayer_.box.start._height;
var _local3 = infoLayer_.box.start._x + ((165 - _local4) / 2);
var _local2 = (infoLayer_.box.start._y + _local6) - 2;
infoLayer_.box.start._width = 165;
infoLayer_.box.start.autoSize = false;
infoLayer_.box.createEmptyMovieClip("line", infoLayer_.box.getNextHighestDepth());
infoLayer_.box.line.lineStyle(1, 16757580, 100);
infoLayer_.box.line.moveTo(_local3, _local2);
infoLayer_.box.line.lineTo(_local3 + _local4, _local2);
infoLayer_.box.attachMovie("instranim", "anim", 1);
infoLayer_.box.anim._xscale = 130;
infoLayer_.box.anim._yscale = 130;
infoLayer_.box.anim.net.gotoAndStop(1);
infoLayer_.box.anim._visible = false;
infoLayer_.box.anim._x = 558;
infoLayer_.box.anim._y = 278;
infoLayer_.box._x = 140;
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showInstructionsAnim}], callback:endShowInstructions, callback_scope:this, tps:50});
}
function showInstructionsAnim(tick, alpha) {
var _local3 = false;
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 90);
infoLayer_.box._y = ((-infoLayer_.box._height) + (infoLayer_.box._height * (1 - (1 - _local6)))) - 1;
var _local5 = 15 - Math.round(14 * com.midasplayer.util.AnimPlayer.tickToPercent(tick, 90, 700));
if (_local5 != infoLayer_.box.in_secs.secs) {
infoLayer_.box.in_secs.text = com.midasplayer.util.I18n.format("in_x_seconds", "" + _local5);
infoLayer_.box.in_secs.secs = _local5;
}
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 90, 20);
if (_local6 == 1) {
infoLayer_.box.onPress = function () {
this.clicked = true;
};
}
if (_local4 != 0) {
infoLayer_.box.anim._visible = true;
infoLayer_.box.anim._alpha = _local4 * 100;
}
if (_local4 == 1) {
if (infoLayer_.box.anim.startedAt == undefined) {
infoLayer_.box.anim.startedAt = tick;
} else {
var _local7 = Math.round((tick - infoLayer_.box.anim.startedAt) / 3);
infoLayer_.box.anim.net.gotoAndStop(_local7);
}
}
if (infoLayer_.box.clicked) {
_local3 = true;
}
if (tick > 800) {
_local3 = true;
}
return(_local3);
}
function endShowInstructions() {
infoLayer_.box.clicked = false;
startRound();
}
function startRound() {
board_.clear();
delete board_;
timeLeftAlerted_ = false;
bonusAdded_ = false;
board_ = new com.midasplayer.game.itsybitsyspider.Board(roundNum_, boardLayer_, random_.nextInt(1000000));
showRoundStart();
}
function showRoundStart() {
displayTimeLeft();
displayPercentLeft();
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showRoundStartAnim}], callback:endShowRoundStart, callback_scope:this, tps:50});
}
function showRoundStartAnim(tick, alpha) {
var _local2 = false;
var _local1 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 60);
infoLayer_.box._y = ((-infoLayer_.box._height) + (infoLayer_.box._height * (1 - (_local1 * _local1)))) - 1;
if (_local1 == 1) {
_local2 = true;
}
return(_local2);
}
function endShowRoundStart() {
infoLayer_.box.removeMovieClip();
board_.start();
com.midasplayer.fx.SoundManager.stop("itty start#1");
com.midasplayer.fx.SoundManager.stop("itty bitty intro#1");
com.midasplayer.fx.SoundManager.play("itty loop#1", 100, true);
}
function areMoreLevels() {
var _local1 = roundNum_ + 1;
var _local2 = com.midasplayer.util.GameBase.gameData.get(("level." + _local1) + ".time");
return(_local2 != undefined);
}
function endRound() {
if (gameEnded_) {
return(undefined);
}
com.midasplayer.util.AnimPlayer.end(alertTimeAnimId_);
if (!areMoreLevels()) {
gameOver();
} else {
showRoundEnded();
}
}
function showRoundEnded() {
com.midasplayer.fx.SoundManager.play("itty start#1", 100);
bonusAdded_ = true;
var _local3 = getTimeBonusScore(board_.getTimeLeft(), board_.getTimeLimit());
addScore(_local3);
var _local2 = getCoverageBonusScore(board_.getPercentFilled(), board_.getPercentTarget());
addScore(_local2);
infoLayer_.attachMovie("roundbox", "box", infoLayer_.getNextHighestDepth());
infoLayer_.box._y = -infoLayer_.box._height;
infoLayer_.box.header.text = com.midasplayer.util.I18n.format("level_header");
infoLayer_.box.summary.text = com.midasplayer.util.I18n.format("summary");
infoLayer_.box.scoreh.text = com.midasplayer.util.I18n.format("score");
infoLayer_.box.score.text = (score_ - _local3) - _local2;
infoLayer_.box.coverage_bonush.text = com.midasplayer.util.I18n.format("coverage_bonus");
infoLayer_.box.coverage_bonus.text = _local2;
infoLayer_.box.time_bonush.text = com.midasplayer.util.I18n.format("time_bonus");
infoLayer_.box.time_bonus.text = _local3;
infoLayer_.box.total_scoreh.text = com.midasplayer.util.I18n.format("total_score");
infoLayer_.box.total_score.text = score_;
infoLayer_.box.start.text = com.midasplayer.util.I18n.format("next_level");
infoLayer_.box.start.autoSize = true;
var _local6 = infoLayer_.box.start._width;
var _local7 = infoLayer_.box.start._height;
var _local5 = infoLayer_.box.start._x + ((165 - _local6) / 2);
var _local4 = (infoLayer_.box.start._y + _local7) - 2;
infoLayer_.box.start._width = 165;
infoLayer_.box.start.autoSize = false;
infoLayer_.box.createEmptyMovieClip("line", infoLayer_.box.getNextHighestDepth());
infoLayer_.box.line.lineStyle(1, 13434828, 100);
infoLayer_.box.line.moveTo(_local5, _local4);
infoLayer_.box.line.lineTo(_local5 + _local6, _local4);
infoLayer_.box._x = 140;
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showRoundEndedAnim}], callback:endShowRoundEnded, callback_scope:this, tps:50});
}
function showRoundEndedAnim(tick, alpha) {
var _local2 = false;
var _local3 = com.midasplayer.util.AnimPlayer.tickToPercent(tick + alpha, 0, 90);
infoLayer_.box._y = ((-infoLayer_.box._height) + (infoLayer_.box._height * _local3)) - 1;
var _local5 = 11 - Math.round(10 * com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 500));
infoLayer_.box.in_secs.text = com.midasplayer.util.I18n.format("in_x_seconds", "" + _local5);
if (_local3 == 1) {
infoLayer_.box.onPress = function () {
this.clicked = true;
};
}
if (infoLayer_.box.clicked) {
_local2 = true;
}
if (tick > 500) {
_local2 = true;
}
return(_local2);
}
function endShowRoundEnded() {
infoLayer_.box.clicked = false;
roundNum_++;
startRound();
}
function gameOver() {
if (gameEnded_) {
return(undefined);
}
gameEnded_ = true;
showGameOver();
}
function showGameOver() {
com.midasplayer.fx.SoundManager.stop("itty loop#1");
com.midasplayer.fx.SoundManager.stop("count down#1");
com.midasplayer.fx.SoundManager.play("itty game over#1", 100);
var _local2 = 0;
if (board_.getPercentFilled() >= board_.getPercentTarget()) {
_local2 = getTimeBonusScore(board_.getTimeLeft(), board_.getTimeLimit());
if (!bonusAdded_) {
addScore(_local2);
}
}
var _local3 = getCoverageBonusScore(board_.getPercentFilled(), board_.getPercentTarget());
if (!bonusAdded_) {
addScore(_local3);
}
infoLayer_.attachMovie("roundbox", "box", infoLayer_.getNextHighestDepth());
infoLayer_.box._y = -infoLayer_.box._height;
infoLayer_.box.header.text = com.midasplayer.util.I18n.format("game_over");
infoLayer_.box.summary.text = com.midasplayer.util.I18n.format("summary");
infoLayer_.box.scoreh.text = com.midasplayer.util.I18n.format("score");
infoLayer_.box.score.text = (score_ - _local2) - _local3;
infoLayer_.box.coverage_bonush.text = com.midasplayer.util.I18n.format("coverage_bonus");
infoLayer_.box.coverage_bonus.text = _local3;
infoLayer_.box.time_bonush.text = com.midasplayer.util.I18n.format("time_bonus");
infoLayer_.box.time_bonus.text = _local2;
infoLayer_.box.total_scoreh.text = com.midasplayer.util.I18n.format("total_score");
infoLayer_.box.total_score.text = score_;
infoLayer_.box.start.text = com.midasplayer.util.I18n.format("end");
infoLayer_.box.start.autoSize = true;
var _local6 = infoLayer_.box.start._width;
var _local7 = infoLayer_.box.start._height;
var _local5 = infoLayer_.box.start._x + ((165 - _local6) / 2);
var _local4 = (infoLayer_.box.start._y + _local7) - 2;
infoLayer_.box.start._width = 165;
infoLayer_.box.start.autoSize = false;
infoLayer_.box.createEmptyMovieClip("line", infoLayer_.box.getNextHighestDepth());
infoLayer_.box.line.lineStyle(1, 13434828, 100);
infoLayer_.box.line.moveTo(_local5, _local4);
infoLayer_.box.line.lineTo(_local5 + _local6, _local4);
infoLayer_.box._x = 140;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showGameOverAnim}], callback:endShowGameOver, callback_scope:this, tps:50});
}
function showGameOverAnim(tick) {
var _local2 = false;
var _local3 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 60);
infoLayer_.box._y = ((-infoLayer_.box._height) + (infoLayer_.box._height * _local3)) - 1;
var _local5 = (7 - Math.round(7 * com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 350))) + 1;
infoLayer_.box.in_secs.text = com.midasplayer.util.I18n.format("in_x_seconds", "" + _local5);
if (_local3 == 1) {
com.midasplayer.util.AnimPlayer.end(alertTimeAnimId_);
infoLayer_.box.onPress = function () {
this.clicked = true;
};
}
if (infoLayer_.box.clicked) {
_local2 = true;
}
if (tick > 350) {
_local2 = true;
}
return(_local2);
}
function endShowGameOver() {
endGame();
}
static function endGame() {
com.midasplayer.util.GameBase.reportGameEnd(score_);
quitIntervalId_ = setInterval(quitGame, 1600);
}
static function quitGame() {
clearInterval(quitIntervalId_);
com.midasplayer.fx.SoundManager.stopAll();
com.midasplayer.util.GameBase.reportGameQuit();
}
static function getDrawingScore(area, totalArea_) {
var _local2 = (100 * area) / totalArea_;
var _local3 = 1;
var _local1 = Math.round((100 * _local2) * _local3);
return(_local1);
}
static function getSeparateWaspScore() {
var _local1 = 1000;
return(_local1);
}
static function getCatchFlyScore() {
var _local1 = 250;
return(_local1);
}
static function getCatchButterflyScore(col) {
var _local1 = 250;
if (col == 1) {
_local1 = 250;
}
return(_local1);
}
static function getTimeBonusScore(timeLeft, timeTotal) {
var _local1 = Math.round((500 * timeLeft) / timeTotal);
return(_local1);
}
static function getCoverageBonusScore(percentFilled, percentTarget) {
var _local2 = Math.max(percentFilled - percentTarget, 0);
var _local1 = Math.round(200 * _local2);
return(_local1);
}
function alertTime() {
com.midasplayer.fx.SoundManager.play("count down#1", 100, true);
alertTimeAnimId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:alertTimeAnim}], callback:endAlertTime, callback_scope:this, tps:50});
}
function alertTimeAnim(tick) {
var _local2 = false;
var _local3 = 10 * Math.abs((tick % 20) - 10);
_root.bar.timeleft._alpha = _local3;
return(_local2);
}
function endAlertTime() {
_root.bar.timeleft._alpha = 100;
}
static function reduceLife() {
livesLeft_--;
displayLivesLeft();
return(livesLeft_);
}
static function displayLivesLeft() {
var i = 1;
while (i <= livesLeft_) {
var m = eval ("_root.bar.life" + i);
m._visible = true;
i++;
}
var i = (livesLeft_ + 1);
while (i <= 3) {
var m = eval ("_root.bar.life" + i);
m._visible = false;
i++;
}
}
static function displayTimeLeft(time) {
if (time == undefined) {
time = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".time"));
}
if ((time != undefined) && (time != timeLeft_)) {
timeLeft_ = time;
var _local3 = Math.floor(time / 60);
var _local4 = time % 60;
if (_local3 < 10) {
_local3 = "0" + _local3;
}
if (_local4 < 10) {
_local4 = "0" + _local4;
}
_root.bar.timeleft.text = (_local3 + ":") + _local4;
if ((timeLeft_ <= 15) && (!timeLeftAlerted_)) {
timeLeftAlerted_ = true;
_root.game.alertTime();
}
}
}
static function displayPercentFilled() {
var _local2 = 0;
if (board_) {
_local2 = Math.floor(board_.getPercentFilled());
}
_root.bar.cleared.text = _local2 + "%";
displayPercentLeft();
}
static function displayPercentLeft() {
var _local2 = 0;
if (board_) {
_local2 = Math.floor(board_.getPercentFilled());
}
var _local3 = Number(com.midasplayer.util.GameBase.gameData.get(("level." + roundNum_) + ".clear"));
_root.bar.left.text = Math.max(_local3 - _local2, 0) + "%";
}
static function getScore() {
return(score_);
}
static function addScore(score) {
score_ = score_ + score;
displayScore();
}
static function displayScore() {
_root.bar.score.text = score_;
}
static var VERSION = "1.08";
}
Symbol 353 MovieClip [__Packages.com.midasplayer.timing.Timeable] Frame 0
interface com.midasplayer.timing.Timeable
{
}
Symbol 354 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Board] Frame 0
class com.midasplayer.game.itsybitsyspider.Board implements com.midasplayer.timing.Timeable
{
var clip_, seed_, level_, random_, encoder, stopped_, timeLimit_, dimmedLayer_, backgroundLayer_, stixLayer_, drawLayer_, insectLayer_, markerLayer_, monsterLayer_, points_, lines_, web_, outline_, totalArea_, clearTarget_, marker_, wasps_, beetles_, flies_, butterflies_, showAllMask_, timer_, timeLeft_, stix_, stixScore_, mouseDown_, xmouse_, ymouse_, mouseUp_, prevXmouse_, prevYmouse_;
function Board (level, clip, seed) {
clip_ = clip;
seed_ = seed;
level_ = level;
random_ = new com.midasplayer.util.Random(seed_);
encoder = new com.midasplayer.game.itsybitsyspider.Encoder();
stopped_ = true;
timeLimit_ = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".time"));
initLayers();
initWeb();
initInsects();
}
function initLayers() {
dimmedLayer_ = clip_.createEmptyMovieClip("dimmedlayer", clip_.getNextHighestDepth());
dimmedLayer_.attachMovie(("level" + level_) + "_fg", "fg", 1);
backgroundLayer_ = clip_.createEmptyMovieClip("background", clip_.getNextHighestDepth());
backgroundLayer_.attachMovie(("level" + level_) + "_bg", "bg", 1);
stixLayer_ = clip_.createEmptyMovieClip("stixlayer", clip_.getNextHighestDepth());
backgroundLayer_.setMask(stixLayer_);
drawLayer_ = clip_.createEmptyMovieClip("drawlayer", clip_.getNextHighestDepth());
insectLayer_ = clip_.createEmptyMovieClip("insectlayer", clip_.getNextHighestDepth());
insectLayer_._alpha = 0;
markerLayer_ = clip_.createEmptyMovieClip("markerlayer", clip_.getNextHighestDepth());
markerLayer_._alpha = 0;
monsterLayer_ = clip_.createEmptyMovieClip("monsterlayer", clip_.getNextHighestDepth());
monsterLayer_._alpha = 0;
}
function initWeb() {
points_ = new Array();
var _local2 = 0;
while (_local2 < BOARD_POINTS.length) {
points_[points_.length] = new com.midasplayer.game.itsybitsyspider.Point(BOARD_POINTS[_local2][0], BOARD_POINTS[_local2][1]);
_local2++;
}
lines_ = new Array();
_local2 = 0;
while (_local2 < points_.length) {
var _local10 = _local2;
var _local9 = (_local2 + 1) % points_.length;
var _local3 = (lines_[_local2] = new com.midasplayer.game.itsybitsyspider.Line(points_[_local10], points_[_local9]));
_local2++;
}
web_ = new com.midasplayer.game.itsybitsyspider.Web();
_local2 = 0;
while (_local2 < lines_.length) {
web_.addLine(lines_[_local2]);
_local2++;
}
_local2 = 0;
while (_local2 < points_.length) {
var _local4 = (_local2 + 1) % points_.length;
var _local6 = points_[_local4].x;
var _local5 = points_[_local4].y;
_local6 = _local6 + ((_local6 - 444.5) / 3);
_local5 = _local5 + ((_local5 - 250) / 3);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(_local6, _local5);
var _local3 = (lines_[lines_.length] = new com.midasplayer.game.itsybitsyspider.Line(points_[_local4], _local11));
drawLine(_local3);
_local2++;
}
outline_ = new Array();
var _local8 = null;
_local2 = 0;
while (_local2 < points_.length) {
var _local10 = _local2;
var _local9 = (_local2 + 1) % points_.length;
var _local3 = (outline_[_local2] = new com.midasplayer.game.itsybitsyspider.Line(points_[_local10], points_[_local9]));
_local8.setLineConnectingP2(_local3);
_local3.setLineConnectingP1(_local8);
_local3.setClosed(true);
_local8 = _local3;
_local2++;
}
outline_[outline_.length - 1].setLineConnectingP2(outline_[0]);
outline_[0].setLineConnectingP1(outline_[outline_.length - 1]);
var _local7 = Math.round(points_.length / 2) + 1;
stixLayer_.beginFill(16711935);
stixLayer_.moveTo(0, 0);
stixLayer_.lineTo(Stage.width, 0);
stixLayer_.lineTo(Stage.width, Stage.height);
_local2 = 0;
while (_local2 < _local7) {
stixLayer_.lineTo(points_[(_local7 - _local2) - 1].x, points_[(_local7 - _local2) - 1].y);
_local2++;
}
stixLayer_.lineTo(0, 0);
stixLayer_.endFill();
stixLayer_.beginFill(255);
stixLayer_.moveTo(0, 0);
stixLayer_.lineTo(points_[0].x, points_[0].y);
_local2 = points_.length - 1;
while (_local2 >= (_local7 - 1)) {
stixLayer_.lineTo(points_[_local2].x, points_[_local2].y);
_local2--;
}
stixLayer_.lineTo(Stage.width, Stage.height);
stixLayer_.lineTo(0, Stage.height);
stixLayer_.lineTo(0, 0);
stixLayer_.endFill();
_local2 = 0;
while (_local2 < lines_.length) {
drawLine(lines_[_local2]);
_local2++;
}
totalArea_ = 0;
_local2 = 0;
while (_local2 < outline_.length) {
totalArea_ = totalArea_ + ((outline_[_local2].p1.x * outline_[_local2].p2.y) - (outline_[_local2].p1.y * outline_[_local2].p2.x));
_local2++;
}
totalArea_ = Math.abs(totalArea_ / 2);
clearTarget_ = Number(com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".clear"));
com.midasplayer.game.itsybitsyspider.Game.displayPercentFilled();
}
function initInsects() {
marker_ = new com.midasplayer.game.itsybitsyspider.Marker(markerLayer_, outline_[12]);
wasps_ = new Array();
var _local6 = com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".wasps");
var _local2 = 0;
while (_local2 < _local6) {
wasps_[wasps_.length] = new com.midasplayer.game.itsybitsyspider.Wasp(monsterLayer_, random_.nextInt(1000000));
_local2++;
}
beetles_ = new Array();
var _local3 = com.midasplayer.util.GameBase.gameData.get(("level." + level_) + ".beetles");
_local2 = 0;
while (_local2 < _local3) {
beetles_[beetles_.length] = new com.midasplayer.game.itsybitsyspider.Beetle(monsterLayer_, _local2, web_, lines_, random_.nextInt(1000000));
_local2++;
}
flies_ = new Array();
var _local4 = 0 + random_.nextInt(2);
_local2 = 0;
while (_local2 < _local4) {
flies_[flies_.length] = new com.midasplayer.game.itsybitsyspider.Fly(insectLayer_, random_.nextInt(1000000));
_local2++;
}
butterflies_ = new Array();
var _local5 = 1 + random_.nextInt(2);
_local2 = 0;
while (_local2 < _local5) {
butterflies_[butterflies_.length] = new com.midasplayer.game.itsybitsyspider.Butterfly(insectLayer_, random_.nextInt(1000000));
_local2++;
}
}
function start() {
com.midasplayer.util.GameBase.reportPlayData(21, "", "0");
Mouse.addListener(this);
initTimer();
stopped_ = false;
showInsects();
}
function showInsects() {
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showInsectsAnim}], callback:endShowInsects, callback_scope:this, tps:50});
}
function showInsectsAnim(tick) {
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 25);
markerLayer_._alpha = _local2 * 100;
insectLayer_._alpha = _local2 * 100;
monsterLayer_._alpha = _local2 * 100;
return(_local2 == 1);
}
function endShowInsects() {
markerLayer_._alpha = 100;
insectLayer_._alpha = 100;
monsterLayer_._alpha = 100;
}
function endRound() {
com.midasplayer.fx.SoundManager.stop("itty loop#1");
com.midasplayer.fx.SoundManager.stop("count down#1");
com.midasplayer.fx.SoundManager.play("itty cleared#1", 100);
stop();
marker_.happy();
showAll();
}
function showAll() {
showAllMask_ = stixLayer_.createEmptyMovieClip("layer", stixLayer_.getNextHighestDepth());
showAllMask_.beginFill(16711680);
showAllMask_.moveTo(0, -520);
showAllMask_.lineTo(750, -520);
showAllMask_.lineTo(750, 0);
showAllMask_.lineTo(0, 0);
showAllMask_.lineTo(0, -520);
showAllMask_.endFill();
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showAllAnim}], callback:endShowAll, callback_scope:this, tps:50});
}
function showAllAnim(tick) {
var _local3 = false;
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 150);
showAllMask_._y = 520 * _local4;
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 50);
insectLayer_._alpha = 100 - (_local2 * 100);
monsterLayer_._alpha = 100 - (_local2 * 100);
drawLayer_._alpha = 100 - (_local2 * 100);
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 100, 50);
markerLayer_._alpha = 100 - (_local6 * 100);
if (_local4 == 1) {
_local3 = true;
}
return(_local3);
}
function endShowAll() {
_root.game.endRound();
}
function gameOver() {
stop();
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:gameOverAnim}], callback:endGameOver, callback_scope:this, tps:50});
}
function gameOverAnim(tick) {
var _local3 = false;
var _local2 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 10, 50);
insectLayer_._alpha = 100 - (_local2 * 100);
monsterLayer_._alpha = 100 - (_local2 * 100);
var _local4 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 10, 50);
markerLayer_._alpha = 100 - (_local4 * 100);
if (_local2 == 1) {
_local3 = true;
}
return(_local3);
}
function endGameOver() {
_root.game.gameOver();
}
function clear() {
dimmedLayer_.removeMovieClip();
backgroundLayer_.removeMovieClip();
stixLayer_.removeMovieClip();
drawLayer_.removeMovieClip();
insectLayer_.removeMovieClip();
monsterLayer_.removeMovieClip();
markerLayer_.removeMovieClip();
delete timer_;
var _local2 = 0;
while (_local2 < wasps_.length) {
wasps_[_local2].clear();
delete wasps_[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < beetles_.length) {
beetles_[_local2].clear();
delete beetles_[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < flies_.length) {
flies_[_local2].clear();
delete flies_[_local2];
_local2++;
}
_local2 = 0;
while (_local2 < butterflies_.length) {
butterflies_[_local2].clear();
delete butterflies_[_local2];
_local2++;
}
Mouse.removeListener(this);
marker_.clear();
web_.clear();
delete web_;
delete marker_;
}
function isStopped() {
return(stopped_);
}
function stop() {
stopped_ = true;
delete timer_;
var _local2 = 0;
while (_local2 < wasps_.length) {
wasps_[_local2].stop();
_local2++;
}
_local2 = 0;
while (_local2 < beetles_.length) {
beetles_[_local2].stop();
_local2++;
}
_local2 = 0;
while (_local2 < flies_.length) {
flies_[_local2].stop();
_local2++;
}
_local2 = 0;
while (_local2 < butterflies_.length) {
butterflies_[_local2].stop();
_local2++;
}
marker_.stop();
encoder.append(lastTick_ + 10);
encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.ROUND_END);
com.midasplayer.util.GameBase.reportPlayData(22, encoder.res, "0");
}
function initTimer() {
timer_ = new com.midasplayer.timing.Timer(this, TPS);
clip_.timer = timer_;
clip_.onEnterFrame = function () {
this.timer.advanceTime();
};
}
function getTimeLeft() {
return(timeLeft_);
}
function getTimeLimit() {
return(timeLimit_);
}
function getStix() {
return(stix_);
}
function getMarker() {
return(marker_);
}
function getWeb() {
return(web_);
}
function getWasps() {
return(wasps_);
}
function removeWasp(wasp) {
var _local2 = 0;
while (_local2 < 10) {
if (wasp == wasps_[_local2]) {
wasps_[_local2] = null;
var _local3 = com.midasplayer.game.itsybitsyspider.Game.getSeparateWaspScore();
com.midasplayer.game.itsybitsyspider.Game.addScore(_local3);
stixScore_ = stixScore_ + _local3;
return(undefined);
}
_local2++;
}
}
function getOutline() {
return(outline_);
}
function getLines() {
return(lines_);
}
function stixHit() {
marker_.setPoint(stix_.getStartPoint());
marker_.setLine(stix_.getStartLine());
marker_.killed();
stix_.hit();
stix_ = null;
com.midasplayer.fx.SoundManager.play("scream#2", 70);
var _local2 = com.midasplayer.game.itsybitsyspider.Game.reduceLife();
if (_local2 <= 0) {
gameOver();
}
}
function markerHit() {
if (marker_.isSafe()) {
return(undefined);
}
if (marker_.isDrawingLine()) {
stixHit();
} else {
if (stix_ != null) {
marker_.setPoint(stix_.getStartPoint());
marker_.setLine(stix_.getStartLine());
stix_.hit();
stix_ = null;
}
marker_.killed();
com.midasplayer.fx.SoundManager.play("scream#1", 70);
var _local2 = com.midasplayer.game.itsybitsyspider.Game.reduceLife();
if (_local2 <= 0) {
gameOver();
}
}
}
function insectTaken() {
com.midasplayer.fx.SoundManager.play("bonus bling#1", 80);
marker_.insectTaken();
}
function drawLine(line) {
var _local4 = line.getLength();
var _local5 = line.getRotation();
var _local3 = drawLayer_.attachMovie("dropline200", "d", drawLayer_.getNextHighestDepth());
_local3._x = line.p1.x;
_local3._y = line.p1.y;
_local3._xscale = (100 * _local4) / _local3._width;
_local3._rotation = _local5;
_local3 = drawLayer_.attachMovie("drop1", "d", drawLayer_.getNextHighestDepth());
_local3._x = line.p1.x;
_local3._y = line.p1.y;
}
function getPercentFilled() {
return((100 * filledArea_) / totalArea_);
}
function getPercentTarget() {
return(clearTarget_);
}
function closeStix() {
var _local5 = stix_.close();
var _local2 = (100 * _local5) / totalArea_;
if (_local2 > 30) {
com.midasplayer.fx.SoundManager.play("area drawn4#1", 60);
} else if (_local2 > 20) {
com.midasplayer.fx.SoundManager.play("area drawn3#1", 60);
} else if (_local2 > 5) {
com.midasplayer.fx.SoundManager.play("area drawn2#1", 60);
} else {
com.midasplayer.fx.SoundManager.play("area drawn1#1", 60);
}
var _local3 = com.midasplayer.game.itsybitsyspider.Game.getDrawingScore(_local5, totalArea_);
com.midasplayer.game.itsybitsyspider.Game.addScore(_local3);
stixScore_ = stixScore_ + _local3;
filledArea_ = filledArea_ + _local5;
com.midasplayer.game.itsybitsyspider.Game.displayPercentFilled();
var _local6 = stix_.getCenter();
addStixLines();
outline_ = stix_.getOutline();
stix_ = null;
_local2 = 0;
while (_local2 < flies_.length) {
var _local4 = flies_[_local2].checkInside();
if (_local4) {
_local3 = com.midasplayer.game.itsybitsyspider.Game.getCatchFlyScore();
com.midasplayer.game.itsybitsyspider.Game.addScore(_local3);
stixScore_ = stixScore_ + _local3;
}
_local2++;
}
_local2 = 0;
while (_local2 < butterflies_.length) {
var _local4 = butterflies_[_local2].checkInside();
if (_local4) {
_local3 = com.midasplayer.game.itsybitsyspider.Game.getCatchButterflyScore(butterflies_[_local2].getCol());
com.midasplayer.game.itsybitsyspider.Game.addScore(_local3);
stixScore_ = stixScore_ + _local3;
}
_local2++;
}
new com.midasplayer.game.itsybitsyspider.ScorePopup(stixScore_, _local6.x, _local6.y - 10);
if (getPercentFilled() >= clearTarget_) {
endRound();
}
}
function addStixLines() {
var _local6 = findLine(stix_.getStartLine());
var _local5 = findLine(stix_.getEndLine());
var _local7 = stix_.getStartPoint();
var _local8 = stix_.getEndPoint();
var _local3 = stix_.getLines();
web_.removeLine(_local6);
var _local9 = new com.midasplayer.game.itsybitsyspider.Line(_local6.p1.duplicate(), _local7.duplicate());
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local7.duplicate(), _local6.p2.duplicate());
web_.addLine(_local9);
web_.addLine(_local10);
web_.removeLine(_local5);
_local9 = new com.midasplayer.game.itsybitsyspider.Line(_local5.p1.duplicate(), _local8.duplicate());
_local10 = new com.midasplayer.game.itsybitsyspider.Line(_local8.duplicate(), _local5.p2.duplicate());
web_.addLine(_local9);
web_.addLine(_local10);
if (_local5 == _local6) {
_local9 = new com.midasplayer.game.itsybitsyspider.Line(_local7.duplicate(), _local8.duplicate());
web_.addLine(_local9);
}
var _local11 = _local9;
var _local2 = 0;
while (_local2 < _local3.length) {
var _local4 = new com.midasplayer.game.itsybitsyspider.Line(_local3[_local2].p1.duplicate(), _local3[_local2].p2.duplicate());
web_.addLine(_local4);
_local2++;
}
}
function findLine(stixLine) {
var _local5 = web_.getLinesStartingAtPoint(stixLine.p1);
var _local2 = 0;
while (_local2 < _local5.size()) {
var _local3 = _local5.get(_local2);
if (_local3.p2.equals(stixLine.p2)) {
return(_local3);
}
_local2++;
}
_local5 = web_.getLinesStartingAtPoint(stixLine.p2);
_local2 = 0;
while (_local2 < _local5.size()) {
var _local3 = _local5.get(_local2);
if (_local3.p2.equals(stixLine.p1)) {
return(_local3);
}
_local2++;
}
trace("ERROR - stixLine not found in web. Line: " + stixLine);
return(undefined);
}
function hitBoard(x, y, r) {
var _local10 = outline_.length;
var _local3 = 0;
while (_local3 < _local10) {
var _local2 = outline_[_local3];
var _local5 = _local2.midX - x;
var _local4 = _local2.midY - y;
var _local6 = ((_local5 * _local5) + (_local4 * _local4)) - _local2.radius;
if (_local6 < r) {
if (_local2.intersectsWithCircle(x, y, r)) {
return(true);
}
}
_local3++;
}
return(false);
}
function onMouseDown() {
var _local4 = Math.round(_root._xmouse);
var _local3 = Math.round(_root._ymouse);
if ((_local4 > 750) || (_local4 < 0)) {
return(undefined);
}
if ((_local3 > 500) || (_local3 < 0)) {
return(undefined);
}
mouseDown_ = true;
xmouse_ = _local4;
ymouse_ = _local3;
}
function onMouseUp() {
var _local4 = Math.round(_root._xmouse);
var _local3 = Math.round(_root._ymouse);
if ((_local4 > 750) || (_local4 < 0)) {
return(undefined);
}
if ((_local3 > 500) || (_local3 < 0)) {
return(undefined);
}
mouseUp_ = true;
xmouse_ = _local4;
ymouse_ = _local3;
}
function onMouseMove() {
if (mouseUp_ || (mouseDown_)) {
return(undefined);
}
var _local4 = Math.round(_root._xmouse);
var _local3 = Math.round(_root._ymouse);
if ((_local4 > 750) || (_local4 < 0)) {
return(undefined);
}
if ((_local3 > 500) || (_local3 < 0)) {
return(undefined);
}
xmouse_ = _local4;
ymouse_ = _local3;
}
function tick(tick) {
if (stopped_) {
return(undefined);
}
timeLeft_ = timeLimit_ - getTimePassed(tick);
com.midasplayer.game.itsybitsyspider.Game.displayTimeLeft(timeLeft_);
if (timeLeft_ <= 0) {
gameOver();
return(undefined);
}
if ((mouseDown_ && (!stix_)) && (marker_.isMoveable())) {
var _local6 = marker_.getLine();
marker_.setLine(null);
var _local5 = stixLayer_.createEmptyMovieClip("layer", stixLayer_.getNextHighestDepth());
var _local4 = drawLayer_.createEmptyMovieClip("drawlayer", drawLayer_.getNextHighestDepth());
stixScore_ = 0;
stix_ = new com.midasplayer.game.itsybitsyspider.Stix(_local5, _local4, marker_.getPoint(), _local6);
encoder.append(tick);
encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.NEW_STIX);
}
mouseDown_ = false;
if (stix_ && (!stix_.isClosed())) {
if ((xmouse_ != prevXmouse_) || (ymouse_ != prevYmouse_)) {
stix_.previewLineToPoint(xmouse_, ymouse_);
}
}
if ((mouseUp_ && (stix_)) && (!stix_.isClosed())) {
stix_.previewLineToPoint(xmouse_, ymouse_);
stix_.addLineToPoint(xmouse_, ymouse_, tick);
}
mouseUp_ = false;
marker_.tick(tick, xmouse_, ymouse_);
if (stopped_) {
return(undefined);
}
var _local2 = 0;
while (_local2 < wasps_.length) {
wasps_[_local2].tick(tick);
_local2++;
}
if (stopped_) {
return(undefined);
}
_local2 = 0;
while (_local2 < beetles_.length) {
beetles_[_local2].tick(tick);
_local2++;
}
if (stopped_) {
return(undefined);
}
_local2 = 0;
while (_local2 < flies_.length) {
flies_[_local2].tick(tick);
_local2++;
}
_local2 = 0;
while (_local2 < butterflies_.length) {
butterflies_[_local2].tick(tick);
_local2++;
}
prevXmouse_ = xmouse_;
prevYmouse_ = ymouse_;
if (encoder.res.length > 256) {
com.midasplayer.util.GameBase.reportPlayData(22, encoder.res, "0");
encoder = new com.midasplayer.game.itsybitsyspider.Encoder();
}
lastTick_ = tick;
}
function getTimePassed(tick) {
return(Math.round(tick / TPS));
}
function render(tick, alpha) {
if (stopped_) {
return(undefined);
}
marker_.render(tick, alpha);
var _local2 = 0;
while (_local2 < wasps_.length) {
wasps_[_local2].render(tick, alpha);
_local2++;
}
_local2 = 0;
while (_local2 < beetles_.length) {
beetles_[_local2].render(tick, alpha);
_local2++;
}
_local2 = 0;
while (_local2 < flies_.length) {
flies_[_local2].render(tick, alpha);
_local2++;
}
_local2 = 0;
while (_local2 < butterflies_.length) {
butterflies_[_local2].render(tick, alpha);
_local2++;
}
}
static var TPS = 25;
var BOARD_POINTS = [[306, 27], [464, 20], [592, 38], [672, 70], [713, 131], [730, 262], [709, 364], [677, 430], [579, 468], [455, 480], [335, 461], [246, 437], [200, 362], [177, 237], [188, 129], [214, 64]];
var lastTick_ = 0;
var filledArea_ = 0;
}
Symbol 355 MovieClip [__Packages.com.midasplayer.timing.Timer] Frame 0
class com.midasplayer.timing.Timer
{
var gameTicksPerSecond, timeable;
function Timer (timeable, gameTicksPerSecond) {
this.gameTicksPerSecond = gameTicksPerSecond;
millisPerGameTick = 1000 / gameTicksPerSecond;
this.timeable = timeable;
}
function advanceTime() {
time = getTimer();
var _local3 = time - lastTime;
lastTime = time;
unprocessedTime = unprocessedTime + _local3;
var _local2 = 0;
while (unprocessedTime > millisPerGameTick) {
unprocessedTime = unprocessedTime - millisPerGameTick;
timeable.tick(tick);
tick++;
if ((tick % gameTicksPerSecond) == 0) {
fps = frames;
frames = 0;
}
_local2++;
if (_local2 >= 10) {
unprocessedTime = 0;
}
}
var _local4 = unprocessedTime / millisPerGameTick;
timeable.render(tick, _local4);
frames++;
}
var time = 0;
var lastTime = 0;
var unprocessedTime = 0;
var tick = 0;
var millisPerGameTick = 0;
var fps = 0;
var frames = 0;
}
Symbol 356 MovieClip [__Packages.com.midasplayer.util.Random] Frame 0
class com.midasplayer.util.Random
{
var mta, mti, lastSeed;
function Random (aSeed) {
mta = new Array(N);
mti = N + 1;
if (aSeed != undefined) {
init_genrand(aSeed);
}
}
function set seed(s) {
init_genrand(s);
//return(seed);
}
function get seed() {
return(lastSeed);
}
function nextInt(n) {
return((genrand_int32() & 2147483647) % n);
}
function nextFloat() {
return(next(24) / 16777216);
}
function next(bits) {
if (bits < 32) {
return(genrand_int32() & ((1 << bits) - 1));
}
return(genrand_int32());
}
function init_genrand(s) {
var _local5 = getTimer();
lastSeed = s;
mta[0] = s;
var _local2 = s;
var _local3 = new com.midasplayer.util.Integer64();
mti = 1;
while (mti < N) {
_local3.init32((_local2 >>> 30) ^ _local2);
_local3.mulu32(1812433253);
_local2 = (mta[mti] = _local3.lsb + mti);
mti++;
}
var _local6 = getTimer();
}
function genrand_int32() {
var _local3 = 0;
if (mti >= N) {
if (mti == (N + 1)) {
init_genrand(5489);
}
var _local2 = 0;
_local2 = 0;
while (_local2 < (N - M)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + M] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
while (_local2 < (N - 1)) {
_local3 = (mta[_local2] & UPPER_MASK) | (mta[_local2 + 1] & LOWER_MASK);
mta[_local2] = (mta[_local2 + (M - N)] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
_local2++;
}
_local3 = (mta[N - 1] & UPPER_MASK) | (mta[0] & LOWER_MASK);
mta[N - 1] = (mta[M - 1] ^ (_local3 >>> 1)) ^ mag01[_local3 & 1];
mti = 0;
}
_local3 = mta[mti++];
_local3 = _local3 ^ (_local3 >>> 11);
_local3 = _local3 ^ ((_local3 << 7) & 2636928640);
_local3 = _local3 ^ ((_local3 << 15) & 4022730752);
_local3 = _local3 ^ (_local3 >>> 18);
return(_local3);
}
static var N = 624;
static var M = 397;
static var MATRIX_A = 2567483615;
static var UPPER_MASK = 2147483648;
static var LOWER_MASK = 2147483647;
static var mag01 = [0, 2567483615];
}
Symbol 357 MovieClip [__Packages.com.midasplayer.util.Integer64] Frame 0
class com.midasplayer.util.Integer64
{
var r, p, s;
function Integer64 (lowInt) {
r = [[0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0], [0, 0, 0, 0, 0]];
p = [0, 0, 0, 0, 0];
s = [0, 0, 0];
if (lowInt != undefined) {
merge(lowInt);
}
}
function init(v) {
var _local2 = 0;
while (_local2 < p.length) {
p[_local2] = v.p[_local2];
_local2++;
}
}
function init32(n) {
p[0] = n & 32767;
n = n >>> 15;
p[1] = n & 32767;
n = n >>> 15;
p[2] = n & 3;
p[3] = 0;
p[4] = 0;
}
function get lsb() {
return((p[0] | (p[1] << SH)) | ((p[2] & 3) << 30));
}
function get msb() {
return((((p[2] >> 2) | ((p[3] << SH) >> 2)) | ((p[4] << (SH * 2)) >> 2)) & 2147483647);
}
function binaryShiftLeft(step) {
var _local2 = 0;
while (_local2 < step) {
shl();
_local2++;
}
}
function binaryShiftRight(step) {
var _local4 = (step / SH) >> 0;
var _local5 = step - (_local4 * SH);
var _local2 = p.length - 1;
while (_local2 > 0) {
var _local3 = 0;
while (_local3 < _local4) {
p[_local3] = p[_local3 + 1];
_local3++;
}
p[_local2--] = 0;
}
if (_local5 > 0) {
var _local3 = 0;
while (_local3 < _local5) {
shr();
_local3++;
}
}
}
function binaryNot(o) {
p[0] = p[0] ^ o.p[0];
p[1] = p[1] ^ o.p[1];
p[2] = p[2] ^ o.p[2];
p[3] = p[3] ^ o.p[3];
p[4] = p[4] ^ o.p[4];
}
function add64(o) {
var _local4 = 0;
var _local3 = 1;
var _local2 = 0;
while ((_local3 < p.length) && (o.p[_local2] != 0)) {
_local3++;
}
_local2 = 0;
while (_local2 < _local3) {
_local4 = _local4 + (p[_local2] + o.p[_local2]);
p[_local2] = _local4 & MASK;
_local4 = _local4 >> SH;
_local2++;
}
}
function add32(num) {
var _local2 = 0;
var _local5 = num & MASK;
num = num >> SH;
var _local6 = num & MASK;
num = num >> SH;
var _local4 = num & 3;
_local2 = _local2 + (p[0] + _local5);
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[1] + _local6);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (p[2] + _local4);
p[2] = _local2 & MASK;
}
function mulu32(num) {
var _local3 = 0;
s[0] = num & MASK;
num = num >>> 15;
s[1] = num & MASK;
num = num >>> 15;
s[2] = num & 3;
var _local2 = 0;
while (_local2 < 3) {
var _local4 = s[_local2];
_local3 = _local4 * p[0];
r[_local2][0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[1]);
r[_local2][1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (_local4 * p[2]);
r[_local2][2] = _local3 & 3;
_local2++;
}
_local3 = r[0][0];
p[0] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + (r[0][1] + r[1][0]);
p[1] = _local3 & MASK;
_local3 = _local3 >> SH;
_local3 = _local3 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local3 & 3;
p[3] = 0;
p[4] = 0;
}
function mul64(o) {
var _local2 = 0;
var _local3 = 0;
while (_local3 < 5) {
var _local4 = o.p[_local3];
_local2 = _local4 * p[0];
r[_local3][0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[1]);
r[_local3][1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[2]);
r[_local3][2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[3]);
r[_local3][3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (_local4 * p[4]);
r[_local3][4] = _local2 & MASK;
_local3++;
}
_local2 = r[0][0];
p[0] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (r[0][1] + r[1][0]);
p[1] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((r[0][2] + r[1][1]) + r[2][0]);
p[2] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + (((r[0][3] + r[1][2]) + r[2][1]) + r[3][0]);
p[3] = _local2 & MASK;
_local2 = _local2 >> SH;
_local2 = _local2 + ((((r[0][4] + r[1][3]) + r[2][2]) + r[3][1]) + r[4][0]);
p[4] = _local2 & 7;
}
function mul32(value) {
mul64(new com.midasplayer.util.Integer64(value));
}
function toString() {
return(((((("Integer64[value=0x" + com.midasplayer.util.Numbers.dec2hex(msb)) + ":") + com.midasplayer.util.Numbers.dec2hex(lsb)) + ":(") + p) + ")]");
}
function merge(a) {
var _local2 = 0;
while (_local2 < 3) {
p[_local2] = p[_local2] + (a & 32767);
a = a >>> 15;
_local2++;
}
return(a);
}
function shl() {
var _local5 = 0;
var _local4 = 0;
var _local2 = 0;
var _local3 = p.length;
while (_local2 < _local3) {
_local5 = (p[_local2] & 16384) >> 14;
p[_local2] = p[_local2] << 1;
p[_local2] = (p[_local2] | _local4) & 32767;
_local2++;
_local4 = _local5;
}
}
function shr() {
var _local4 = 0;
var _local3 = 0;
var _local2 = p.length - 1;
while (_local2 >= 0) {
_local4 = (p[_local2] & 1) << 14;
p[_local2] = p[_local2] >> 1;
p[_local2] = (p[_local2] | _local3) & 32767;
_local2--;
_local3 = _local4;
}
}
static var MASK = 32767;
static var SH = 15;
}
Symbol 358 MovieClip [__Packages.com.midasplayer.util.Numbers] Frame 0
class com.midasplayer.util.Numbers
{
function Numbers () {
}
static function dec2hex(iValue, padding) {
var _local1 = "";
while (iValue != 0) {
_local1 = "0123456789abcdef".charAt(iValue & 15) + _local1;
iValue = iValue >>> 4;
}
if (padding) {
if (_local1.length == 0) {
_local1 = "00";
}
if (_local1.length < 2) {
_local1 = "0" + _local1;
}
} else if (_local1.length == 0) {
_local1 = "0";
}
return(_local1);
}
static function itoa(value, numZeroPadding) {
var _local2 = "" + value;
if (numZeroPadding) {
var _local1 = numZeroPadding - 1;
while (_local1 > 0) {
if (value < Math.pow(10, _local1)) {
_local2 = "0" + _local2;
}
_local1--;
}
}
return(_local2);
}
static function asTime(millis, alwaysHours, alwaysMinutes) {
if (alwaysHours) {
alwaysMinutes = true;
}
if (millis < 0) {
millis = 0;
}
millis = millis / 1000;
millis = Math.floor(millis);
var _local3 = Math.floor(millis / 3600);
var _local4 = Math.floor(millis / 60) % 60;
var _local5 = millis % 60;
var _local1 = "";
if (alwaysHours || (_local3 > 0)) {
_local1 = _local1 + itoa(_local3, 2);
}
if (alwaysHours || (_local1.length > 0)) {
_local1 = _local1 + ":";
}
var _local6 = _local1.length;
if ((alwaysMinutes || (_local4 > 0)) || (_local3 > 0)) {
_local1 = _local1 + itoa(_local4, 2);
}
if (alwaysMinutes || (_local1.length != _local6)) {
_local1 = _local1 + ":";
}
return(_local1 + itoa(_local5, 2));
}
}
Symbol 359 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Web] Frame 0
class com.midasplayer.game.itsybitsyspider.Web
{
var startingLines_, endingLines_;
function Web () {
startingLines_ = new com.midasplayer.util.Map();
endingLines_ = new com.midasplayer.util.Map();
}
function clear() {
delete startingLines_;
delete endingLines_;
}
function addLine(line) {
if (line == null) {
trace("adding null line!!");
}
if (line == undefined) {
trace("adding undefined line!!");
}
var _local5 = getKey(line.p1);
var _local4 = getKey(line.p2);
var _local2 = startingLines_.get(_local5);
if (_local2 == undefined) {
_local2 = new com.midasplayer.util.ArrayList();
}
_local2.insert(line);
startingLines_.put(_local5, _local2);
_local2 = endingLines_.get(_local4);
if (_local2 == undefined) {
_local2 = new com.midasplayer.util.ArrayList();
}
_local2.insert(line);
endingLines_.put(_local4, _local2);
}
function removeLine(line) {
var _local5 = getKey(line.p1);
var _local3 = getLinesStartingAtPoint(line.p1);
var _local2 = 0;
while (_local2 < _local3.size()) {
if (_local3.get(_local2).equals(line)) {
_local3.removeByIndex(_local2);
break;
}
_local2++;
}
startingLines_.put(_local5, _local3);
_local5 = getKey(line.p2);
_local3 = getLinesEndingAtPoint(line.p2);
_local2 = 0;
while (_local2 < _local3.size()) {
if (_local3.get(_local2).equals(line)) {
_local3.removeByIndex(_local2);
break;
}
_local2++;
}
endingLines_.put(_local5, _local3);
}
function getLinesStartingAtPoint(point) {
var _local2 = getKey(point);
return(com.midasplayer.util.ArrayList(startingLines_.get(_local2)));
}
function getLinesEndingAtPoint(point) {
var _local2 = getKey(point);
return(com.midasplayer.util.ArrayList(endingLines_.get(_local2)));
}
function getKey(point) {
return((Math.round(point.x) * 1000) + Math.round(point.y));
}
}
Symbol 360 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Line] Frame 0
class com.midasplayer.game.itsybitsyspider.Line
{
var p1, p2, closed_, minX, maxX, minY, maxY, midX, midY, dx, dy, radius, connectingLine1_, connectingLine2_;
function Line (p1, p2) {
this.p1 = p1;
this.p2 = p2;
updateMinMaxPoints();
closed_ = false;
}
function updateMinMaxPoints() {
minX = Math.min(p1.x, p2.x);
maxX = Math.max(p1.x, p2.x);
minY = Math.min(p1.y, p2.y);
maxY = Math.max(p1.y, p2.y);
midX = minX + ((maxX - minX) / 2);
midY = minY + ((maxY - minY) / 2);
dx = p2.x - p1.x;
dy = p2.y - p1.y;
radius = (dx * dx) + (dy * dy);
}
function setClosed(b) {
closed_ = b;
}
function isClosed() {
return(closed_);
}
function setLineConnectingP1(line) {
connectingLine1_ = line;
}
function setLineConnectingP2(line) {
connectingLine2_ = line;
}
function getLineConnectingP1() {
return(connectingLine1_);
}
function getLineConnectingP2() {
return(connectingLine2_);
}
function getLength() {
dx = p2.x - p1.x;
dy = p2.y - p1.y;
return(Math.sqrt((dx * dx) + (dy * dy)));
}
function getRotation() {
dx = p2.x - p1.x;
dy = p2.y - p1.y;
return((180 * Math.atan2(dy, dx)) / Math.PI);
}
function getIntersectionPoint(line) {
if ((((maxX < line.minX) || (line.maxX < minX)) || (maxY < line.minY)) || (line.maxY < minY)) {
return(null);
}
var _local11 = ((line.p2.x - line.p1.x) * (p1.y - line.p1.y)) - ((line.p2.y - line.p1.y) * (p1.x - line.p1.x));
var _local9 = ((p2.x - p1.x) * (p1.y - line.p1.y)) - ((p2.y - p1.y) * (p1.x - line.p1.x));
var _local4 = ((line.p2.y - line.p1.y) * (p2.x - p1.x)) - ((line.p2.x - line.p1.x) * (p2.y - p1.y));
var _local8;
var _local7;
if (_local4 != 0) {
var _local3 = _local11 / _local4;
var _local10 = _local9 / _local4;
if ((((0 <= _local3) && (_local3 <= 1)) && (0 <= _local10)) && (_local10 <= 1)) {
_local8 = p1.x + (_local3 * (p2.x - p1.x));
_local7 = p1.y + (_local3 * (p2.y - p1.y));
// unexpected jump
}
return(null);
}
if ((_local11 == 0) || (_local9 == 0)) {
return(null);
}
return(null);
var _local6 = p1.x - _local8;
var _local5 = p1.y - _local7;
var _local12 = (_local6 * _local6) + (_local5 * _local5);
if (_local12 < 0.0001) {
return(null);
}
return(new com.midasplayer.game.itsybitsyspider.Point(_local8, _local7));
}
function intersect(line) {
var _local2 = getIntersectionPoint(line);
if (_local2) {
p2.x = _local2.x;
p2.y = _local2.y;
return(true);
}
return(false);
}
function angleTo(line) {
var _local6 = (dx * line.dx) + (dy * line.dy);
var _local4 = (dx * dx) + (dy * dy);
var _local3 = (line.dx * line.dx) + (line.dy * line.dy);
var _local7 = _local6 / Math.sqrt(_local4 * _local3);
var _local5 = (180 * Math.acos(_local7)) / Math.PI;
return(_local5);
}
function intersectsWithCircle(x, y, r) {
var _local6 = x - p1.x;
var _local5 = y - p1.y;
var _local2 = ((dx * _local6) + (dy * _local5)) / ((dx * dx) + (dy * dy));
if (_local2 < 0) {
_local2 = 0;
}
if (_local2 > 1) {
_local2 = 1;
}
var _local4 = x - (p1.x + (_local2 * dx));
var _local3 = y - (p1.y + (_local2 * dy));
var _local7 = (_local4 * _local4) + (_local3 * _local3);
return(_local7 < (r * r));
}
function toString() {
return((p1 + "->") + p2);
}
function equals(line) {
return((p1.equals(line.p1) && (p2.equals(line.p2))) || (p2.equals(line.p2) && (p1.equals(line.p2))));
}
static function numIntersections(line, lines) {
var _local4 = 0;
var _local1 = 0;
while (_local1 < lines.length) {
var _local2 = line.getIntersectionPoint(lines[_local1]);
if (_local2 && (!_local2.equals(lines[_local1].p2))) {
_local4++;
}
_local1++;
}
return(_local4);
}
static function isOutside(x, y, lines) {
var _local4 = new com.midasplayer.game.itsybitsyspider.Point(x, y);
var _local3 = new com.midasplayer.game.itsybitsyspider.Point(x + 1000, y);
var _local1 = new com.midasplayer.game.itsybitsyspider.Line(_local4, _local3);
var _local2 = numIntersections(_local1, lines);
if ((_local2 % 2) == 0) {
return(true);
}
return(false);
}
static function getArea(ls) {
var _local3 = 0;
var _local1 = 0;
while (_local1 < ls.length) {
_local3 = _local3 + ((ls[_local1].p1.x * ls[_local1].p2.y) - (ls[_local1].p1.y * ls[_local1].p2.x));
_local1++;
}
_local3 = Math.abs(_local3 / 2);
return(_local3);
}
static function isClockwiseOrder(ls) {
var _local3 = 0;
var _local1 = 0;
while (_local1 < ls.length) {
_local3 = _local3 + ((ls[_local1].p1.x * ls[_local1].p2.y) - (ls[_local1].p1.y * ls[_local1].p2.x));
_local1++;
}
return(_local3 < 0);
}
static function getCenter(ls, area) {
var _local5 = 0;
var _local4 = 0;
var _local1 = 0;
while (_local1 < ls.length) {
var _local3 = (ls[_local1].p1.x * ls[_local1].p2.y) - (ls[_local1].p2.x * ls[_local1].p1.y);
_local5 = _local5 + ((ls[_local1].p1.x + ls[_local1].p2.x) * _local3);
_local4 = _local4 + ((ls[_local1].p1.y + ls[_local1].p2.y) * _local3);
_local1++;
}
_local5 = Math.abs(_local5 / (6 * area));
_local4 = Math.abs(_local4 / (6 * area));
return(new com.midasplayer.game.itsybitsyspider.Point(_local5, _local4));
}
}
Symbol 361 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Point] Frame 0
class com.midasplayer.game.itsybitsyspider.Point
{
var x, y;
function Point (x, y) {
this.x = x;
this.y = y;
}
function duplicate() {
var _local2 = new com.midasplayer.game.itsybitsyspider.Point();
_local2.x = x;
_local2.y = y;
return(_local2);
}
function toString() {
return(((("(" + x) + ",") + y) + ")");
}
function equals(point) {
return((x == point.x) && (y == point.y));
}
function distanceTo(point) {
var _local3 = point.x - x;
var _local2 = point.y - y;
var _local4 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
return(_local4);
}
}
Symbol 362 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Marker] Frame 0
class com.midasplayer.game.itsybitsyspider.Marker
{
var line_, moveable_, x_, y_, point_, speed_, clip_, clip2_, clip3_, animId_, stopped_, safe_, isDrawingLine_, killedAtTick_, lastTick_, line2_;
function Marker (clip, line) {
line_ = line;
moveable_ = true;
var _local5 = line.p1.x + ((line.p2.x - line.p1.x) / 2);
var _local4 = line.p1.y + ((line.p2.y - line.p1.y) / 2);
x_ = new com.midasplayer.timing.IFloat();
y_ = new com.midasplayer.timing.IFloat();
x_.set(_local5);
x_.set(_local5);
y_.set(_local4);
y_.set(_local4);
point_ = new com.midasplayer.game.itsybitsyspider.Point(_local5, _local4);
speed_ = SPEED;
clip_ = clip.attachMovie("spider_walk", "marker", clip.getNextHighestDepth());
clip2_ = clip.attachMovie("spider_web", "marker", clip.getNextHighestDepth());
clip2_._visible = false;
clip3_ = clip.attachMovie("spider_caught", "marker", clip.getNextHighestDepth());
clip3_._visible = false;
clip_._x = getX();
clip_._y = getY();
clip_.gotoAndStop(frame_);
clip2_._x = clip_._x;
clip2_._y = clip_._y;
clip2_.gotoAndStop(frame_);
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:walkAnim}], callback:endWalk, callback_scope:this, tps:18});
}
function clear() {
com.midasplayer.util.AnimPlayer.end(animId_);
clip_.removeMovieClip();
clip2_.removeMovieClip();
clip3_.removeMovieClip();
}
function isMoveable() {
return(moveable_);
}
function happy() {
clip_._visible = true;
clip2_._visible = false;
moveable_ = false;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:happyAnim}], callback:endHappy, callback_scope:this, tps:40});
}
function insectTaken() {
speed_ = speed_ + 0.5;
}
function happyAnim(tick) {
var _local4 = false;
if (tick > 120) {
tick = 120;
}
var _local2 = tick % 30;
var _local3 = 15;
_local2 = _local2 - _local3;
_local2 = (_local3 * _local3) - (_local2 * _local2);
var _local6 = (20 * _local2) / (_local3 * _local3);
clip_._y = getY() - _local6;
if (tick == 120) {
_local4 = true;
}
clip_.gotoAndStop(33);
return(_local4);
}
function endHappy() {
}
function stop() {
stopped_ = true;
}
function walkAnim(tick) {
if (stopped_) {
return(undefined);
}
if (safe_) {
return(undefined);
}
if (isDrawingLine_ || (lastSpeed_ != 0)) {
frame_ = (tick % 32) + 1;
} else if (frame_ > 1) {
frame_ = (tick % 3) + 1;
}
if (isDrawingLine_) {
clip2_.gotoAndStop(frame_);
clip2_._visible = true;
clip_._visible = false;
} else {
clip_.gotoAndStop(frame_);
clip_._visible = true;
clip2_._visible = false;
}
return(false);
}
function endWalk() {
}
function getPoint() {
point_.x = getX();
point_.y = getY();
return(point_);
}
function getX() {
return(x_.get(1));
}
function getY() {
return(y_.get(1));
}
function getLine() {
return(line_);
}
function isDrawingLine() {
return((line_ != null) && (!line_.isClosed()));
}
function isSafe() {
return(safe_);
}
function killed() {
killedAtTick_ = lastTick_;
safe_ = true;
moveable_ = false;
clip_._x = getX();
clip_._y = getY();
clip2_._x = clip_._x;
clip2_._y = clip_._y;
clip3_._x = clip_._x;
clip3_._y = clip_._y;
clip_._visible = false;
clip2_._visible = false;
clip3_._visible = true;
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:killedAnim}], callback:endKilled, callback_scope:this, tps:14});
}
function killedAnim(tick) {
if (stopped_) {
return(undefined);
}
var _local3 = false;
frame_ = (tick % 12) + 1;
if (tick > 12) {
frame_ = 12;
}
clip3_._x = getX();
clip3_._y = getY();
clip3_.gotoAndStop(frame_);
if (tick > 24) {
clip3_._visible = false;
clip_._visible = true;
}
clip_._alpha = 100 * (tick % 2);
if (tick > 50) {
_local3 = true;
}
return(_local3);
}
function endKilled() {
clip_._alpha = 100;
clip_._visible = true;
clip3_._visible = false;
}
function setPoint(point) {
x_.set(point.x);
x_.set(point.x);
y_.set(point.y);
y_.set(point.y);
}
function setLine(line) {
line_ = line;
}
function getSpeed() {
if (isDrawingLine_) {
return(speed_ / 2.5);
}
return(speed_);
}
function getDirection(line, xm, ym) {
if (isDrawingLine_) {
return(1);
}
if (!line) {
return(0);
}
var _local3 = line.p2.x - line.p1.x;
var _local2 = line.p2.y - line.p1.y;
var _local8 = Math.sqrt((_local3 * _local3) + (_local2 * _local2));
_local3 = _local3 / _local8;
_local2 = _local2 / _local8;
var _local10 = xm - getX();
var _local9 = ym - getY();
var _local4 = (_local10 * _local3) + (_local9 * _local2);
var _local7 = _local4 * _local3;
var _local6 = _local4 * _local2;
var _local11 = (_local7 * _local7) + (_local6 * _local6);
if (_local11 < (speed_ * speed_)) {
_local4 = 0;
}
return(_local4);
}
function tick(tick, xm, ym) {
lastTick_ = tick;
if ((killedAtTick_ + 50) <= tick) {
moveable_ = true;
}
if ((killedAtTick_ + 100) <= tick) {
safe_ = false;
}
if (!moveable_) {
return(undefined);
}
isDrawingLine_ = line_ && (!line_.isClosed());
var _local3 = getSpeed();
var _local2 = getDirection(line_, xm, ym);
if (!isDrawingLine_) {
if (point_.equals(line_.p1)) {
line2_ = line_.getLineConnectingP1();
var _local8 = getDirection(line2_, xm, ym);
if (_local8 < 0) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.MARKER_SWAP_LINE);
line_ = line2_;
_local2 = _local8;
}
} else if (point_.equals(line_.p2)) {
line2_ = line_.getLineConnectingP2();
var _local8 = getDirection(line2_, xm, ym);
if (_local8 > 0) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.MARKER_SWAP_LINE);
line_ = line2_;
_local2 = _local8;
}
}
}
if (_local2 > 0) {
var _local7 = line_.p2.x - getX();
var _local6 = line_.p2.y - getY();
var _local5 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
if (_local5 == 0) {
}
if (lastSpeed_ <= 0) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.MARKER_DIRECTION_P2);
}
if (_local5 > _local3) {
x_.set(getX() + ((_local3 * _local7) / _local5));
y_.set(getY() + ((_local3 * _local6) / _local5));
} else {
setPoint(line_.p2);
if (isDrawingLine_) {
if (line_.getLineConnectingP2()) {
line_ = line_.getLineConnectingP2();
if (line_.isClosed()) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().closeStix();
}
}
}
}
} else if (_local2 < 0) {
var _local7 = line_.p1.x - getX();
var _local6 = line_.p1.y - getY();
var _local5 = Math.sqrt((_local7 * _local7) + (_local6 * _local6));
if (_local5 == 0) {
}
if (lastSpeed_ >= 0) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.MARKER_DIRECTION_P1);
}
if (_local5 > _local3) {
x_.set(getX() + ((_local3 * _local7) / _local5));
y_.set(getY() + ((_local3 * _local6) / _local5));
} else {
setPoint(line_.p1);
}
} else {
_local2 = 0;
if (lastSpeed_ != 0) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.MARKER_DIRECTION_NONE);
}
x_.set(getX());
y_.set(getY());
}
lastSpeed_ = _local2;
}
function render(tick, alpha) {
clip_._x = getX(alpha);
clip_._y = getY(alpha);
clip2_._x = clip_._x;
clip2_._y = clip_._y;
}
var SPEED = 240 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var frame_ = 1;
var lastSpeed_ = 0;
}
Symbol 363 MovieClip [__Packages.com.midasplayer.timing.IFloat] Frame 0
class com.midasplayer.timing.IFloat
{
function IFloat () {
}
function set(newValue) {
lastValue = value;
value = newValue;
}
function get(alpha) {
return(lastValue + ((value - lastValue) * alpha));
}
var value = 0;
var lastValue = 0;
}
Symbol 364 MovieClip [__Packages.com.midasplayer.util.AnimPlayer] Frame 0
class com.midasplayer.util.AnimPlayer
{
static var clip_;
function AnimPlayer () {
}
static function staticInitializer(Void) {
clip_ = _root.createEmptyMovieClip("timer", _root.getNextHighestDepth());
clip_.onEnterFrame = function () {
com.midasplayer.util.AnimPlayer.onEnterFrame();
};
return(true);
}
static function play(props) {
animId_++;
var _local3 = props.playlist;
var _local4 = props.callback;
var _local5 = props.callback_scope;
var _local1 = props.tps;
if (_local1 == undefined) {
_local1 = 100;
}
callbacks_.put(animId_, _local4);
callbackScopes_.put(animId_, _local5);
animEntries_.put(animId_, new com.midasplayer.util.AnimEntry(_local3, animId_));
timers_.put(animId_, new com.midasplayer.timing.Timer(com.midasplayer.util.AnimEntry(animEntries_.get(animId_)), _local1));
return(animId_);
}
static function end(animId) {
delete eval (timers_.get(animId));
timers_.remove(animId);
delete eval (animEntries_.get(animId));
animEntries_.remove(animId);
var _local2 = callbacks_.get(animId);
callbacks_.remove(animId);
var _local3 = callbackScopes_.get(animId);
callbackScopes_.remove(animId);
_local2.call(_local3);
}
static function stop(animId) {
delete eval (timers_.get(animId));
timers_.remove(animId);
delete eval (animEntries_.get(animId));
animEntries_.remove(animId);
var _local2 = callbacks_.get(animId);
callbacks_.remove(animId);
var _local3 = callbackScopes_.get(animId);
callbackScopes_.remove(animId);
}
static function tickToPercent(tick, startTick, numTicks) {
var _local1 = (tick - startTick) / numTicks;
_local1 = ((_local1 < 0) ? 0 : (_local1));
_local1 = ((_local1 > 1) ? 1 : (_local1));
return(_local1);
}
static function onEnterFrame() {
timers_.foreach(function (key, obj) {
com.midasplayer.timing.Timer(obj).advanceTime();
});
}
static var animId_ = 0;
static var animEntries_ = new com.midasplayer.util.Map();
static var timers_ = new com.midasplayer.util.Map();
static var callbacks_ = new com.midasplayer.util.Map();
static var callbackScopes_ = new com.midasplayer.util.Map();
static var staticInitialized = staticInitializer();
}
Symbol 365 MovieClip [__Packages.com.midasplayer.util.AnimEntry] Frame 0
class com.midasplayer.util.AnimEntry implements com.midasplayer.timing.Timeable
{
var playList_, animId_;
function AnimEntry (playList, animId) {
playList_ = playList;
animId_ = animId;
}
function tick(tick) {
}
function render(tick, alpha) {
if (baseTick_ == -1) {
baseTick_ = tick;
}
var _local2 = play(playList_, tick - baseTick_, alpha);
if (_local2) {
com.midasplayer.util.AnimPlayer.end(animId_);
}
}
function play(playList, tick, alpha) {
var _local12 = playList.length;
var _local4 = true;
var _local3 = 0;
while (_local3 < _local12) {
var _local2 = playList[_local3];
if (_local2 == undefined) {
} else if (_local2.length == undefined) {
var _local9 = _local2.func;
var _local8 = _local2.obj;
var _local10 = _local2.params;
var _local6 = _local9.call(_local8, tick, alpha, _local10);
if (_local6) {
playList[_local3] = undefined;
} else {
_local4 = false;
}
} else {
var _local6 = play(_local2, tick, alpha);
if (_local6) {
playList[_local3] = undefined;
baseTick_ = baseTick_ + tick;
_local4 = false;
break;
}
_local4 = false;
break;
}
_local3++;
}
return(_local4);
}
var baseTick_ = -1;
}
Symbol 366 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Encoder] Frame 0
class com.midasplayer.game.itsybitsyspider.Encoder
{
var res;
function Encoder () {
res = "";
}
function append(value) {
res = res + BASE_64_CHARS.charAt(value % 64);
res = res + BASE_64_CHARS.charAt(value / 64);
}
function appendShort(value) {
res = res + BASE_64_CHARS.charAt(value);
}
static var BASE_64_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#!";
static var MARKER_DIRECTION_NONE = 1;
static var MARKER_DIRECTION_P1 = 2;
static var MARKER_DIRECTION_P2 = 3;
static var MARKER_SWAP_LINE = 4;
static var NEW_STIX = 5;
static var STIX_LINE = 6;
static var ROUND_END = 7;
}
Symbol 367 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Stix] Frame 0
class com.midasplayer.game.itsybitsyspider.Stix
{
var closed_, clip_, drawLayer_, points_, lines_, loopLines_, lastPoint_, startPoint_, startLine_, previewPoint_, previewLine_, center_, filled_, route_, endLine_, endPoint_, closedLines_;
function Stix (clip, drawLayer, p, line) {
closed_ = false;
var _local12 = line.p1.x - p.x;
var _local9 = line.p1.y - p.y;
var _local6 = Math.sqrt((_local12 * _local12) + (_local9 * _local9));
var _local10 = line.p2.x - p.x;
var _local7 = line.p2.y - p.y;
var _local5 = Math.sqrt((_local10 * _local10) + (_local7 * _local7));
var _local4 = _local6;
var _local11 = line.p1.x;
var _local8 = line.p1.y;
if (_local5 < _local6) {
_local4 = _local5;
_local11 = line.p2.x;
_local8 = line.p2.y;
}
if ((_local4 > 0) && (_local4 < 10)) {
p.x = _local11;
p.y = _local8;
com.midasplayer.game.itsybitsyspider.Game.getBoard().getMarker().setPoint(p);
}
clip_ = clip;
drawLayer_ = drawLayer;
points_ = new Array();
lines_ = new Array();
loopLines_ = new Array();
lastPoint_ = p;
startPoint_ = new com.midasplayer.game.itsybitsyspider.Point(lastPoint_.x, lastPoint_.y);
startLine_ = line;
var _local13 = new com.midasplayer.game.itsybitsyspider.Point(lastPoint_.x, lastPoint_.y);
points_[0] = _local13;
previewPoint_ = new com.midasplayer.game.itsybitsyspider.Point(lastPoint_.x, lastPoint_.y);
previewLine_ = new com.midasplayer.game.itsybitsyspider.Line(lastPoint_, previewPoint_);
clip_.moveTo(p.x, p.y);
}
function isClosed() {
return(closed_);
}
function getCenter() {
return(center_);
}
function waspInside(wasp, lines) {
var _local5 = new com.midasplayer.game.itsybitsyspider.Point(wasp.getX(), wasp.getY());
var _local4 = new com.midasplayer.game.itsybitsyspider.Point(1000, wasp.getY());
var _local2 = new com.midasplayer.game.itsybitsyspider.Line(_local5, _local4);
var _local3 = com.midasplayer.game.itsybitsyspider.Line.numIntersections(_local2, lines);
return((_local3 % 2) == 0);
}
function close() {
if (filled_) {
return(undefined);
}
filled_ = true;
var _local2;
var _local10 = getLinesRoute1();
var _local13 = getLinesRoute2();
var _local14;
var _local12 = com.midasplayer.game.itsybitsyspider.Line.getArea(_local10);
var _local11 = com.midasplayer.game.itsybitsyspider.Line.getArea(_local13);
var _local17 = com.midasplayer.game.itsybitsyspider.Game.getBoard().getWasps();
var _local9 = _local17[0];
var _local7 = _local17[1];
if (_local9 == null) {
_local9 = _local7;
_local7 = null;
}
if (waspInside(_local9, _local10)) {
if (((_local7 == null) || (_local7 == undefined)) || (_local7.isDead())) {
route_ = 1;
} else if (waspInside(_local7, _local10)) {
route_ = 1;
} else if (_local12 < _local11) {
route_ = 1;
_local7.die();
} else {
route_ = 2;
_local9.die();
}
} else if (((_local7 == null) || (_local7 == undefined)) || (_local7.isDead())) {
route_ = 2;
} else if (waspInside(_local7, _local13)) {
route_ = 2;
} else if (_local11 < _local12) {
route_ = 2;
_local7.die();
} else {
route_ = 1;
_local9.die();
}
if (route_ == 1) {
_local2 = _local10;
_local14 = _local12;
} else {
_local2 = _local13;
_local14 = _local11;
}
center_ = com.midasplayer.game.itsybitsyspider.Line.getCenter(_local2, _local14);
var _local18 = com.midasplayer.game.itsybitsyspider.Line.isClockwiseOrder(_local2);
clip_.clear();
clip_.beginFill(16777215);
clip_.moveTo(_local2[0].p1.x, _local2[0].p1.y);
if (_local18) {
var _local4 = 1;
while (_local4 < _local2.length) {
clip_.lineTo(_local2[_local2.length - _local4].p1.x, _local2[_local2.length - _local4].p1.y);
_local4++;
}
} else {
var _local4 = 1;
while (_local4 < _local2.length) {
clip_.lineTo(_local2[_local4].p1.x, _local2[_local4].p1.y);
_local4++;
}
}
clip_.endFill();
var _local8 = points_.length - 1;
drawLayer_.clear();
var _local4 = 0;
while (_local4 < _local8) {
var _local16 = _local2[_local4];
var _local5 = _local16.getLength();
var _local6 = _local16.getRotation();
var _local3 = Math.round(_local5 / 50) * 50;
_local3 = "dropline" + _local3;
var _local15 = drawLayer_.attachMovie(_local3, "d", drawLayer_.getNextHighestDepth());
_local15._x = _local16.p1.x;
_local15._y = _local16.p1.y;
_local15._xscale = (100 * _local5) / _local15._width;
_local15._rotation = _local6;
_local15 = drawLayer_.attachMovie("drop1", "d", drawLayer_.getNextHighestDepth());
_local15._x = _local16.p1.x;
_local15._y = _local16.p1.y;
_local4++;
}
var _local16 = _local2[_local8];
var _local15 = drawLayer_.attachMovie("drop1", "d", drawLayer_.getNextHighestDepth());
_local15._x = _local16.p1.x;
_local15._y = _local16.p1.y;
return(_local14);
}
function getLinesRoute1() {
var _local2 = new Array();
var _local5 = 0;
while (_local5 < lines_.length) {
_local2[_local5] = lines_[_local5];
_local5++;
}
var _local15 = false;
var _local3 = endLine_;
var _local4 = endPoint_;
var _local16 = 0;
while (!_local15) {
_local16++;
if (_local16 > (_local2.length * 2)) {
trace("something wrong line route 1");
}
if (_local3 == startLine_) {
var _local9 = _local3.p2.x - _local4.x;
var _local7 = _local3.p2.y - _local4.y;
var _local8 = _local3.p2.x - startPoint_.x;
var _local6 = _local3.p2.y - startPoint_.y;
var _local14 = (_local9 * _local9) + (_local7 * _local7);
var _local13 = (_local8 * _local8) + (_local6 * _local6);
if (_local13 <= _local14) {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(startPoint_.x, startPoint_.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
if (_local10.getLength() > 0) {
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
}
_local2[_local2.length - 1].setLineConnectingP2(_local2[0]);
_local2[0].setLineConnectingP1(_local2[_local2.length - 1]);
_local15 = true;
} else {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(_local3.p2.x, _local3.p2.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
if (_local10.getLength() > 0) {
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
}
_local3 = _local3.getLineConnectingP2();
_local4 = _local3.p1;
}
} else {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(_local3.p2.x, _local3.p2.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
_local3 = _local3.getLineConnectingP2();
_local4 = _local3.p1;
}
}
return(_local2);
}
function getLinesRoute2() {
var _local2 = new Array();
var _local5 = 0;
while (_local5 < lines_.length) {
_local2[_local5] = lines_[_local5];
_local5++;
}
var _local15 = false;
var _local3 = endLine_;
var _local4 = endPoint_;
var _local16 = 0;
while (!_local15) {
_local16++;
if (_local16 > (_local2.length * 2)) {
trace("something wrong line route 2");
}
if (_local3 == startLine_) {
var _local9 = _local3.p1.x - _local4.x;
var _local7 = _local3.p1.y - _local4.y;
var _local8 = _local3.p1.x - startPoint_.x;
var _local6 = _local3.p1.y - startPoint_.y;
var _local14 = (_local9 * _local9) + (_local7 * _local7);
var _local13 = (_local8 * _local8) + (_local6 * _local6);
if (_local13 <= _local14) {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(startPoint_.x, startPoint_.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
if (_local10.getLength() > 0) {
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
}
_local2[_local2.length - 1].setLineConnectingP2(_local2[0]);
_local2[0].setLineConnectingP1(_local2[_local2.length - 1]);
_local15 = true;
} else {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(_local3.p1.x, _local3.p1.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
if (_local10.getLength() > 0) {
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
}
_local3 = _local3.getLineConnectingP1();
_local4 = _local3.p2;
}
} else {
var _local12 = new com.midasplayer.game.itsybitsyspider.Point(_local4.x, _local4.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Point(_local3.p1.x, _local3.p1.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Line(_local12, _local11);
_local2[_local2.length] = _local10;
_local2[_local2.length - 2].setLineConnectingP2(_local2[_local2.length - 1]);
_local2[_local2.length - 1].setLineConnectingP1(_local2[_local2.length - 2]);
_local3 = _local3.getLineConnectingP1();
_local4 = _local3.p2;
}
}
return(_local2);
}
function getPreviewLines() {
return(lines_);
}
function getOutline() {
if (route_ == 1) {
closedLines_ = getLinesRoute2();
} else {
closedLines_ = getLinesRoute1();
}
var _local2 = 0;
while (_local2 < closedLines_.length) {
closedLines_[_local2].setClosed(true);
_local2++;
}
var _local3 = lines_.length;
com.midasplayer.game.itsybitsyspider.Game.getBoard().getMarker().setLine(closedLines_[_local3 - 1]);
return(closedLines_);
}
function getStartLine() {
return(startLine_);
}
function getEndLine() {
return(endLine_);
}
function getStartPoint() {
return(startPoint_);
}
function getEndPoint() {
return(endPoint_);
}
function getLines() {
return(lines_);
}
function isOutsideLoop(x, y) {
var _local3 = true;
var _local2 = 0;
while (_local2 < loopLines_.length) {
_local3 = com.midasplayer.game.itsybitsyspider.Line.isOutside(x, y, loopLines_[_local2]);
if (!_local3) {
return(false);
}
_local2++;
}
return(_local3);
}
function isOutside(x, y) {
var _local2 = false;
if (lines_.length == 0) {
var _local4 = x - previewLine_.p1.x;
var _local3 = y - previewLine_.p1.y;
x = previewLine_.p1.x + (_local4 * 0.99);
y = previewLine_.p1.y + (_local3 * 0.99);
_local2 = com.midasplayer.game.itsybitsyspider.Line.isOutside(x, y, com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline());
}
return(_local2);
}
function snap(x) {
x = Math.round(x / 10) * 10;
return(x);
}
function previewLineToPoint(x, y) {
drawLines();
var _local2 = 25;
previewPoint_.x = x;
previewPoint_.y = y;
previewLine_.p1 = lastPoint_;
previewLine_.p2 = previewPoint_;
var _local3 = previewLine_.getLength();
var _local5 = previewLine_.p2.x - previewLine_.p1.x;
var _local4 = previewLine_.p2.y - previewLine_.p1.y;
previewLine_.updateMinMaxPoints();
_local5 = _local5 / _local3;
_local4 = _local4 / _local3;
if (_local3 < 1) {
return(undefined);
}
previewLine_.p2.x = previewLine_.p2.x + (_local5 * _local2);
previewLine_.p2.y = previewLine_.p2.y + (_local4 * _local2);
previewLine_.updateMinMaxPoints();
if (lines_.length > 0) {
var _local7 = previewLine_.angleTo(lines_[lines_.length - 1]);
if (_local7 > 175) {
return(undefined);
}
}
var _local6 = intersect(previewLine_, lines_);
if (_local6 != null) {
previewLine_.p2.x = previewLine_.p2.x - (_local5 * _local2);
previewLine_.p2.y = previewLine_.p2.y - (_local4 * _local2);
previewLine_.updateMinMaxPoints();
if (previewLine_.getLength() < _local2) {
return(undefined);
}
if (!isOutsideLoop(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
}
var _local8 = intersect(previewLine_, com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline());
if ((_local6 == null) && (_local8 == null)) {
_local3 = previewLine_.getLength();
_local3 = Math.max(_local3 - _local2, 0);
_local3 = Math.min(_local3, _local2);
previewLine_.p2.x = previewLine_.p2.x - (_local5 * _local3);
previewLine_.p2.y = previewLine_.p2.y - (_local4 * _local3);
previewLine_.updateMinMaxPoints();
if (!isOutsideLoop(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
}
if (isOutside(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
if (previewLine_.p2.equals(startPoint_)) {
return(undefined);
}
drawLayer_.lineStyle(2, 16777215, 40);
drawLayer_.moveTo(previewLine_.p1.x, previewLine_.p1.y);
drawLayer_.lineTo(previewLine_.p2.x, previewLine_.p2.y);
}
function addLineToPoint(x, y, tick) {
var _local5 = 25;
previewPoint_.x = x;
previewPoint_.y = y;
previewLine_.p1 = lastPoint_;
previewLine_.p2 = previewPoint_;
var _local6 = previewLine_.getLength();
var _local8 = previewLine_.p2.x - previewLine_.p1.x;
var _local7 = previewLine_.p2.y - previewLine_.p1.y;
previewLine_.updateMinMaxPoints();
_local8 = _local8 / _local6;
_local7 = _local7 / _local6;
if (_local6 < 1) {
return(undefined);
}
previewLine_.p2.x = previewLine_.p2.x + (_local8 * _local5);
previewLine_.p2.y = previewLine_.p2.y + (_local7 * _local5);
previewLine_.updateMinMaxPoints();
if (lines_.length > 0) {
var _local13 = previewLine_.angleTo(lines_[lines_.length - 1]);
if (_local13 > 175) {
return(undefined);
}
}
var _local4 = intersect(previewLine_, lines_);
if (_local4 != null) {
var _local12 = previewLine_.p2.duplicate();
previewLine_.p2.x = previewLine_.p2.x - (_local8 * _local5);
previewLine_.p2.y = previewLine_.p2.y - (_local7 * _local5);
previewLine_.updateMinMaxPoints();
if (previewLine_.getLength() < _local5) {
return(undefined);
}
if (!isOutsideLoop(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
var _local3 = new Array();
loopLines_[loopLines_.length] = _local3;
_local3[_local3.length] = new com.midasplayer.game.itsybitsyspider.Line(_local12, previewLine_.p1);
var _local2 = lines_[lines_.length - 1];
while (!_local2.equals(_local4)) {
_local3[_local3.length] = new com.midasplayer.game.itsybitsyspider.Line(_local2.p2, _local2.p1);
_local2 = _local2.getLineConnectingP1();
}
_local3[_local3.length] = new com.midasplayer.game.itsybitsyspider.Line(_local4.p2, _local12);
previewLine_.updateMinMaxPoints();
}
var _local9 = intersect(previewLine_, com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline());
if ((_local4 == null) && (_local9 == null)) {
_local6 = previewLine_.getLength();
_local6 = Math.max(_local6 - _local5, 0);
_local6 = Math.min(_local6, _local5);
previewLine_.p2.x = previewLine_.p2.x - (_local8 * _local6);
previewLine_.p2.y = previewLine_.p2.y - (_local7 * _local6);
previewLine_.updateMinMaxPoints();
if (!isOutsideLoop(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
}
if (isOutside(previewLine_.p2.x, previewLine_.p2.y)) {
return(undefined);
}
if (previewLine_.p2.equals(startPoint_)) {
return(undefined);
}
if (_local9 != null) {
closed_ = true;
endLine_ = _local9;
previewLine_.setLineConnectingP2(_local9);
}
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(tick);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.appendShort(com.midasplayer.game.itsybitsyspider.Encoder.STIX_LINE);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(x);
com.midasplayer.game.itsybitsyspider.Game.getBoard().encoder.append(y);
var _local14 = new com.midasplayer.game.itsybitsyspider.Point(lastPoint_.x, lastPoint_.y);
var _local10 = new com.midasplayer.game.itsybitsyspider.Point(previewPoint_.x, previewPoint_.y);
var _local11 = new com.midasplayer.game.itsybitsyspider.Line(_local14, _local10);
_local11.setLineConnectingP2(previewLine_.getLineConnectingP2());
lastPoint_ = new com.midasplayer.game.itsybitsyspider.Point(previewPoint_.x, previewPoint_.y);
endPoint_ = _local10;
points_[points_.length] = _local10;
lines_[lines_.length] = _local11;
if (lines_.length == 1) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().getMarker().setLine(lines_[0]);
} else {
lines_[lines_.length - 2].setLineConnectingP2(lines_[lines_.length - 1]);
lines_[lines_.length - 1].setLineConnectingP1(lines_[lines_.length - 2]);
}
}
function intersect(line, lines) {
var _local4 = null;
var _local1 = 0;
while (_local1 < lines.length) {
var _local3 = line.intersect(lines[_local1]);
if (_local3) {
_local4 = lines[_local1];
}
_local1++;
}
return(_local4);
}
function hit() {
drawLayer_.clear();
}
function drawLines() {
drawLayer_.clear();
drawLayer_.lineStyle(2, 16777215, 40);
var _local2 = 0;
while (_local2 < lines_.length) {
drawLayer_.moveTo(lines_[_local2].p1.x, lines_[_local2].p1.y);
drawLayer_.lineTo(lines_[_local2].p2.x, lines_[_local2].p2.y);
_local2++;
}
}
}
Symbol 368 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Wasp] Frame 0
class com.midasplayer.game.itsybitsyspider.Wasp
{
var random_, x, y, speed_, clip_, radius_, animId_, stopped_, dead_, hitBoard_;
function Wasp (clip, seed) {
random_ = new com.midasplayer.util.Random(seed);
x = new com.midasplayer.timing.IFloat();
y = new com.midasplayer.timing.IFloat();
x.set(300 + random_.nextInt(300));
y.set(100 + random_.nextInt(300));
rotation_ = random_.nextInt(360);
speed_ = SPEED;
clip_ = clip.attachMovie("wasp_fly", "wasp", clip.getNextHighestDepth());
radius_ = 22;
clip_.gotoAndStop(1);
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:flyAnim}], callback:endFly, callback_scope:this, tps:32});
}
function getX() {
return(x.get(1));
}
function getY() {
return(y.get(1));
}
function clear() {
com.midasplayer.util.AnimPlayer.end(animId_);
clip_.removeMovieClip();
}
function stop() {
stopped_ = true;
}
function die() {
if (dead_) {
return(undefined);
}
dead_ = true;
com.midasplayer.game.itsybitsyspider.Game.getBoard().removeWasp(this);
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:dieAnim}], callback:endDie, callback_scope:this, tps:32});
}
function isDead() {
return(dead_);
}
function dieAnim(tick) {
clip_._xscale = clip_._xscale - 2;
clip_._yscale = clip_._yscale - 2;
if (clip_._xscale <= 10) {
return(true);
}
return(false);
}
function endDie() {
clear();
}
function flyAnim(tick) {
if (stopped_) {
return(undefined);
}
clip_.gotoAndStop((tick % 37) + 1);
return(false);
}
function endFly() {
}
function draw(alpha) {
clip_._x = x.get(alpha);
clip_._y = y.get(alpha);
if (hitBoard_) {
clip_._yscale = 85;
} else {
clip_._yscale = 100;
}
clip_._rotation = rotation_;
}
function checkInside() {
var _local3 = com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline();
var _local2 = com.midasplayer.game.itsybitsyspider.Line.isOutside(getX(), getY(), _local3);
if (_local2) {
trace("outside");
}
}
function checkAgainstStix(xx, yy) {
var _local7 = com.midasplayer.game.itsybitsyspider.Game.getBoard().getStix().getPreviewLines();
var _local3 = 0;
while (_local3 < _local7.length) {
var _local2 = _local7[_local3];
var _local5 = _local2.midX - xx;
var _local4 = _local2.midY - yy;
var _local6 = ((_local5 * _local5) + (_local4 * _local4)) - _local2.radius;
if (_local6 < 30) {
if (_local2.intersectsWithCircle(xx, yy, radius_)) {
return(false);
}
}
_local3++;
}
return(true);
}
function updateRotation() {
if (timeToNextRotation_ == 0) {
rotationSpeed_ = (10 * (random_.nextInt(ROTATION_SPEED) - (ROTATION_SPEED / 2))) / 100;
timeToNextRotation_ = random_.nextInt(TIME_TO_NEXT_ROTATION_MAX - TIME_TO_NEXT_ROTATION_MIN) + TIME_TO_NEXT_ROTATION_MIN;
}
timeToNextRotation_--;
if (hitBoard_) {
rotation_ = rotation_ + (rotationSpeed_ * Math.min(numHits_, ROTATION_MULTIPLIER_IF_STUCK));
} else {
rotation_ = rotation_ + rotationSpeed_;
}
}
function tick(tick) {
updateRotation();
var _local4 = speed_;
if (hitBoard_) {
_local4 = speed_ * SPEED_MULTIPLIER_IF_STUCK;
}
var _local3 = getX() - (Math.sin((Math.PI * rotation_) / 180) * _local4);
var _local2 = getY() + (Math.cos((Math.PI * rotation_) / 180) * _local4);
hitBoard_ = com.midasplayer.game.itsybitsyspider.Game.getBoard().hitBoard(_local3, _local2, radius_);
if (hitBoard_) {
numHits_++;
updateRotation();
_local3 = getX();
_local2 = getY();
}
if (!checkAgainstStix(_local3, _local2)) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().stixHit();
}
if (!hitBoard_) {
numHits_ = 0;
}
x.set(_local3);
y.set(_local2);
}
function render(tick, alpha) {
draw(alpha);
}
var TIME_TO_NEXT_ROTATION_MAX = 20;
var TIME_TO_NEXT_ROTATION_MIN = 10;
var ROTATION_SPEED = 3000 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var ROTATION_MULTIPLIER_IF_STUCK = 3;
var SPEED_MULTIPLIER_IF_STUCK = 2;
var SPEED = 120 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var rotation_ = 0;
var rotationSpeed_ = 0;
var numHits_ = 0;
var timeToNextRotation_ = 0;
}
Symbol 369 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Beetle] Frame 0
class com.midasplayer.game.itsybitsyspider.Beetle
{
var random_, line_, web_, possibleLines_, x, y, point_, speed_, clip_, animId_, stopped_;
function Beetle (clip, num, web, lines, seed) {
random_ = new com.midasplayer.util.Random(seed);
var _local4 = random_.nextInt(2);
var _local2 = lines[(random_.nextInt(3) + 16) + (num * 3)];
line_ = _local2;
web_ = web;
possibleLines_ = new Array();
x = new com.midasplayer.timing.IFloat();
y = new com.midasplayer.timing.IFloat();
x.set(_local2.p1.x + ((_local2.p2.x - _local2.p1.x) / 2));
y.set(_local2.p1.y + ((_local2.p2.y - _local2.p1.y) / 2));
point_ = new com.midasplayer.game.itsybitsyspider.Point(getX(), getY());
speed_ = -72 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var _local3 = clip.getNextHighestDepth();
clip_ = clip.attachMovie("beetle_" + COLORS[_local4], "beetle" + _local3, _local3);
clip_.gotoAndStop(1);
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:walkAnim}], callback:endWalk, callback_scope:this, tps:16});
}
function getX() {
return(x.get(1));
}
function getY() {
return(y.get(1));
}
function clear() {
com.midasplayer.util.AnimPlayer.end(animId_);
clip_.removeMovieClip();
}
function stop() {
stopped_ = true;
}
function walkAnim(tick) {
if (stopped_) {
return(undefined);
}
clip_.gotoAndStop((tick % 8) + 1);
return(false);
}
function endWalk() {
}
function setNewLine(point) {
if (speed_ > 0) {
var _local6 = web_.getLinesStartingAtPoint(point);
var _local7 = web_.getLinesEndingAtPoint(point);
} else {
var _local6 = web_.getLinesEndingAtPoint(point);
var _local7 = web_.getLinesStartingAtPoint(point);
}
var _local9 = _local6.size();
var _local8 = _local7.size();
var _local5 = 0;
var _local2 = null;
var _local3 = 0;
var _local4 = 0;
while (_local4 < _local9) {
_local2 = _local6.get(_local4);
_local3 = _local2.angleTo(line_);
if ((_local3 > 0.5) && (_local3 < 359.5)) {
possibleLines_[_local5] = _local2;
_local5++;
}
_local4++;
}
_local4 = 0;
while (_local4 < _local8) {
_local2 = _local7.get(_local4);
_local3 = _local2.angleTo(line_);
if ((_local3 > 0.5) && (_local3 < 359.5)) {
possibleLines_[_local5] = _local2;
_local5++;
}
_local4++;
}
if (_local5 == 0) {
var _local11 = 0;
_local2 = _local6.get(0);
} else {
var _local11 = random_.nextInt(_local5);
_local2 = possibleLines_[_local11];
}
speed_ = Math.abs(speed_);
if (point.equals(_local2.p2)) {
speed_ = -Math.abs(speed_);
}
line_ = _local2;
}
function tick(tick) {
var _local3 = speed_;
point_.x = getX();
point_.y = getY();
var _local5 = line_.p2.x - line_.p1.x;
var _local4 = line_.p2.y - line_.p1.y;
var _local10 = 1.5707963267949 /* Math.PI/2 */;
var _local9 = Math.round(Math.atan2(_local4, _local5));
var _local2 = (180 * (_local9 - _local10)) / Math.PI;
if (_local3 <= 0) {
_local2 = _local2 + 180;
}
_local2 = (360 + _local2) % 360;
if (rotation_ != _local2) {
if (_local2 > rotation_) {
var _local8 = _local2 - rotation_;
var _local7 = (rotation_ - _local2) + 360;
} else {
var _local8 = (_local2 - rotation_) + 360;
var _local7 = rotation_ - _local2;
}
if (_local8 < _local7) {
rotation_ = rotation_ + 4;
if (_local8 < 5) {
rotation_ = _local2;
}
} else {
rotation_ = rotation_ - 4;
if (_local7 < 5) {
rotation_ = _local2;
}
}
} else if (_local3 > 0) {
_local5 = line_.p2.x - point_.x;
_local4 = line_.p2.y - point_.y;
var _local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
_local5 = _local5 / _local6;
_local4 = _local4 / _local6;
if (_local6 > _local3) {
point_.x = point_.x + (_local3 * _local5);
point_.y = point_.y + (_local3 * _local4);
} else {
point_.x = line_.p2.x;
point_.y = line_.p2.y;
setNewLine(point_);
}
} else {
_local5 = line_.p1.x - point_.x;
_local4 = line_.p1.y - point_.y;
var _local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
_local5 = _local5 / _local6;
_local4 = _local4 / _local6;
if (_local6 > (-_local3)) {
point_.x = point_.x - (_local3 * _local5);
point_.y = point_.y - (_local3 * _local4);
} else {
point_.x = line_.p1.x;
point_.y = line_.p1.y;
setNewLine(point_);
}
}
if (point_.distanceTo(com.midasplayer.game.itsybitsyspider.Game.getBoard().getMarker().getPoint()) < 10) {
com.midasplayer.game.itsybitsyspider.Game.getBoard().markerHit();
}
x.set(point_.x);
y.set(point_.y);
}
function render(tick, alpha) {
draw(alpha);
}
function draw(alpha) {
clip_._x = x.get(alpha);
clip_._y = y.get(alpha);
clip_._rotation = rotation_;
}
var COLORS = ["red", "yellow"];
var rotation_ = 0;
}
Symbol 370 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Fly] Frame 0
class com.midasplayer.game.itsybitsyspider.Fly
{
var random_, activeFrom_, activeTo_, numTicksFlying_, x, y, speed_, clip_, clip2_, radius_, animId_, stopped_, caught_, lastActiveTick_, numTicksStill_, hitBoard_;
function Fly (clip, seed) {
random_ = new com.midasplayer.util.Random(seed);
activeFrom_ = 0;
activeTo_ = (activeFrom_ + random_.nextInt(1500)) + 1000;
numTicksFlying_ = 10;
x = new com.midasplayer.timing.IFloat();
y = new com.midasplayer.timing.IFloat();
x.set(300 + random_.nextInt(300));
y.set(100 + random_.nextInt(300));
rotation_ = random_.nextInt(360);
speed_ = SPEED;
clip_ = clip.attachMovie("fly_fly", "fly", clip.getNextHighestDepth());
clip2_ = clip.attachMovie("fly_caught", "flyc", clip.getNextHighestDepth());
clip2_._visible = false;
radius_ = 14;
clip_.gotoAndStop(1);
clip2_.gotoAndStop(1);
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:flyAnim}], callback:endFly, callback_scope:this, tps:32});
}
function getX() {
return(x.get(1));
}
function getY() {
return(y.get(1));
}
function clear() {
com.midasplayer.util.AnimPlayer.end(animId_);
clip_.removeMovieClip();
clip2_.removeMovieClip();
}
function stop() {
stopped_ = true;
}
function flyAnim(tick) {
if (caught_) {
var _local4 = tick - lastTick_;
var _local2 = clip2_._currentframe + _local4;
_local2 = Math.min(_local2, 64);
clip2_.gotoAndStop(_local2);
}
if ((!caught_) && (!stopped_)) {
if (numTicksFlying_ > 0) {
clip_.gotoAndStop((tick % 11) + 1);
} else {
clip_.gotoAndStop((tick % 89) + 11);
}
}
lastTick_ = tick;
return(false);
}
function endFly() {
}
function checkInside() {
if (caught_) {
return(false);
}
if (getDistance(lastActiveTick_) > 0) {
return(false);
}
var _local3 = com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline();
var _local2 = com.midasplayer.game.itsybitsyspider.Line.isOutside(getX(), getY(), _local3);
if (_local2) {
caught_ = true;
clip_._visible = false;
clip2_._visible = true;
activeTo_ = lastActiveTick_ + 200;
com.midasplayer.game.itsybitsyspider.Game.getBoard().insectTaken();
clip_.gotoAndStop(9);
return(true);
}
return(false);
}
function updateSpeed() {
if (numTicksFlying_ > 0) {
numTicksFlying_--;
if (numTicksFlying_ < 25) {
speed_ = SPEED / (25 - numTicksFlying_);
}
if (numTicksFlying_ == 0) {
speed_ = 0;
numTicksStill_ = TICKS_STILL + random_.nextInt(TICKS_STILL);
}
}
if (numTicksStill_ > 0) {
numTicksStill_--;
if (numTicksStill_ == 0) {
speed_ = SPEED;
numTicksFlying_ = TICKS_FLYING + random_.nextInt(TICKS_FLYING);
}
}
}
function updateRotation() {
if (timeToNextRotation_ == 0) {
rotationSpeed_ = (10 * (random_.nextInt(ROTATION_SPEED) - (ROTATION_SPEED / 2))) / 100;
timeToNextRotation_ = random_.nextInt(TIME_TO_NEXT_ROTATION_MAX - TIME_TO_NEXT_ROTATION_MIN) + TIME_TO_NEXT_ROTATION_MIN;
}
timeToNextRotation_--;
if (hitBoard_) {
rotation_ = rotation_ + (rotationSpeed_ * ROTATION_MULTIPLIER_IF_STUCK);
} else {
rotation_ = rotation_ + rotationSpeed_;
}
}
function tick(tick) {
lastActiveTick_ = tick;
if (caught_) {
return(undefined);
}
var _local6 = getDistance(tick);
if (_local6 == 1) {
return(undefined);
}
if (tick == activeFrom_) {
checkInside();
}
updateSpeed();
if (speed_ == 0) {
return(undefined);
}
updateRotation();
var _local2 = speed_;
if (hitBoard_) {
_local2 = speed_ * SPEED_MULTIPLIER_IF_STUCK;
}
var _local4 = getX() - (Math.sin((Math.PI * rotation_) / 180) * _local2);
var _local3 = getY() + (Math.cos((Math.PI * rotation_) / 180) * _local2);
hitBoard_ = com.midasplayer.game.itsybitsyspider.Game.getBoard().hitBoard(_local4, _local3, radius_);
if (hitBoard_) {
updateRotation();
_local4 = getX();
_local3 = getY();
}
x.set(_local4);
y.set(_local3);
}
function getDistance(tick) {
var _local2 = 20;
if (tick < (activeFrom_ - _local2)) {
return(1);
}
if (tick > (activeTo_ + _local2)) {
return(1);
}
if (tick < activeFrom_) {
return((activeFrom_ - tick) / _local2);
}
if (tick > activeTo_) {
return((tick - activeTo_) / _local2);
}
return(0);
}
function render(tick, alpha) {
var _local3 = getDistance(tick);
if (_local3 == 1) {
clip_._visible = false;
clip2_._visible = false;
return(undefined);
}
var _local2 = 1 - _local3;
if (caught_) {
clip_._visible = false;
clip2_._visible = true;
clip_._x = x.get(1);
clip_._y = y.get(1);
} else {
clip_._visible = true;
clip2_._visible = false;
clip_._x = x.get(alpha);
clip_._y = y.get(alpha);
}
clip_._rotation = rotation_;
if (hitBoard_ && (!caught_)) {
clip_._yscale = 85 * _local2;
clip_._xscale = 100 * _local2;
} else {
clip_._yscale = 100 * _local2;
clip_._xscale = 100 * _local2;
}
clip2_._x = clip_._x;
clip2_._y = clip_._y;
clip2_._rotation = clip_._rotation;
clip2_._xscale = clip_._xscale;
clip2_._yscale = clip_._yscale;
}
var TIME_TO_NEXT_ROTATION_MAX = 30;
var TIME_TO_NEXT_ROTATION_MIN = 10;
var ROTATION_SPEED = 30;
var ROTATION_MULTIPLIER_IF_STUCK = 3;
var SPEED_MULTIPLIER_IF_STUCK = 2;
var TICKS_FLYING = 2 * com.midasplayer.game.itsybitsyspider.Board.TPS;
var TICKS_STILL = 10 * com.midasplayer.game.itsybitsyspider.Board.TPS;
var SPEED = 120 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var rotation_ = 0;
var rotationSpeed_ = 0;
var lastTick_ = 0;
var timeToNextRotation_ = 0;
}
Symbol 371 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.Butterfly] Frame 0
class com.midasplayer.game.itsybitsyspider.Butterfly
{
var random_, activeFrom_, activeTo_, numTicksFlying_, x, y, col_, speed_, clip_, radius_, animId_, stopped_, caught_, lastActiveTick_, numTicksStill_, hitBoard_;
function Butterfly (clip, seed) {
random_ = new com.midasplayer.util.Random(seed);
activeFrom_ = 0;
activeTo_ = (activeFrom_ + random_.nextInt(1500)) + 1000;
numTicksFlying_ = 10;
x = new com.midasplayer.timing.IFloat();
y = new com.midasplayer.timing.IFloat();
x.set(300 + random_.nextInt(300));
y.set(100 + random_.nextInt(300));
rotation_ = random_.nextInt(360);
var _local2 = random_.nextInt(2);
col_ = _local2;
speed_ = SPEED;
clip_ = clip.attachMovie("butterfly_" + COLORS[_local2], "butterfly", clip.getNextHighestDepth());
clip_._visible = false;
radius_ = 20;
clip_.gotoAndStop(1);
animId_ = com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:flyAnim}], callback:endFly, callback_scope:this, tps:22});
}
function getX() {
return(x.get(1));
}
function getY() {
return(y.get(1));
}
function getCol() {
return(col_);
}
function clear() {
com.midasplayer.util.AnimPlayer.end(animId_);
clip_.removeMovieClip();
}
function stop() {
stopped_ = true;
}
function flyAnim(tick) {
if (caught_) {
var _local4 = tick - lastTick_;
var _local2 = clip_._currentframe + _local4;
_local2 = Math.min(_local2, 64);
clip_.gotoAndStop(_local2);
}
if ((!caught_) && (!stopped_)) {
if (numTicksFlying_ > 0) {
clip_.gotoAndStop((tick % 8) + 1);
} else {
clip_.gotoAndStop(((tick * 3) % 70) + 65);
}
}
lastTick_ = tick;
return(false);
}
function endFly() {
}
function checkInside() {
if (caught_) {
return(false);
}
if (getDistance(lastActiveTick_) > 0) {
return(false);
}
var _local3 = com.midasplayer.game.itsybitsyspider.Game.getBoard().getOutline();
var _local2 = com.midasplayer.game.itsybitsyspider.Line.isOutside(getX(), getY(), _local3);
if (_local2) {
caught_ = true;
activeTo_ = lastActiveTick_ + 200;
com.midasplayer.game.itsybitsyspider.Game.getBoard().insectTaken();
clip_.gotoAndStop(9);
return(true);
}
return(false);
}
function updateSpeed() {
if (numTicksFlying_ > 0) {
numTicksFlying_--;
if (numTicksFlying_ < 15) {
speed_ = SPEED / (15 - numTicksFlying_);
}
if (numTicksFlying_ == 0) {
speed_ = 0;
numTicksStill_ = TICKS_STILL + random_.nextInt(TICKS_STILL);
}
}
if (numTicksStill_ > 0) {
numTicksStill_--;
if (numTicksStill_ == 0) {
speed_ = SPEED;
numTicksFlying_ = TICKS_FLYING + random_.nextInt(TICKS_FLYING);
}
}
}
function updateRotation() {
if (timeToNextRotation_ == 0) {
rotationSpeed_ = (10 * (random_.nextInt(ROTATION_SPEED) - (ROTATION_SPEED / 2))) / 100;
timeToNextRotation_ = random_.nextInt(TIME_TO_NEXT_ROTATION_MAX - TIME_TO_NEXT_ROTATION_MIN) + TIME_TO_NEXT_ROTATION_MIN;
}
timeToNextRotation_--;
if (hitBoard_) {
rotation_ = rotation_ + (rotationSpeed_ * ROTATION_MULTIPLIER_IF_STUCK);
} else {
rotation_ = rotation_ + rotationSpeed_;
}
}
function tick(tick) {
lastActiveTick_ = tick;
if (caught_) {
return(undefined);
}
var _local6 = getDistance(tick);
if (_local6 == 1) {
return(undefined);
}
if (tick == activeFrom_) {
checkInside();
}
updateSpeed();
if (speed_ == 0) {
return(undefined);
}
updateRotation();
var _local2 = speed_;
if (hitBoard_) {
_local2 = speed_ * SPEED_MULTIPLIER_IF_STUCK;
}
var _local4 = getX() - (Math.sin((Math.PI * rotation_) / 180) * _local2);
var _local3 = getY() + (Math.cos((Math.PI * rotation_) / 180) * _local2);
hitBoard_ = com.midasplayer.game.itsybitsyspider.Game.getBoard().hitBoard(_local4, _local3, radius_);
if (hitBoard_) {
updateRotation();
_local4 = getX();
_local3 = getY();
}
x.set(_local4);
y.set(_local3);
}
function getDistance(tick) {
var _local2 = 50;
if (tick < (activeFrom_ - _local2)) {
return(1);
}
if (tick > (activeTo_ + _local2)) {
return(1);
}
if (tick < activeFrom_) {
return((activeFrom_ - tick) / _local2);
}
if (tick > activeTo_) {
return((tick - activeTo_) / _local2);
}
return(0);
}
function render(tick, alpha) {
var _local3 = getDistance(tick);
if (_local3 == 1) {
clip_._visible = false;
return(undefined);
}
var _local2 = 1 - _local3;
clip_._visible = true;
clip_._x = x.get(alpha);
clip_._y = y.get(alpha);
if (hitBoard_ && (!caught_)) {
clip_._xscale = 100 * _local2;
clip_._yscale = 85 * _local2;
} else {
clip_._xscale = 100 * _local2;
clip_._yscale = 100 * _local2;
}
clip_._rotation = rotation_;
}
var TIME_TO_NEXT_ROTATION_MAX = 90;
var TIME_TO_NEXT_ROTATION_MIN = 20;
var ROTATION_SPEED = 30;
var ROTATION_MULTIPLIER_IF_STUCK = 4;
var SPEED_MULTIPLIER_IF_STUCK = 2;
var TICKS_FLYING = 4 * com.midasplayer.game.itsybitsyspider.Board.TPS;
var TICKS_STILL = 12 * com.midasplayer.game.itsybitsyspider.Board.TPS;
var SPEED = 30 / com.midasplayer.game.itsybitsyspider.Board.TPS;
var COLORS = ["blue", "pink"];
var rotation_ = 0;
var rotationSpeed_ = 0;
var lastTick_ = 0;
var timeToNextRotation_ = 0;
}
Symbol 372 MovieClip [__Packages.com.midasplayer.fx.SoundManager] Frame 0
class com.midasplayer.fx.SoundManager
{
function SoundManager () {
}
static function isSoundEnabled() {
return(soundEnabled);
}
static function enableSounds(enabled) {
soundEnabled = enabled;
if (!enabled) {
muteAll();
} else {
restoreMuteAll();
}
}
static function stopAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(0);
});
}
static function restoreMuteAll() {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.setVolume(soundEntry.realVol);
});
}
static function stop(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local1 = sounds.get(resource);
if (_local1 == undefined) {
var _local3 = new Array();
_local3.push(resource);
initialize(_local3);
}
_local1 = sounds.get(resource);
if (_local1 != undefined) {
var _local2 = percent;
_local1.sound.setVolume(_local2);
_local1.sound.volume = _local2;
}
}
static function getVolume(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
return(_local1.sound.getVolume());
}
return(100);
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function initialize(list) {
for (var _local9 in list) {
var resource = list[_local9];
var _local3 = _root.getNextHighestDepth();
var _local2 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local2.attachSound(resource);
_local2.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local2, playStatus:false});
}
}
static function play(resource, volume, isLoop, fn) {
if (volume == undefined) {
volume = getVolume(resource);
}
if (isLoop == undefined) {
isLoop = false;
}
var _local2 = sounds.get(resource);
if (_local2 != undefined) {
_local2.sound.setVolume((soundEnabled ? (volume) : 0));
_local2.realVol = volume;
_local2.playStatus = true;
_local2.onPlayedFn = fn;
_local2.sound.start(0, (isLoop ? 32767 : 1));
} else {
var _local6 = _root.getNextHighestDepth();
var _local3 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local6, _local6));
_local3.attachSound(resource);
_local3.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
com.midasplayer.fx.SoundManager.onPlayed_(resource);
};
_local3.setVolume((soundEnabled ? (volume) : 0));
_local3.start(0, (isLoop ? 32767 : 1));
sounds.put(resource, {realVol:volume, onPlayedFn:fn, sound:_local3, playStatus:true});
}
}
static function onPlayed_(name) {
var _local1 = sounds.get(name);
if ((_local1 != undefined) && (_local1.onPlayedFn != undefined)) {
_local1.onPlayedFn();
}
}
static var sounds = new com.midasplayer.util.Map();
static var soundEnabled = true;
}
Symbol 373 MovieClip [__Packages.com.midasplayer.game.itsybitsyspider.ScorePopup] Frame 0
class com.midasplayer.game.itsybitsyspider.ScorePopup
{
var x_, y_, clip_, numbers_, numNumbers_;
function ScorePopup (score, x, y) {
x_ = x;
y_ = y;
clip_ = _root.createEmptyMovieClip("score", _root.getNextHighestDepth());
clip_._x = -1000;
attachNumberClips(score);
showScore();
}
function attachNumberClips(score) {
numbers_ = new Array();
var _local7 = 0;
var _local3 = 0;
while (score > 0) {
var _local6 = score % 10;
var _local2 = clip_.attachMovie("number" + _local6, (("n" + _local3) + x_) + y_, clip_.getNextHighestDepth());
_local2._xscale = 50;
_local2._yscale = 50;
_local7 = _local7 + _local2._width;
_local7 = _local7 + SPACING;
numbers_[_local3] = _local2;
score = Math.floor(score / 10);
_local3++;
}
numNumbers_ = numbers_.length;
var _local5 = (-_local7) / 2;
_local3 = numNumbers_ - 1;
while (_local3 >= 0) {
numbers_[_local3]._x = _local5;
_local5 = _local5 + numbers_[_local3]._width;
_local5 = _local5 + SPACING;
_local3--;
}
}
function showScore() {
com.midasplayer.util.AnimPlayer.play({playlist:[{obj:this, func:showScoreAnim}], callback:endShowScore, callback_scope:this, tps:50});
}
function showScoreAnim(tick) {
var _local3 = false;
var _local7 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 5) * 100;
var _local5 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 90, 10) * 100;
var _local4 = _local7 - _local5;
var _local8 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 0, 10);
var _local6 = com.midasplayer.util.AnimPlayer.tickToPercent(tick, 90, 10);
clip_._alpha = _local4;
clip_._x = x_;
clip_._y = (y_ - (_local8 * 3)) - (_local6 * 5);
if (tick > 100) {
_local3 = true;
}
return(_local3);
}
function endShowScore() {
clip_.removeMovieClip();
var _local2 = 0;
while (_local2 < numNumbers_) {
numbers_[_local2].removeMovieClip();
_local2++;
}
}
static var SPACING = 0;
}