Frame 65
stop();
Main.main();
Symbol 20 MovieClip [hammer] Frame 1
stop();
Symbol 31 MovieClip [mole] Frame 1
stop();
Symbol 31 MovieClip [mole] Frame 6
stop();
Symbol 31 MovieClip [mole] Frame 12
stop();
Symbol 31 MovieClip [mole] Frame 14
stop();
Symbol 35 MovieClip [star] Frame 10
stop();
Symbol 94 MovieClip [__Packages.Main] Frame 0
class Main extends MovieClip
{
var __proto__, hit1, hit2, hit3, miss, pop1, pop2, music, bg, attachMovie, getNextHighestDepth, moles, click_to_play, getURL, dialog, box, scoreboard_lv, hammer, star, time, ref_listener, _xmouse, _ymouse, final_score;
function Main (base) {
super();
base.__proto__ = __proto__;
base.__constructor__ = Main;
this=base;//parameter overwritten
Object.registerClass("mole", mole);
hit1 = new Sound();
hit1.attachSound("hit_1");
hit2 = new Sound();
hit2.attachSound("hit_2");
hit3 = new Sound();
hit3.attachSound("hit_3");
miss = new Sound();
miss.attachSound("miss");
pop1 = new Sound();
pop1.attachSound("mole_1");
pop2 = new Sound();
pop2.attachSound("mole_2");
music = new Sound();
music.attachSound("music");
music.start();
music.onSoundComplete = function () {
this.start();
};
bg = attachMovie("bg", "bg", getNextHighestDepth());
moles = new Array();
var _local5 = 0;
var _local6 = 0;
var _local4 = 0;
while (_local4 < 9) {
var _local3 = attachMovie("mole", "mole" + _local4, getNextHighestDepth());
_local3.addEventListener("mole_hides", mx.utils.Delegate.create(this, setTimeNextMole));
_local3._x = (_local5 * 124) + 80;
_local3._y = (_local6 * 98) + 105;
_local5++;
if (_local5 > 2) {
_local5 = 0;
_local6++;
}
moles.push(_local3);
_local4++;
}
playIntro();
}
function playIntro() {
onIntro = true;
click_to_play = attachMovie("play", "click_to_play", getNextHighestDepth());
click_to_play._x = 200;
click_to_play._y = 200;
click_to_play.btn_play.onRelease = mx.utils.Delegate.create(this, clickedToPlay);
click_to_play.btn_links.onRelease = mx.utils.Delegate.create(this, clickedLinks);
}
function clickedLinks() {
(getURL("http://www.gamebrew.com/", "_blank"));// not popped
}
function highScoreMainMenu() {
dialog.removeMovieClip();
box.removeMovieClip();
if (!onIntro) {
restart();
}
}
function highScoreNext10() {
page = page + 10;
if (page > maxScore) {
page = maxScore;
}
if (page > (maxScore - 20)) {
dialog.btn_next10._visible = false;
}
dialog.btn_last10._visible = true;
showScores();
}
function highScoreLast10() {
page = page - 10;
if (page < 0) {
page = 0;
}
if (page < 10) {
dialog.btn_last10._visible = false;
}
dialog.btn_next10._visible = true;
showScores();
}
function highScoresLoad(success) {
trace("cargo hscore" + success);
if (success) {
if (Boolean(scoreboard_lv.success)) {
dialog.btn_next10._visible = true;
if (scoreboard_lv.maxScore.length > 0) {
maxScore = Number(scoreboard_lv.maxScore);
}
showScores();
}
}
}
function showScores() {
var _local2 = 10;
while (_local2 > 0) {
var _local5 = scoreboard_lv["name" + (page + _local2)];
var _local4 = scoreboard_lv["score" + (page + _local2)];
var _local3 = dialog[("line" + _local2) + "_mc"];
_local3.rank_txt.text = (page + _local2) + ".";
_local3.name_txt.text = (_local5.length ? (_local5.toUpperCase()) : "-");
_local3.score_txt.text = (_local4.length ? (_local4) : "-");
_local3._visible = true;
_local2--;
}
}
function clickedToPlay() {
click_to_play.removeMovieClip();
startGame();
}
function startGame() {
game_over = false;
onIntro = false;
var _local2;
_local2 = Math.floor(Math.random() * 9);
var _local3;
_local3 = (Math.random() * 500) + 500;
moles[_local2].setAppearTime(_local3);
_local2 = Math.floor(Math.random() * 9);
_local3 = (Math.random() * 1000) + 1000;
while (moles[_local2].getIsSetToAppear()) {
_local2 = Math.floor(Math.random() * 9);
}
moles[_local2].setAppearTime(_local3);
_local2 = Math.floor(Math.random() * 9);
_local3 = (Math.random() * 1500) + 1000;
while (moles[_local2].getIsSetToAppear()) {
_local2 = Math.floor(Math.random() * 9);
}
moles[_local2].setAppearTime(_local3);
_local2 = Math.floor(Math.random() * 9);
_local3 = (Math.random() * 1000) + 2000;
while (moles[_local2].getIsSetToAppear()) {
_local2 = Math.floor(Math.random() * 9);
}
moles[_local2].setAppearTime(_local3);
hammer = attachMovie("hammer", "hammer", getNextHighestDepth());
star = attachMovie("star", "star", getNextHighestDepth());
star._visible = false;
Mouse.hide();
time = new com.sismostudio.timer.timer(1000, "time_out", 30);
ref_listener = mx.utils.Delegate.create(this, updateTime);
time.addEventListener("time_out", ref_listener);
bg.txt_time.text = "0:30";
bg.txt_hit.text = 0;
}
function onMouseDown() {
var _local3 = false;
if (!game_over) {
hammer.play();
var _local2 = 0;
while (_local2 < moles.length) {
if (moles[_local2].getVisible() && (!moles[_local2].getWhacked())) {
if (hammer.hit_area.hitTest(moles[_local2].hit_area)) {
moles[_local2].setWhacked(true);
hits++;
bg.txt_hit.text = hits;
star._x = hammer._x - 25;
star._y = hammer._y;
star._visible = true;
star.play();
_local3 = true;
}
}
_local2++;
}
if (_local3) {
var _local4 = Math.ceil(Math.random() * 3);
this["hit" + _local4].start();
} else {
misses++;
miss.start();
}
}
}
function onMouseMove() {
if (!game_over) {
hammer._x = _xmouse;
hammer._y = _ymouse;
}
}
function setTimeNextMole(evtObject) {
var _local2;
var _local3;
if (!game_over) {
_local2 = Math.floor(Math.random() * 9);
_local3 = (Math.random() * 2500) + 500;
while (moles[_local2].getIsSetToAppear()) {
_local2 = Math.floor(Math.random() * 9);
}
moles[_local2].setAppearTime(_local3);
}
}
function updateTime(objEvent) {
var _local3 = objEvent.tick;
var _local4;
var _local2;
if (objEvent.message == "tick") {
_local4 = Math.floor(_local3 / 60).toString();
_local2 = (_local3 % 60).toString();
if (_local2.length < 2) {
_local2 = "0" + _local2;
}
bg.txt_time.text = (_local4 + ":") + _local2;
} else {
bg.txt_time.text = "0:00";
game_over = true;
Mouse.show();
gameOver();
}
}
function gameOver() {
var _local2 = 0;
while (_local2 < moles.length) {
moles[_local2].stopMole();
_local2++;
}
time.removeEventListener("time_out", ref_listener);
final_score = attachMovie("final_score", "final_score", getNextHighestDepth());
final_score._x = 200;
final_score._y = 200;
final_score.txt_hits.text = hits;
final_score.txt_miss.text = misses;
score = hits - misses;
final_score.txt_score.text = score;
final_score.btn_enter.onRelease = mx.utils.Delegate.create(this, sendAndRestart);
}
function sendAndRestart() {
name = final_score.txt_name.text;
delete final_score.btn_enter.onRelease;
final_score.removeMovieClip();
restart();
}
function restart() {
hits = 0;
misses = 0;
score = 0;
name = "";
page = 0;
delete time;
hammer.removeMovieClip();
star.removeMovieClip();
playIntro();
}
static function main() {
var _local2 = new Main(_root);
}
var page = 0;
var maxScore = 100;
var name = "";
var hits = 0;
var misses = 0;
var game_over = true;
var score = 0;
var onIntro = false;
}
Symbol 95 MovieClip [__Packages.com.sismostudio.timer.timer] Frame 0
class com.sismostudio.timer.timer
{
var tipo_evento, nolimit, ticks, timeInt, dispatchEvent;
function timer (len, tipo, ticks) {
mx.events.EventDispatcher.initialize(this);
tipo_evento = tipo;
if (ticks == -1) {
nolimit = true;
this.ticks = 0;
} else {
this.ticks = ticks;
}
timeInt = setInterval(mx.utils.Delegate.create(this, handleTimer), len);
}
function handleTimer() {
if (!onPause) {
var _local2;
if (nolimit) {
ticks++;
} else {
ticks--;
if (ticks > 0) {
_local2 = "tick";
} else if (ticks == 0) {
_local2 = "timeout";
clearInterval(timeInt);
}
}
dispatchEvent({type:tipo_evento, target:this, message:_local2, tick:ticks, time:getTimer()});
}
}
function setOnPause(onPause) {
this.onPause = onPause;
}
var onPause = false;
}
Symbol 96 MovieClip [__Packages.mx.events.EventDispatcher] Frame 0
class mx.events.EventDispatcher
{
function EventDispatcher () {
}
static function _removeEventListener(queue, event, handler) {
if (queue != undefined) {
var _local4 = queue.length;
var _local1;
_local1 = 0;
while (_local1 < _local4) {
var _local2 = queue[_local1];
if (_local2 == handler) {
queue.splice(_local1, 1);
return(undefined);
}
_local1++;
}
}
}
static function initialize(object) {
if (_fEventDispatcher == undefined) {
_fEventDispatcher = new mx.events.EventDispatcher();
}
object.addEventListener = _fEventDispatcher.addEventListener;
object.removeEventListener = _fEventDispatcher.removeEventListener;
object.dispatchEvent = _fEventDispatcher.dispatchEvent;
object.dispatchQueue = _fEventDispatcher.dispatchQueue;
}
function dispatchQueue(queueObj, eventObj) {
var _local7 = "__q_" + eventObj.type;
var _local4 = queueObj[_local7];
if (_local4 != undefined) {
var _local5;
for (_local5 in _local4) {
var _local1 = _local4[_local5];
var _local3 = typeof(_local1);
if ((_local3 == "object") || (_local3 == "movieclip")) {
if (_local1.handleEvent != undefined) {
_local1.handleEvent(eventObj);
}
if (_local1[eventObj.type] != undefined) {
if (exceptions[eventObj.type] == undefined) {
_local1[eventObj.type](eventObj);
}
}
} else {
_local1.apply(queueObj, [eventObj]);
}
}
}
}
function dispatchEvent(eventObj) {
if (eventObj.target == undefined) {
eventObj.target = this;
}
this[eventObj.type + "Handler"](eventObj);
dispatchQueue(this, eventObj);
}
function addEventListener(event, handler) {
var _local3 = "__q_" + event;
if (this[_local3] == undefined) {
this[_local3] = new Array();
}
_global.ASSetPropFlags(this, _local3, 1);
_removeEventListener(this[_local3], event, handler);
this[_local3].push(handler);
}
function removeEventListener(event, handler) {
var _local2 = "__q_" + event;
_removeEventListener(this[_local2], event, handler);
}
static var _fEventDispatcher = undefined;
static var exceptions = {move:1, draw:1, load:1};
}
Symbol 97 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 98 MovieClip [__Packages.mole] Frame 0
class mole extends MovieClip
{
var appear_interval, gotoAndPlay, disappear_interval, dispatchEvent, _name, gotoAndStop;
function mole () {
super();
mx.events.EventDispatcher.initialize(this);
trace("anda el trace");
}
function appear() {
clearInterval(appear_interval);
visible = true;
(gotoAndPlay("appears"));// not popped
var _local3;
_local3 = (Math.random() * 1000) + 500;
disappear_interval = setInterval(this, "disappear", _local3);
var _local4 = Math.ceil(Math.random() * 2);
_root["pop" + _local4].start();
}
function disappear() {
clearInterval(disappear_interval);
(gotoAndPlay("disappears"));// not popped
visible = false;
isSetToAppear = false;
whacked = false;
dispatchEvent({type:"mole_hides", mole:_name});
}
function setAppearTime(time) {
if (!visible) {
appear_interval = setInterval(this, "appear", time);
isSetToAppear = true;
}
}
function getVisible() {
return(visible);
}
function getIsSetToAppear() {
return(isSetToAppear);
}
function getWhacked() {
return(whacked);
}
function setWhacked(whacked) {
clearInterval(disappear_interval);
this.whacked = whacked;
(gotoAndPlay("whacked"));// not popped
disappear_interval = setInterval(this, "disappear", 500);
}
function stopMole() {
clearInterval(disappear_interval);
clearInterval(appear_interval);
visible = false;
isSetToAppear = false;
whacked = false;
(gotoAndStop("stop"));// not popped
}
var visible = false;
var whacked = false;
var isSetToAppear = false;
}