Frame 1
stop();
Frame 2
stop();
Frame 4
_global.current_game;
_global.current_level;
_global.stage_min_x = 0;
_global.stage_max_x = 400;
_global.stage_min_y = 20;
_global.stage_max_y = 380;
_global.flash_id = _root.id;
MovieClip.prototype.empty = function () {
for (var k in this) {
if (typeof(this[k]) == "movieclip") {
this[k].removeMovieClip();
}
}
};
_global.set_time_left = function (p) {
_root.time_bar.bar_mask._x = -390 * p;
};
_global.add_points = function (num) {
_global.current_game.points = _global.current_game.points + num;
_root.points_label.text = current_game.points;
};
this.onEnterFrame = function () {
if (current_game.play_on) {
_global.current_level.time_left--;
if (current_level.time_left > 0) {
set_time_left(current_level.time_left / current_level.time);
} else if (current_level.time_left == 0) {
set_time_left(0);
current_level.time_left = -1;
_root.attachMovie("police_car", "police_car", 1);
_root.police_car._x = -100;
_root.police_car._y = 200;
}
}
};
_global.check_score = function (points) {
_root.attachMovie("load_scores_window", "scores_window", 2);
_root.scores_window._x = 200;
_root.scores_window._y = 200;
_global.focus = _root.scores_window;
var sender = new LoadVars();
var loader = new LoadVars();
sender.flash_id = _global.flash_id;
sender.points = points;
sender.sendAndLoad("/aan/flash/check_score.php", loader, "GET");
loader.onLoad = function (load_success) {
_root.scores_window.removeMovieClip();
_global.focus = _root;
if (load_success && (this.success)) {
_root.onScoreChecked(this.is_high_score);
} else {
_root.attachMovie("error_window", "error_window", 2);
_root.error_window._x = 200;
_root.error_window._y = 200;
_root.error_window.onRetry = function () {
_root.error_window.removeMovieClip();
_global.check_score(points);
};
_root.error_window.onCancel = function () {
_root.error_window.removeMovieClip();
_root.onScoreChecked(0);
};
}
};
};
_global.load_scores = function () {
_root.attachMovie("load_scores_window", "scores_window", 2);
_root.scores_window._x = 200;
_root.scores_window._y = 200;
_global.focus = _root.scores_window;
var sender = new LoadVars();
var loader = new LoadVars();
sender.flash_id = _global.flash_id;
sender.sendAndLoad("/aan/flash/get_scores.php", loader, "GET");
loader.onLoad = function (load_success) {
_root.scores_window.removeMovieClip();
_global.focus = _root;
if (load_success && (this.success)) {
var scores = new Array();
var k = 0;
while (this["name" + k].length > 0) {
scores[k] = new Array();
scores[k].name = this["name" + k];
scores[k].points = this["points" + k];
scores[k].date = this["date" + k];
k++;
}
_root.onScoresLoaded(scores);
} else {
_root.attachMovie("error_window", "error_window", 2);
_root.error_window._x = 200;
_root.error_window._y = 200;
_root.error_window.onRetry = function () {
_root.error_window.removeMovieClip();
_global.load_scores();
};
_root.error_window.onCancel = function () {
_root.error_window.removeMovieClip();
_root.onScoresLoaded(new Array());
};
}
};
};
_global.submit_score = function (name, points) {
_root.attachMovie("submit_score_window", "submit_score_window", 2);
var mc = _root.submit_score_window;
mc._x = 200;
mc._y = 200;
_global.focus = mc;
var sender = new LoadVars();
var loader = new LoadVars();
sender.flash_id = _global.flash_id;
sender.name = name;
sender.points = points;
sender.sendAndLoad("/aan/flash/submit_score.php", loader, "GET");
loader.onLoad = function (load_success) {
_root.submit_score_window.removeMovieClip();
_global.focus = _root;
if (load_success && (this.success)) {
_root.gotoAndStop("high_scores");
} else {
_root.attachMovie("error_window", "error_window", 2);
_root.error_window._x = 200;
_root.error_window._y = 200;
_root.error_window.onRetry = function () {
_root.error_window.removeMovieClip();
_global.submit_score(name, points);
};
_root.error_window.onCancel = function () {
_root.error_window.removeMovieClip();
};
}
};
};
_global.Game = function () {
this.lives = 3;
this.points = 0;
this.play_on = false;
};
_global.Level = function (level_num) {
this.id = level_num;
this.is_clear = false;
this.time_left = (this.time = 500);
this.people_left = 0;
this.won = false;
this.last = false;
_global.current_game.play_on = false;
_root.attachMovie("bus", "bus", 0);
_root.bus._x = 200;
_root.bus._y = 200;
_root.attachMovie("start_level_window", "start_level_window", 1);
_root.start_level_window._x = 200;
_root.start_level_window._y = 200;
_root.level_num.text = this.id;
_root.lives_meter.gotoAndStop("lives" + current_game.lives);
_root.points_label.text = current_game.points;
};
Level.prototype.add_people = function (num_people, max_v, acc) {
var k = this.people_left;
while (k < (this.people_left + num_people)) {
var symbol = ((Math.random() > 0.5) ? "man" : "woman");
_root.people.attachMovie(symbol, "person" + k, k);
var mc = _root.people["person" + k];
do {
var x = (mc.min_x + (Math.random() * (mc.max_x - mc.min_x)));
var y = (mc.min_y + (Math.random() * (mc.max_y - mc.min_y)));
} while (_root.bus.hitTest(x, y, true));
mc._x = x;
mc._y = y;
mc.max_v = max_v;
mc.acc = acc;
k++;
}
this.people_left = this.people_left + num_people;
};
Level.prototype.kill_person = function () {
this.people_left--;
add_points(100);
if (this.people_left <= 0) {
this.is_clear = true;
_root.end_area.gotoAndPlay("end");
}
};
Level.prototype.win = function () {
this.won = true;
_global.current_game.play_on = false;
_root.gotoAndStop(("level" + this.id) + "_end");
_root.attachMovie("win_level_window", "win_level_window", 3);
_root.win_level_window._x = 200;
_root.win_level_window._y = 200;
};
Level.prototype.lose = function () {
this.won = false;
_global.current_game.lives--;
_global.current_game.play_on = false;
_root.gotoAndStop(("level" + this.id) + "_end");
_root.attachMovie("lose_window", "lose_window", 3);
_root.lose_window._x = 200;
_root.lose_window._y = 200;
};
Level.prototype.end = function () {
_root.people.empty();
_root.bus.removeMovieClip();
_root.police_car.removeMovieClip();
_root.end_area.gotoAndStop("start");
set_time_left(1);
if (this.won) {
if (!this.last) {
_root.gotoAndStop("level" + (this.id + 1));
} else {
_root.gotoAndStop("end_game");
_root.end_message.gotoAndStop("you_win");
}
} else if (current_game.lives >= 0) {
_root.gotoAndStop("level" + this.id);
} else {
_root.gotoAndStop("end_game");
_root.end_message.gotoAndStop("game_over");
}
};
_global.Person = function () {
this.max_v = 5;
this.max_x = stage_max_x - 8;
this.min_x = stage_min_x + 8;
this.max_y = stage_max_y - 8;
this.min_y = stage_min_y + 8;
this.vx = this.max_v - (2 * Math.floor(Math.random() * this.max_v));
this.vy = this.max_v - (2 * Math.floor(Math.random() * this.max_v));
this._rotation = ((180 * Math.atan2(this.vy, this.vx)) / Math.PI) + 90;
this.is_alive = true;
this.acc = 2;
this.death_sound = "man_scream";
};
Person.prototype = new MovieClip();
Person.prototype.onEnterFrame = function () {
if (this.is_alive && (current_game.play_on)) {
if (_root.bus.hitTest(this._x, this._y, true)) {
this.is_alive = false;
this.gotoAndStop("dead");
var new_depth = this.getDepth();
for (var k in _root.people) {
var mc = _root.people[k];
if (mc.is_alive && (mc.getDepth() < new_depth)) {
new_depth = mc.getDepth();
}
}
this.swapDepths(new_depth);
var snd = new Sound(this);
if (Math.random() > 0.5) {
snd.attachSound(this.death_sound);
} else if (Math.random() > 0.5) {
snd.attachSound("timmy");
} else {
snd.attachSound("splat");
}
snd.start();
current_level.kill_person();
} else {
var new_vx = this.vx;
var new_vy = this.vy;
var dx = ((this._x + this.vx) - _root.bus._x);
var dy = ((this._y + this.vy) - _root.bus._y);
var dist = Math.sqrt((dx * dx) + (dy * dy));
if ((dist < 50) && (dist > 0)) {
new_vx = new_vx + ((dx * this.acc) / dist);
new_vy = new_vy + ((dy * this.acc) / dist);
}
var v = Math.sqrt((this.vx * this.vx) + (this.vy * this.vy));
var new_v = Math.min(v, this.max_v);
new_vx = new_vx * (new_v / v);
new_vy = new_vy * (new_v / v);
if ((this._x + new_vx) >= this.max_x) {
this._x = ((2 * this.max_x) - this._x) - new_vx;
this.vx = -new_vx;
} else if ((this._x + new_vx) <= this.min_x) {
this._x = ((2 * this.min_x) - this._x) - new_vx;
this.vx = -new_vx;
} else {
this._x = this._x + new_vx;
this.vx = new_vx;
}
if ((this._y + new_vy) >= this.max_y) {
this._y = ((2 * this.max_y) - this._y) - new_vy;
this.vy = -new_vy;
} else if ((this._y + new_vy) <= this.min_y) {
this._y = ((2 * this.min_y) - this._y) - new_vy;
this.vy = -new_vy;
} else {
this._y = this._y + new_vy;
this.vy = new_vy;
}
this._rotation = ((180 * Math.atan2(this.vy, this.vx)) / Math.PI) + 90;
}
}
};
_global.Man = function () {
super();
};
Man.prototype = new Person();
Object.registerClass("man", Man);
_global.Woman = function () {
super();
this.death_sound = "woman_scream";
};
Woman.prototype = new Person();
Object.registerClass("woman", Woman);
_global.Vehicle = function () {
this.vx = 0;
this.vy = 0;
this.acc = 1;
this.drot = 10;
this.internal_friction = 0.3;
this.collision_friction = 0.7;
this.max_v = 12;
this.tire_friction = 0.3;
};
Vehicle.prototype = new MovieClip();
Vehicle.prototype.change_pos = function (dir) {
var bus_rot = ((this._rotation * Math.PI) / 180);
var sine = Math.sin(bus_rot);
var cosine = Math.cos(bus_rot);
var v = Math.sqrt((this.vx * this.vx) + (this.vy * this.vy));
var new_vx = ((1 - this.tire_friction) * this.vx);
var new_vy = ((1 - this.tire_friction) * this.vy);
var theta = Math.abs(Math.atan2(this.vy, this.vx) - bus_rot);
var inertia_x = ((this.tire_friction * v) * cosine);
var inertia_y = ((this.tire_friction * v) * sine);
if ((theta < (Math.PI/2)) || ((theta > 4.71238898038469) && (theta <= (Math.PI*2)))) {
new_vx = new_vx + inertia_x;
new_vy = new_vy + inertia_y;
} else {
new_vx = new_vx - inertia_x;
new_vy = new_vy - inertia_y;
}
new_vx = new_vx + ((dir * this.acc) * cosine);
new_vy = new_vy + ((dir * this.acc) * sine);
var new_v = Math.sqrt((new_vx * new_vx) + (new_vy * new_vy));
new_v2 = Math.max(0, new_v - this.internal_friction);
new_v2 = Math.min(new_v2, this.max_v);
if (new_v != 0) {
new_vx = new_vx * (new_v2 / new_v);
new_vy = new_vy * (new_v2 / new_v);
} else {
new_vx = 0;
new_vy = 0;
}
var bounds = this.getBounds(_root);
if ((bounds.xMax + new_vx) >= stage_max_x) {
this._x = this._x + ((2 * (stage_max_x - bounds.xMax)) - new_vx);
this.vx = (-new_vx) * this.collision_friction;
} else if ((bounds.xMin + new_vx) <= stage_min_x) {
this._x = this._x + ((2 * (stage_min_x - bounds.xMin)) - new_vx);
this.vx = (-new_vx) * this.collision_friction;
} else {
this._x = this._x + new_vx;
this.vx = new_vx;
}
if ((bounds.yMax + new_vy) >= stage_max_y) {
this._y = this._y + ((2 * (stage_max_y - bounds.yMax)) - new_vy);
this.vy = (-new_vy) * this.collision_friction;
} else if ((bounds.yMin + new_vy) <= stage_min_y) {
this._y = this._y + ((2 * (stage_min_y - bounds.yMin)) - new_vy);
this.vy = (-new_vy) * this.collision_friction;
} else {
this._y = this._y + new_vy;
this.vy = new_vy;
}
};
_global.Bus = function () {
super();
this._rotation = -90;
};
Bus.prototype = new Vehicle();
Object.registerClass("bus", Bus);
Bus.prototype.onEnterFrame = function () {
if (current_game.play_on) {
if (Key.isDown(37) && ((this.vx != 0) || (this.vy != 0))) {
this._rotation = this._rotation - this.drot;
}
if (Key.isDown(39) && ((this.vx != 0) || (this.vy != 0))) {
this._rotation = this._rotation + this.drot;
}
var dir = 0;
if (Key.isDown(38)) {
dir++;
}
if (Key.isDown(40)) {
dir--;
}
if (Key.isDown(17) && (Key.isDown(68))) {
_global.current_game.lives = 0;
}
this.change_pos(dir);
if (current_level.is_clear && (_root.end_area.hitTest(this._x, this._y, false))) {
_global.current_level.win();
}
}
};
PoliceCar = function () {
super();
this.on_stage = false;
this.vx = 12;
var siren = new Sound(this);
siren.attachSound("polic_siren");
siren.start();
};
PoliceCar.prototype = new Vehicle();
Object.registerClass("police_car", PoliceCar);
PoliceCar.prototype.onEnterFrame = function () {
if (current_game.play_on) {
if (this.on_stage) {
var point = {x:_root.bus._x, y:_root.bus._y};
this.globalToLocal(point);
var theta = Math.atan2(point.y, point.x);
var min_theta = (((Math.PI * this.drot) / 180) / 2);
_root.theta = theta;
_root.min_theta = min_theta;
if (theta > min_theta) {
this._rotation = this._rotation + this.drot;
} else if (theta < (-min_theta)) {
this._rotation = this._rotation - this.drot;
}
this.change_pos(1);
point = {x:_root.bus._x, y:_root.bus._y};
this.globalToLocal(point);
if (Math.sqrt((point.x * point.x) + (point.y * point.y)) < 70) {
_global.current_level.lose();
}
} else {
this._x = this._x + this.max_v;
if (this._x > 40) {
this.on_stage = true;
}
}
}
};
Frame 5
_global.current_game = new Game();
Frame 6
_global.current_level = new Level(1);
current_level.add_people(6, 5, 2);
stop();
Frame 8
_global.current_level = new Level(2);
current_level.add_people(7, 5, 2);
stop();
Frame 10
_global.current_level = new Level(3);
current_level.add_people(7, 7, 2);
stop();
Frame 12
_global.current_level = new Level(4);
current_level.add_people(8, 7, 3);
stop();
Frame 14
_global.current_level = new Level(5);
current_level.add_people(8, 9, 3);
stop();
Frame 16
_global.current_level = new Level(6);
current_level.add_people(9, 9, 3);
stop();
Frame 18
_global.current_level = new Level(7);
current_level.add_people(9, 11, 4);
stop();
Frame 20
_global.current_level = new Level(8);
current_level.add_people(10, 11, 4);
stop();
Frame 22
_global.current_level = new Level(9);
current_level.add_people(10, 13, 4);
stop();
Frame 24
_global.current_level = new Level(10);
_global.current_level.last = true;
current_level.add_people(11, 13, 5);
stop();
Frame 26
stop();
_root.points_text = current_game.points;
_root.onScoreChecked = function (is_high_score) {
if (is_high_score) {
_root.gotoAndStop("submit_score");
} else {
_root.gotoAndStop("no_submit");
}
};
_global.check_score(_global.current_game.points);
Frame 29
_root.onScoresLoaded = function (scores) {
var k = 0;
while (k < scores.length) {
_root.scores_mc.attachMovie("score_line", "score_line" + k, k);
var mc = _root.scores_mc["score_line" + k];
mc._x = 0;
mc._y = k * 25;
mc.id = k + 1;
mc.name = scores[k].name;
mc.points = scores[k].points;
mc.date = scores[k].date;
k++;
}
};
load_scores();
Symbol 25 MovieClip [woman] Frame 1
Symbol 25 MovieClip [woman] Frame 8
if (this.is_alive) {
gotoAndPlay (2);
}
Symbol 25 MovieClip [woman] Frame 9
stop();
Symbol 32 MovieClip [man] Frame 1
Symbol 32 MovieClip [man] Frame 8
if (this.is_alive) {
gotoAndPlay (2);
}
Symbol 32 MovieClip [man] Frame 9
stop();
Symbol 36 MovieClip [lose_window] Frame 1
_global.focus = this;
Symbol 36 MovieClip [lose_window] Frame 68
current_level.end();
_global.focus = _root;
this.removeMovieClip();
Symbol 42 Button
on (release) {
this.onRetry();
}
Symbol 45 Button
on (release) {
this.onCancel();
}
Symbol 49 MovieClip [submit_score_window] Frame 1
stop();
Symbol 52 MovieClip [load_scores_window] Frame 1
stop();
Symbol 58 MovieClip [win_level_window] Frame 1
_global.focus = this;
Symbol 58 MovieClip [win_level_window] Frame 65
time_left = Math.max(_global.current_level.time_left, 0);
total_points = _global.current_game.points;
multiplier = 5;
Symbol 58 MovieClip [win_level_window] Frame 85
if (time_left > 0) {
var new_points = 0;
if (time_left > 5) {
time_left = time_left - 5;
new_points = 5 * multiplier;
} else {
new_points = multiplier * time_left;
time_left = 0;
}
total_points = total_points + new_points;
add_points(new_points);
} else {
gotoAndPlay (87);
}
Symbol 58 MovieClip [win_level_window] Frame 86
gotoAndPlay (85);
Symbol 58 MovieClip [win_level_window] Frame 110
current_level.end();
_global.focus = _root;
this.removeMovieClip();
Symbol 67 MovieClip [start_level_window] Frame 1
stop();
_global.focus = this;
level_num = _global.current_level.id;
Key.addListener(this);
this.onKeyUp = function () {
this.gotoAndPlay("countdown");
};
Symbol 67 MovieClip [start_level_window] Frame 2
this.onKeyUp = null;
Symbol 67 MovieClip [start_level_window] Frame 62
_global.current_game.play_on = true;
_global.focus = _root;
this.removeMovieClip();
Symbol 79 MovieClip Frame 1
this.onEnterFrame = function () {
var bytes_loaded = _root.getBytesLoaded();
var bytes_total = _root.getBytesTotal();
if (bytes_loaded >= bytes_total) {
_root.gotoAndStop("loaded");
} else {
this.bar_mask._x = -200 * (1 - (bytes_loaded / bytes_total));
}
};
Symbol 89 Button
on (release) {
_root.gotoAndStop("instructions");
}
Symbol 90 Button
on (release) {
_root.gotoAndPlay("init");
}
Symbol 103 MovieClip Frame 1
stop();
this.hitArea = hit_area;
hit_area._visible = false;
Symbol 103 MovieClip Frame 16
gotoAndPlay (2);
Symbol 114 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 1
stop();
Symbol 122 MovieClip Frame 2
stop();
Symbol 128 Button
on (release) {
if (_global.focus == _root) {
_root.gotoAndPlay("new_game");
}
}
Symbol 131 Button
on (release) {
if (_global.focus == _root) {
_root.gotoAndStop("high_scores");
}
}
Symbol 139 Button
on (release) {
if ((_root.name.length > 0) && (_global.focus == _root)) {
_global.submit_score(_root.name, _global.current_game.points);
}
}