Frame 1
function startPressed() {
count = maxCount;
t.text = getCountDownMessage();
countdown = setInterval(countDownTimer, 1000);
}
function playAgain() {
startButton._visible = true;
}
function countDownTimer() {
if ((--count) == 0) {
clearInterval(countdown);
init();
} else {
t.text = getCountDownMessage();
}
}
function getCountDownMessage() {
var _local1 = "starting in " + count;
return(_local1);
}
function init() {
x = 16896;
q = [];
m = [];
createEmptyMovieClip("s", (w = 0));
e = 2 * ((m[x - 520] = 2 * ((r = 1))));
ready = true;
Key.addListener(t);
onEnterFrame = frameHandler;
}
function reset() {
ready = false;
delete onEnterFrame;
removeMovieClip("s");
Key.removeListener(t);
}
function frameHandler() {
if (ready) {
c = q.pop();
if ((c % 2) != (r % 2)) {
if (c != undefined) {
r = c;
}
}
x = x + ([-1, -65, 1, 65][r] * 8);
if ((((m[x] == 1) or (isNaN(m[x]) and (m[x] != undefined))) or (!(x % 520))) or (!(int(x / 520) % 33))) {
t.text = t.text + "\tGAME OVER!";
score = (((w - ((e = e - 5))) - 2) * 2) - 8;
MindJoltAPI.service.submitScore(score, null, playAgain);
reset();
return(undefined);
}
with (s.createEmptyMovieClip(w, w)) {
beginFill(16711680);
if (w++) {
beginFill(5592456);
}
_x = x % 520;
_y = int(x / 520) * 8;
lineTo(-7, 0);
lineTo(-7, -7);
lineTo(0, -7);
endFill();
}
m[x] = m[x] + 1;
if (m[x] == 3) {
t.text = "Score: " + (((w - ((e = e - 5))) - 2) * 2);
do {
do {
} while (m[(c = ((s[0]._x = 8 + (random(64) * 8))) + (((s[0]._y = 8 + (random(32) * 8))) * 65))]);
} while (isNaN(m[c]) and (m[c] != undefined));
m[c] = 2;
}
if (e) {
c = s[e];
delete m[c._x + (65 * c._y)];
removeMovieClip(c);
}
e++;
}
}
MindJoltAPI.service.connect("SSBQ5P0TZ9DFBE5F");
if (_level0.mj_sig_network == "minifb-snake") {
var ad_finished = function () {
};
var ad_started = function () {
};
MindJoltAPI.ad.showPreGameAd({ad_started:ad_started, ad_finished:ad_finished});
}
var ready = false;
var countdown;
var count;
var maxCount = 3;
createTextField("t", 1, 1, 255, 511, 32);
t.text = "";
beginFill(15658734);
lineStyle(1);
lineTo(511, 0);
lineTo(511, 256);
lineTo(0, 256);
endFill();
startButton.onPress = function () {
startButton._visible = false;
startPressed();
};
t.onKeyDown = function () {
var _local1 = Key.getCode();
switch (_local1) {
case 87 :
k = 38;
break;
case 65 :
k = 37;
break;
case 83 :
k = 40;
break;
case 68 :
k = 39;
break;
default :
k = _local1;
}
c = k - 37;
if (!(c >> 2)) {
if (c != q[0]) {
q.unshift(c);
}
return(undefined);
}
};
Symbol 11 MovieClip [__Packages.MindJoltAPI] Frame 0
class MindJoltAPI
{
static var clip, options, gameKey, callback;
function MindJoltAPI () {
}
static function showPreGameAd(options) {
if (clip.mindjolt_api_service == undefined) {
trace("[MindJoltAPI] You must call MindJoltAPI.service.connect before MindJoltAPI.ad.showPreGameAd.");
}
if (options == null) {
options = {};
}
if (service.showPreGameAd != undefined) {
service.showPreGameAd(options);
} else {
MindJoltAPI.options = options;
if (options.ad_started == null) {
((options.clip != null) ? (options.clip) : _root).stop();
}
}
}
static function load_service_complete() {
if (clip.mindjolt_api_service.service != null) {
service = clip.mindjolt_api_service.service;
trace("[MindJoltAPI] service successfully loaded");
service.connect(gameKey, clip, callback);
if (options != null) {
service.recordAction(("showPreGameAd(" + options) + ");");
service.showPreGameAd(options);
}
service.getLogger().info(("MindJoltAPI loader version [" + version) + "]");
} else {
trace("[MindJoltAPI] failed to load.");
}
}
static function connect(gameKey, clip, callback) {
MindJoltAPI.gameKey = gameKey;
MindJoltAPI.clip = ((clip != null) ? (clip) : _root);
MindJoltAPI.callback = callback;
if (service.submitScore == undefined) {
System.security.allowDomain("static.mindjolt.com");
var _local3 = MindJoltAPI.clip.createEmptyMovieClip("mindjolt_api_service", 10000);
var _local4 = ((_level0.mjPath != undefined) ? (_level0.mjPath) : "http://static.mindjolt.com/api/as2/api_local_as2.swf");
var _local2 = new MovieClipLoader();
_local2.addListener({onLoadInit:load_service_complete, onLoadError:load_service_complete});
_local2.loadClip(_local4, _local3);
}
}
static var service = {connect:connect};
static var ad = {showPreGameAd:showPreGameAd};
static var version = "1.0.3";
}