Frame 1
stop();
_root.link.onPress = function () {
getURL ("http://www.johnnyslack.com", "_blank");
};
onEnterFrame = function () {
perLoaded = (getBytesLoaded() / getBytesTotal()) * 100;
_root.percent.text = Math.round(perLoaded) + "%";
if (perLoaded > 20) {
prePlant1.gotoAndPlay(2);
}
if (perLoaded > 40) {
prePlant2.gotoAndPlay(2);
}
if (perLoaded > 60) {
prePlant3.gotoAndPlay(2);
}
if (perLoaded > 80) {
prePlant4.gotoAndPlay(2);
if (perLoaded == 100) {
_root.percent.text = "Play PYORO";
_root.playButton.onPress = function () {
_root.gotoAndPlay(2);
};
delete onEnterFrame;
}
}
};
Frame 2
function loadScores() {
scoresXML = new XML();
scoresXML.ignoreWhite = true;
scoresXML.load("xml/scores.xml?num=" + random(200000000));
scoresXML.onLoad = function () {
_root.beginGame();
};
}
function beginGame() {
s = new com.Screen();
b = new com.Bird();
_root.highScoreTxt.text = s.getHighScore(_root.scoresXML);
var i = 0;
do {
tmpB = new com.Block();
s.addBlock(tmpB);
i = i + tmpB._width;
} while (i < (screenWidth - tmpB._width));
i = 0;
_root.screen.blocks.onEnterFrame = function () {
if (Key.isDown(37) && (b._shooting == false)) {
_root.b.moveLeft();
} else if (Key.isDown(39) && (b._shooting == false)) {
_root.b.moveRight();
} else if (Key.isDown(32) && (b._moving == false)) {
if (b._waitForRelease == false) {
b.shoot();
}
} else if (b._moving) {
b.stop();
} else if (b._shooting) {
b.disarm(false);
} else if (b._waitForRelease) {
b._waitForRelease = false;
}
};
onEnterFrame = function () {
i++;
if (i > s._gameSpeed) {
dropPlant();
i = 0;
}
};
}
function dropPlant() {
tmpP = new com.Plant();
s.addPlant(tmpP);
}
function gameOver() {
gameOverSound = new Sound();
gameOverSound.attachSound("die");
gameOverSound.start();
j = 0;
while (j < _root.s._plants.length) {
var _local3 = _root.s._plants[j];
var _local2 = _root.screen.plants[_local3._clip];
delete _local2.onEnterFrame;
removeMovieClip(_local2);
j++;
}
delete _root.onEnterFrame;
_root.b.stop();
_root.screen.attachMovie("screenMask", "sm", _root.screen.getNextHighestDepth());
var _local4 = new mx.transitions.Tween(_root.screen.sm, "_alpha", "", 0, 75, 10);
_root.s.getRank();
}
function enterName(index) {
_root.screen.sm.attachMovie("highScore", "hs", 0);
_root.screen.sm.hs.hsTxt.setFocus();
_root.screen.sm.hs._x = 180;
_root.screen.sm.hs._y = 180;
_root.screen.sm.hs.hsButton.onPress = function () {
if (_root.screen.sm.hs.hsTxt.text != "") {
_root.s.sendScores(_root.scoreTxt.text, _root.screen.sm.hs.hsTxt.text);
} else {
_root.screen.sm.hs.hsTxt.text = "No Name";
}
};
}
function playAgain() {
_root.screen.sm.attachMovie("playAgain", "pa", 0);
_root.screen.sm.pa._x = 160;
_root.screen.sm.pa._y = 180;
_root.screen.sm.pa.onPress = function () {
var _local2 = _root.screen.darkness;
var _local3 = new mx.transitions.Tween(_local2, "_alpha", "", _local2._alpha, 0, 10);
removeMovieClip(_root.screen.sm);
_root.loadScores();
};
}
stop();
var screenWidth = _root.screen._width;
loadScores();
_root.soundToggle.onPress = function () {
_root.soundToggle.volumeOn._visible = !_root.soundToggle.volumeOn._visible;
if (_root.soundToggle.volumeOn._visible) {
_root.s._curVolume = 100;
} else {
_root.s._curVolume = 0;
}
};
Symbol 10 MovieClip [bird] Frame 2
var feet = new Sound();
feet.attachSound("feet");
feet.setVolume(_root.s._curVolume);
feet.start();
Symbol 21 MovieClip [tmpScore] Frame 1
function blink() {
mc._visible = !mc._visible;
i++;
if (i == 5) {
clearInterval(intID);
removeMovieClip(mc);
}
}
var intID = setInterval(blink, 100);
var i = 0;
var mc = this;
Symbol 26 MovieClip [angel] Frame 10
box = new Sound();
box.attachSound("boxSound");
box.setVolume(_root.s._curVolume);
box.start();
Symbol 26 MovieClip [angel] Frame 20
trace(this);
removeMovieClip(this);
Symbol 54 MovieClip [plantPreload] Frame 1
this.preloadplant.stop();
stop();
Symbol 54 MovieClip [plantPreload] Frame 2
this.preloadplant.play();
Symbol 54 MovieClip [plantPreload] Frame 20
gotoAndPlay (2);
Symbol 80 MovieClip [__Packages.com.Plant] Frame 0
class com.Plant
{
var _clip;
function Plant () {
}
function drop() {
var p = this;
var mc = _root.screen.plants[_clip];
mc.onEnterFrame = function () {
mc._y = mc._y + p._speed;
if (mc._y >= (_root.screen.blocks._y - mc._height)) {
var _local6 = mc.plant.hitter.hitTest(_root.screen.bird);
var _local5 = mc.plant.hitter.hitTest(_root.screen.shootingBird);
if (_local6 or _local5) {
_root.gameOver();
}
var _local2;
_local2 = 0;
while (_local2 < _root.s._blocks.length) {
var _local4 = mc.plant.hitter.hitTest(_root.screen.blocks["block" + _local2]);
if (_local4) {
var _local3 = _root.screen.blocks["block" + _local2];
_root.s._missingBlocks[_root.s._missingBlocks.length] = _local2;
if ((_local3._x > _root.b._x) && (_local3._x < (_root.b._xBoundR * 20))) {
_root.b._xBoundR = _local2;
} else if ((_local3._x < _root.b._x) && ((_local3._x + _local3._width) > (_root.b._xBoundL * 20))) {
_root.b._xBoundL = _local2;
}
p.removeFromList();
p.remove();
removeMovieClip(_local3);
break;
}
_local2++;
}
if (mc._y > (_root.screen.blocks._y + mc._height)) {
p.removeFromList();
p.remove();
}
}
};
}
function removeFromList() {
var _local3;
_local3 = 0;
while (_local3 < _root.s._plants.length) {
if (_root.s._plants[_local3]._clip == _clip) {
_root.s._plants.splice(_local3, 1);
}
_local3++;
}
}
function remove() {
var _local3 = _root.screen.plants[_clip];
delete _local3.onEnterFrame;
removeMovieClip(_local3);
}
}
Symbol 81 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
}
Symbol 82 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
}
Symbol 83 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 84 MovieClip [__Packages.com.Screen] Frame 0
class com.Screen
{
var _blocks, _plants, _missingBlocks;
function Screen () {
_blocks = new Array();
_plants = new Array();
_missingBlocks = new Array();
_root.screen.attachMovie("tounge", "tounge", 5);
_root.screen.attachMovie("toungeMask", "toungeMask", 6);
_root.screen.tounge.setMask(_root.screen.toungeMask);
_root.screen.tounge._visible = false;
_root.scoreTxt.text = _score;
}
function addBlock(tmpB, index) {
_blocks[_blocks.length] = tmpB;
if (index == null) {
var _local3 = _blocks.length - 1;
} else {
var _local3 = index;
}
_root.screen.blocks.attachMovie("block", "block" + _local3, _local3);
var _local4 = _local3 * tmpB._width;
_root.screen.blocks["block" + _local3]._x = _local4;
}
function addPlant(tmpP) {
_plants[_plants.length] = tmpP;
var _local7 = _upid;
tmpP._clip = "plant" + _upid;
_root.screen.plants.attachMovie("greenPlant", "plant" + _upid, _upid);
var _local5 = random(100);
if ((_local5 % 20) == 0) {
tmpP._type = 1;
var _local6 = new Color(_root.screen.plants[tmpP._clip].plant.top);
_local6.setRGB(13395609);
_local6 = new Color(_root.screen.plants[tmpP._clip].plant.bottom);
_local6.setRGB(16777215);
} else if (_local5 == 6) {
tmpP._type = 2;
var _local6 = new Color(_root.screen.plants[tmpP._clip].plant.top);
_local6.setRGB(16764006);
_local6 = new Color(_root.screen.plants[tmpP._clip].plant.bottom);
_local6.setRGB(16777215);
} else {
tmpP._type = 0;
}
if (((_gameSpeed > 7) && ((_upid % 25) == 0)) && (_upid != 0)) {
var _local4 = _root.screen.darkness;
var _local9 = new mx.transitions.Tween(_local4, "_alpha", "", _local4._alpha, _local4._alpha + 15, 50);
_gameSpeed = _gameSpeed - 4;
}
tmpP._speed = (70 / _gameSpeed) + (random(5) + 1);
var _local8 = random(_root.screenWidth - 20);
_root.screen.plants["plant" + _local7]._x = _local8;
_upid++;
tmpP.drop();
}
function setScore(s, x, y, index, color) {
_score = s + _score;
_root.scoreTxt.text = _score;
_root.screen.attachMovie("tmpScore", "tmpScore" + index, _root.screen.getNextHighestDepth());
_root.screen["tmpScore" + index]._x = x;
_root.screen["tmpScore" + index]._y = y;
_root.screen["tmpScore" + index].tmpScoreTxt.textColor = color;
_root.screen["tmpScore" + index].tmpScoreTxt.text = s;
}
function getHighScore(scores) {
var _local2 = scores.childNodes[0];
var _local1 = Number(_local2.childNodes[0].attributes.score);
return(_local1);
}
function getRank() {
var _local2;
var _local4 = _root.scoresXML.childNodes[0];
var _local3 = -1;
_local2 = 0;
while (_local2 < _local4.childNodes.length) {
if (_root.s._score > Number(_local4.childNodes[_local2].attributes.score)) {
_local3 = _local2;
_root.enterName(_local3);
break;
}
_local2++;
}
if (_local3 == -1) {
_root.playAgain();
}
}
function summonAngel() {
var _local4 = "angel" + _root.screen.getNextHighestDepth();
_root.screen.attachMovie("angel", _local4, _root.screen.getNextHighestDepth());
var _local3;
_local3 = 0;
while (_local3 < _root.s._missingBlocks.length) {
if (_root.b._xBoundL == _root.s._missingBlocks[_local3]) {
_root.screen[_local4]._x = _root.s._missingBlocks[_local3] * 20;
replaceBlock(_local3, _root.screen[_local4], "left");
break;
}
if (_root.b._xBoundR == _root.s._missingBlocks[_local3]) {
_root.screen[_local4]._x = _root.s._missingBlocks[_local3] * 20;
replaceBlock(_local3, _root.screen[_local4], "right");
break;
}
_local3++;
}
}
function summonAllAngels() {
var tmpMissingBlocks = new Array();
tmpMissingBlocks = _root.s._missingBlocks;
_root.s._missingBlocks = new Array();
var i = 0;
_root.screen.onEnterFrame = function () {
if (i < tmpMissingBlocks.length) {
var mc = ("angel" + _root.screen.getNextHighestDepth());
_root.screen.attachMovie("angel", mc, _root.screen.getNextHighestDepth());
_root.screen[mc]._x = tmpMissingBlocks[i] * 20;
var blockNum = tmpMissingBlocks[i];
_root.screen[mc].onEnterFrame = function () {
if (_root.screen[mc].angel._y > 300) {
var _local2 = new com.Block();
_root.s.addBlock(_local2, blockNum);
_root.b._xBoundL = -1;
_root.b._xBoundR = 20;
delete _root.screen[mc].onEnterFrame;
}
};
i++;
} else {
delete _root.screen.onEnterFrame;
}
};
}
function replaceBlock(blockIndex, angelClip, side) {
var _local4 = 20;
var blockNum = _root.s._missingBlocks[blockIndex];
var highLimit = 20;
var lowLimit = -1;
var _local6 = blockNum * _local4;
_root.s._missingBlocks.splice(blockIndex, 1);
angelClip.onEnterFrame = function () {
if (angelClip.angel._y > 300) {
var _local3 = new com.Block();
_root.s.addBlock(_local3, blockNum);
if (_root.s._missingBlocks.length == 0) {
_root.b._xBoundL = -1;
_root.b._xBoundR = 20;
} else {
var _local2;
_local2 = 0;
while (_local2 < _root.s._missingBlocks.length) {
if (side == "left") {
if (_root.s._missingBlocks[_local2] < blockNum) {
lowLimit = Math.max(lowLimit, _root.s._missingBlocks[_local2]);
}
} else if (side == "right") {
if (_root.s._missingBlocks[_local2] > blockNum) {
highLimit = Math.min(highLimit, _root.s._missingBlocks[_local2]);
}
}
_local2++;
}
if (side == "left") {
_root.b._xBoundL = lowLimit;
} else if (side == "right") {
_root.b._xBoundR = highLimit;
}
}
}
};
}
function sendScores(score, user) {
var _local1 = new LoadVars();
_local1.score = score;
_local1.user = user;
_local1.send("dumpScores.php", "", "POST");
}
var _gameSpeed = 26;
var _upid = 0;
var _score = 0;
var _curVolume = 100;
}
Symbol 85 MovieClip [__Packages.com.Block] Frame 0
class com.Block
{
function Block () {
}
var _width = 20;
}
Symbol 86 MovieClip [__Packages.com.Bird] Frame 0
class com.Bird
{
var _y;
function Bird () {
_root.screen.attachMovie("bird", "bird", 10);
_root.screen.bird._y = _root.screen.blocks._y - _root.screen.bird._height;
_root.screen.bird._x = _x;
stop();
}
function moveRight() {
if (_root.screen.bird._x < (_xBoundR * 20)) {
_dir = 100;
_root.screen.bird._xscale = _dir;
_root.screen.bird._x = _root.screen.bird._x + _speed;
_x = _root.screen.bird._x;
play();
}
}
function moveLeft() {
if (_root.screen.bird._x > ((_xBoundL * 20) + 20)) {
_dir = -100;
_root.screen.bird._xscale = _dir;
_root.screen.bird._x = _root.screen.bird._x - _speed;
_x = _root.screen.bird._x;
play();
}
}
function stop() {
_moving = false;
_root.screen.bird.stop();
}
function play() {
_moving = true;
_root.screen.bird.play();
}
function shoot() {
_shooting = true;
if (_root.screen.bird) {
_x = _root.screen.bird._x;
_y = _root.screen.bird._y;
_root.screen.attachMovie("shootingBird", "shootingBird", 10);
_root.screen.shootingBird._xscale = _dir;
_root.screen.shootingBird._x = _x;
_root.screen.shootingBird._y = _y;
_root.screen.tounge._x = _x;
_root.screen.tounge._y = _y;
}
_root.screen.tounge._xscale = _dir;
_root.screen.tounge._visible = true;
if (((_root.screen.tounge._x < 400) && (_root.screen.tounge._x > 0)) && (_root.screen.tounge._y > 0)) {
if (_dir == -100) {
_root.screen.tounge._x = _root.screen.tounge._x - _shootingSpeed;
} else {
_root.screen.tounge._x = _root.screen.tounge._x + _shootingSpeed;
}
_root.screen.tounge._y = _root.screen.tounge._y - _shootingSpeed;
var _local3;
_local3 = 0;
while (_local3 < _root.s._plants.length) {
var _local4 = _root.screen.plants[_root.s._plants[_local3]._clip];
var _local5 = _root.screen.tounge.hitter.hitTest(_local4);
if (_local5) {
eat(_local3);
break;
}
_local3++;
}
} else {
disarm(true);
}
}
function disarm(auto) {
if (auto == true) {
b._waitForRelease = true;
}
var b = this;
b._shooting = false;
_root.screen.tounge._xscale = b._dir;
_root.screen.tounge.onEnterFrame = function () {
if (_root.screen.tounge._y < 300) {
if (b._dir == -100) {
_root.screen.tounge._x = _root.screen.tounge._x + 200;
} else {
_root.screen.tounge._x = _root.screen.tounge._x - 200;
}
_root.screen.tounge._y = _root.screen.tounge._y + 200;
} else {
delete _root.screen.tounge.onEnterFrame;
_root.screen.tounge._visible = false;
var _local3 = _root.screen.shootingBird._x;
var _local2 = _root.screen.shootingBird._y;
_root.screen.attachMovie("bird", "bird", 10);
_root.screen.bird._xscale = b._dir;
_root.screen.bird._x = _local3;
_root.screen.bird._y = _local2;
b.stop();
}
};
}
function eat(i) {
var p = _root.s._plants[i];
var _local3 = _root.screen.plants[p._clip];
p.removeFromList();
delete _local3.onEnterFrame;
var _local4 = new Sound();
_local4.attachSound("eat");
_local4.setVolume(_root.s._curVolume);
_local4.start();
if (_local3._y < 150) {
_root.s.setScore(300, _local3._x, _local3._y, i, "0x00ff00");
} else if (_local3._y < 200) {
_root.s.setScore(100, _local3._x, _local3._y, i, "0xffffff");
} else if (_local3._y < 300) {
_root.s.setScore(50, _local3._x, _local3._y, i, "0x0000ff");
} else {
_root.s.setScore(10, _local3._x, _local3._y, i, "0xff0000");
}
if ((p._type == 1) && (_root.s._missingBlocks.length > 0)) {
_root.s.summonAngel();
} else if ((p._type == 2) && (_root.s._missingBlocks.length > 0)) {
_root.s.summonAllAngels();
}
var _local7 = _root.screen.shootingBird;
var _local11 = Math.abs(_local3._x - _local3._x);
var _local10 = Math.abs(_local3._y - _local3._y);
var _local6 = new mx.transitions.Tween(_local3, "_y", "", _local3._y, _local7._y, 2);
var _local8 = new mx.transitions.Tween(_local3, "_x", "", _local3._x, _local7._x, 2);
if (_local6 > _local8) {
var _local9 = _local6;
} else {
var _local9 = _local8;
}
_local9.onMotionFinished = function () {
p.remove();
};
disarm(true);
}
var _speed = 10;
var _dir = -100;
var _shooting = false;
var _shootingSpeed = 30;
var _moving = false;
var _waitForRelease = false;
var _xBoundL = -1;
var _xBoundR = 20;
var _x = 200;
}
Symbol 79 MovieClip Frame 1