Frame 1
function toggle_sound(ss) {
sound_state = ss;
global_sound.setVolume(100 * (sound_state == "on"));
}
function play_sound(id, vol, loop) {
if (sound_lev == undefined) {
sound_lev = 0;
}
sound_lev++;
sound_lev = sound_lev % 16;
sounds.createEmptyMovieClip("fx_" + id, sound_lev);
root["fx_" + id] = new Sound(sounds["fx_" + id]);
root["fx_" + id].attachSound(id);
root["fx_" + id].setVolume(vol);
root["fx_" + id].start(0, loop);
}
function check_fx_on() {
for (cf in sounds) {
temp_label = cf.toString();
}
}
function play_music(id, vol) {
if (root[id + "_state"] != "on") {
if (music_lev == undefined) {
music_lev = 0;
}
music_lev++;
music_lev = music_lev % 16;
sounds.createEmptyMovieClip(id, 200 + music_lev);
root[id] = new Sound(sounds[id]);
root[id].attachSound(id);
root[id].setVolume(vol);
root[id].start(0, 1000000);
root[id + "_state"] = "on";
}
}
function stop_music(id) {
root[id + "_state"] = "off";
root[id].stop();
}
function move_sound(char, action) {
switch (action) {
case "start" :
sounds.createEmptyMovieClip(char + "_move", 100 + (char == "you"));
root[char + "_move"] = new Sound(sounds[char + "_move"]);
root[char + "_move"].attachSound("move");
root[char + "_move"].setVolume(100);
root[char + "_move"].start(0, 1000000);
root[char + "_move_sound"] = true;
break;
case "stop" :
root[char + "_move"].stop();
root[char + "_move_sound"] = false;
}
}
global_sound = new Sound();
function start_key_combo() {
combo_timer = combo_duration - 1;
key_object = createEmptyMovieClip(you, 1010);
key_object.onEnterFrame = function () {
key_up = Key.isDown(38);
key_down = Key.isDown(40);
key_left = Key.isDown(37);
key_right = Key.isDown(39);
key_z = Key.isDown(90);
key_x = Key.isDown(88);
if ((((((key_up && (!key_up_pressed)) || (key_down && (!key_down_pressed))) || (key_left && (!key_left_pressed))) || (key_right && (!key_right_pressed))) || (key_z && (!key_z_pressed))) || (key_x && (!key_x_pressed))) {
if (you._xscale == -100) {
switch (the_key_on) {
case "right" :
the_key = "forward";
break;
case "left" :
the_key = "back";
break;
default :
the_key = the_key_on;
}
} else {
switch (the_key_on) {
case "right" :
the_key = "back";
break;
case "left" :
the_key = "forward";
break;
default :
the_key = the_key_on;
}
}
for (sc in key_combo[you.character]) {
ideal_key = key_combo[you.character][sc].combo[key_log];
if ((ideal_key == the_key) && (combo_possibles[sc] != "bad")) {
if ((key_log + 1) == key_combo[you.character][sc].combo.length) {
combo = true;
combo_check(you, key_combo[you.character][sc]);
}
}
if (ideal_key != the_key) {
combo = false;
combo_possibles[sc] = "bad";
}
}
key_press = true;
combo_timer = 0;
key_log++;
combo_bads = 0;
for (cb in combo_possibles) {
combo_bads = combo_bads + (combo_possibles[cb] == "bad");
}
if (combo_bads == combo_possibles.length) {
reset_combo_keys();
}
if (key_right) {
key_right_pressed = true;
}
if (key_left) {
key_left_pressed = true;
}
root[("key_" + the_key_on) + "_pressed"] = true;
}
combo_timer++;
if (combo_timer == combo_duration) {
reset_combo_keys();
}
if (!combo) {
if (key_z && (!key_z_press)) {
key_z_press = true;
basic_move("punch", you);
}
if (key_x && (!key_x_press)) {
key_x_press = true;
basic_move("kick", you);
}
if (key_down && (!key_down_press)) {
key_down_press = true;
basic_move("block", you);
}
if (key_up && (!key_up_press)) {
key_up_press = true;
basic_move("jump", you);
}
if ((!key_down) && (key_down_press)) {
key_down_press = false;
if (you.animation == "block") {
release_block(you);
}
}
if ((!key_z) && (key_z_press)) {
key_z_press = false;
}
if ((!key_x) && (key_x_press)) {
key_x_press = false;
}
if ((!key_up) && (key_up_press)) {
key_up_press = false;
}
}
};
key_listener = new Object();
key_listener.onKeyDown = function () {
switch (Key.getCode()) {
case 37 :
the_key_on = "left";
return;
case 38 :
the_key_on = "up";
return;
case 39 :
the_key_on = "right";
return;
case 40 :
the_key_on = "down";
return;
case 88 :
the_key_on = "x";
return;
case 90 :
the_key_on = "z";
}
};
key_listener.onKeyUp = function () {
key_left_pressed = false;
key_right_pressed = false;
key_up_pressed = false;
key_down_pressed = false;
key_z_pressed = false;
key_x_pressed = false;
};
Key.addListener(key_listener);
}
function stop_key_combo() {
key_object.removeMovieClip();
Key.removeListener(key_listener);
key_up = false;
key_down = false;
key_left = false;
key_right = false;
key_z = false;
key_x = false;
reset_combo_keys();
}
function reset_combo_keys() {
combo = false;
key_log = 0;
combo_possibles = new Array(key_combo[you.character].length);
}
function reset_combo_wait(type_of, trg_name) {
root[(type_of + "_") + trg_name] = false;
}
function combo_check(trg, obj) {
no_combo = false;
if (!no_combo) {
switch (trg.animation) {
case "ready" :
case "move" :
case "run" :
case "block" :
case "kick" :
case "punch" :
trg.animation = obj.type;
check_animation(trg);
body_cycle(trg);
if (trg.data.transform_state == "transformed") {
trg.data.transform_state = "waiting";
}
special_dark(trg._name);
switch (obj.my_class) {
case "exception_01" :
trg.body.land_x = trg.enemy.ix;
beam_me_up(trg);
break;
case "projectile" :
case "static" :
trg.body.launch_x = trg.enemy.ix;
wait_for_trigger(trg, obj);
break;
case "normal" :
setup_detection(trg, "combo", obj);
break;
case "transform" :
trg.animation = "transform";
check_animation(trg);
body_cycle(trg);
wait_for_transform(trg, obj);
}
}
}
}
key_combo = {};
key_combo.noah = [{type:"the_dove", combo:["back", "forward", "z"], my_class:"projectile"}, {type:"flash_flood", combo:["forward", "back", "forward"], my_class:"static"}, {type:"stampede", combo:["down", "back", "forward", "z"], my_class:"projectile", keep:true, resulting:["fall", "wait"]}];
key_combo.moses = [{type:"stone_tablet", combo:["forward", "down", "z"], my_class:"projectile"}, {type:"burning_bush", combo:["back", "down", "forward", "z"], my_class:"normal"}, {type:"frog_rain", combo:["forward", "forward", "down", "down", "x"], my_class:"static", resulting:["fall", "wait"]}];
key_combo.eve = [{type:"apple_toss", combo:["down", "forward", "z"], my_class:"projectile"}, {type:"snake_charmer", combo:["back", "back", "forward"], my_class:"normal"}, {type:"muddy_uppercut", combo:["down", "down", "up"], my_class:"static", resulting:["fall", 2]}];
key_combo.jesus = [{type:"thorn_toss", combo:["down", "forward", "z"], my_class:"projectile"}, {type:"cross_smash", combo:["down", "back", "forward", "z"], my_class:"normal", resulting:["fall", 2]}, {type:"fish_loaves", combo:["down", "down", "down", "z"], my_class:"static"}];
key_combo.mary = [{type:"halo_toss", combo:["down", "forward", "z"], my_class:"projectile"}, {type:"baby_toss", combo:["forward", "back", "forward", "z"], my_class:"normal"}, {type:"immaculate_deception", combo:["down", "down", "up"], my_class:"exception_01"}];
key_combo.satan = [{type:"pitchfork_fireball", combo:["down", "forward", "z"], my_class:"projectile"}, {type:"tail_whip", combo:["down", "back", "x"], my_class:"normal"}, {type:"headed_dog", combo:["forward", "down", "back", "z", "x"], my_class:"normal", resulting:["fall", "wait"]}];
key_combo.god = [{type:"lightning_strike", combo:["down", "down", "back", "forward", "z"], my_class:"static", resulting:["fall", "wait"]}, {type:"god_slap", combo:["back", "down", "forward"], my_class:"normal", resulting:["fall", 2]}, {type:"eve", combo:["down", "down", "z", "z"], my_class:"transform"}, {type:"noah", combo:["down", "down", "z", "x"], my_class:"transform"}, {type:"moses", combo:["down", "down", "z", "up"], my_class:"transform"}, {type:"mary", combo:["down", "down", "z", "down"], my_class:"transform"}, {type:"satan", combo:["down", "down", "z", "forward"], my_class:"transform"}, {type:"jesus", combo:["down", "down", "z", "back"], my_class:"transform"}];
function make_camera() {
camera = all.createEmptyMovieClip("camera", 1000);
camera_limit = (back_max - stage_w) * 0.5;
camera_slide = 0.05;
camera_target = you;
all._x = 0;
camera.onEnterFrame = move_camera;
}
function move_camera() {
root_coord_x = camera_target._x + back._x;
this.adjust_x = ((camera_target._xscale == 100) - (camera_target._xscale == -100)) * 100;
this.pot_x = ((-root_coord_x) + (stage_w * 0.5)) + this.adjust_x;
this.pot_x = Math.min(Math.max(this.pot_x, -camera_limit), camera_limit);
this.movement = (this.pot_x - all._x) * camera_slide;
all._x = all._x + this.movement;
behind._x = -all._x;
}
function shake() {
all.count = 0;
all.wave = 20;
all.onEnterFrame = function () {
this.count = this.count + 1;
this.shake = Math.sin(this.count) * this.wave;
this.wave = this.wave * 0.9;
this._y = int(this.shake);
if (this.wave < 1) {
delete this.onEnterFrame;
this._y = 0;
}
};
}
function transform_god(god_trg, obj) {
delete god_trg.onEnterFrame;
delete god_trg.body.onEnterFrame;
old_health = god_trg.data.health;
old_health_max = god_trg.data.health_max;
old_wins = god_trg.data.wins;
char = god_trg._name;
switch (char) {
case "you" :
you_character = obj.type;
you = characters[you_character].attachMovie(you_character, "you", 200);
the_scale = god_trg._xscale;
you._x = god_trg._x;
you.x = you._x;
you.enemy = cpu;
cpu.enemy = you;
you.data = {};
set_character("you", you);
for (b in config.you[you_character]) {
you.data[b] = config.you[you_character][b];
}
you.data.health = old_health;
you.data.health_max = old_health_max;
you.data.wins = old_wins;
you.data.transform_state = "transformed";
you._xscale = the_scale;
camera_target = you;
break;
case "cpu" :
trg.auto_pilot.removeMovieClip();
transform_options = ["eve", "noah", "moses", "mary", "satan", "jesus"];
cpu_character = transform_options[int(Math.random() * transform_options.length)];
while (cpu_character == you_character) {
cpu_character = transform_options[int(Math.random() * transform_options.length)];
}
cpu = characters[cpu_character].attachMovie(cpu_character, "cpu", 100);
the_scale = god_trg._xscale;
cpu._x = god_trg._x;
cpu.x = cpu._x;
cpu.enemy = you;
you.enemy = cpu;
cpu.data = {};
set_character("cpu", cpu);
for (b in config.cpu[game_mode][cpu_character]) {
cpu.data[b] = config.cpu[game_mode][cpu_character][b];
}
cpu.data.health = old_health;
cpu.data.health_max = old_health_max;
cpu.data.wins = old_wins;
cpu.data.transform_state = "transformed";
cpu._xscale = the_scale;
auto_start(cpu);
cpu.auto_pilot.type = "offence";
cpu.auto_direction = (you._x > cpu._x) - (you._x < cpu._x);
cpu.auto_pilot.attack_timer = int((cpu.data.hit_wait * fps) * 0.5);
}
}
function turn_back(trg) {
delete trg.onEnterFrame;
delete trg.body.onEnterFrame;
old_health = trg.data.health;
old_health_max = trg.data.health_max;
old_wins = trg.data.wins;
delete trg.data.transform_state;
char = god_trg._name;
set_interval("remove_old", 1, [trg]);
switch (trg._name) {
case "you" :
you_character = "god";
you = characters.god.you;
the_scale = trg._xscale;
you._x = trg._x;
you.x = you._x;
you.enemy = cpu;
cpu.enemy = you;
you.data = {};
set_character("you", you);
for (b in config.you[you_character]) {
you.data[b] = config.you[you_character][b];
}
you.data.health = old_health;
you.data.health_max = old_health_max;
you.data.wins = old_wins;
you.animation = "transform";
you.gotoAndStop("transform");
you.body.gotoAndPlay("return");
you._xscale = the_scale;
body_cycle(you);
if (cpu.data.health == 0) {
trace("during you win");
}
camera_target = you;
break;
case "cpu" :
trg.auto_pilot.removeMovieClip();
cpu_character = "god";
cpu = characters.god.cpu;
the_scale = trg._xscale;
cpu._x = trg._x;
cpu.x = cpu._x;
cpu.enemy = you;
you.enemy = cpu;
cpu.data = {};
set_character("cpu", cpu);
for (b in config.cpu[game_mode][cpu_character]) {
cpu.data[b] = config.cpu[game_mode][cpu_character][b];
}
cpu.data.health = old_health;
cpu.data.health_max = old_health_max;
cpu.data.wins = old_wins;
cpu.animation = "transform";
cpu.gotoAndStop("transform");
cpu.body.gotoAndPlay("return");
cpu._xscale = the_scale;
auto_start(cpu);
body_cycle(cpu);
if (!((you.data.health == 0) || (clock.round_time <= 0))) {
break;
}
trace("during cpu win");
delete cpu.auto_pilot.onEnterFrame;
}
}
function quick_turn_back(trg) {
delete trg.onEnterFrame;
delete trg.body.onEnterFrame;
old_health = trg.data.health;
old_health_max = trg.data.health_max;
old_wins = trg.data.wins;
delete trg.data.transform_state;
char = god_trg._name;
switch (trg._name) {
case "you" :
you_character = "god";
you = characters.god.you;
the_scale = trg._xscale;
you._x = trg._x;
you.x = you._x;
you.enemy = cpu;
cpu.enemy = you;
you.data = {};
set_character("you", you);
for (b in config.you[you_character]) {
you.data[b] = config.you[you_character][b];
}
you.data.health = old_health;
you.data.health_max = old_health_max;
you.data.wins = old_wins;
you.animation = "ready";
you.gotoAndStop("ready");
you._xscale = the_scale;
if (cpu.data.health == 0) {
trace("during you win");
}
camera_target = you;
break;
case "cpu" :
trg.auto_pilot.removeMovieClip();
cpu_character = "god";
cpu = characters.god.cpu;
the_scale = trg._xscale;
cpu._x = trg._x;
cpu.x = cpu._x;
cpu.enemy = you;
you.enemy = cpu;
cpu.data = {};
set_character("cpu", cpu);
for (b in config.cpu[game_mode][cpu_character]) {
cpu.data[b] = config.cpu[game_mode][cpu_character][b];
}
cpu.data.health = old_health;
cpu.data.health_max = old_health_max;
cpu.data.wins = old_wins;
cpu.animation = "ready";
cpu.gotoAndStop("ready");
cpu._xscale = the_scale;
auto_start(cpu);
if (you.data.health != 0) {
break;
}
trace("during cpu win");
delete cpu.auto_pilot.onEnterFrame;
}
remove_old(trg);
}
function remove_old(trg) {
trg.removeMovieClip();
}
function wait_for_trigger(trg, obj) {
trigger = trg.body.createEmptyMovieClip("trigger", 1040);
trigger.obj = obj;
trigger.onEnterFrame = function () {
if (this._parent.projectile != undefined) {
place_projectile(this._parent._parent, this.obj, this._parent.projectile._x);
if (this._parent.projectile._x == undefined) {
this.removeMovieClip();
}
}
};
}
function wait_for_transform(trg, obj) {
trigger = trg.body.createEmptyMovieClip("trigger", 1040);
trigger.obj = obj;
trigger.onEnterFrame = function () {
if (this._parent.transform_ready) {
transform_god(this._parent._parent, this.obj);
this.removeMovieClip();
}
};
}
function beam_me_up(trg) {
trigger = trg.body.createEmptyMovieClip("trigger", 1040);
trigger.onEnterFrame = function () {
if (this._parent.projectile != undefined) {
beam_me_down(this._parent._parent, this._parent.land_x);
this.removeMovieClip();
}
};
}
function beam_me_down(trg, land_x) {
trg.gotoAndStop("jump");
trg.body.gotoAndStop("down");
trg.x = land_x + (100 * ((trg.ix < land_x) - (trg.ix > land_x)));
trg._y = -20;
trg.y = trg._y;
trg.max_speed = 0;
trg.acceleration = 0;
trg.shadow_start_y = trg.body.shadow._y;
jumper = trg.createEmptyMovieClip("jumper", 1050);
jumper.jump_vel = 0;
jumper.me = trg;
jumper.onEnterFrame = jump_logic;
}
function special_dark(trg_name) {
behind.attachMovie("special_dark", "special_dark", 200);
behind.special_dark.parent = trg_name;
}
function make_smoke(trg, type_of) {
pro_lev++;
pro_lev = pro_lev % 50;
smoke = effects.attachMovie(type_of + "_smoke", (type_of + "_smoke") + pro_lev, pro_lev + 200);
smoke._xscale = trg._xscale;
smoke._x = trg.ix;
smoke._y = ground;
smoke.onEnterFrame = projectile_hit_logic;
}
function place_projectile_hit(type_name, x, y) {
pro_lev++;
pro_lev = pro_lev % 50;
projectile_hit = effects.attachMovie(type_name + "_hit", (type_name + "_hit") + pro_lev, pro_lev + 300);
projectile_hit._x = x;
projectile_hit._y = y;
projectile_hit.onEnterFrame = projectile_hit_logic;
}
function projectile_hit_logic() {
if (this._currentframe == this._totalframes) {
this.removeMovieClip();
}
}
function place_projectile(trg, obj, launch_x) {
pro_lev++;
pro_lev = pro_lev % 50;
projectile = effects.attachMovie(trg.animation, trg.animation + pro_lev, pro_lev + 300);
if (trg.body.projectile._x == undefined) {
projectile_coord_x = trg.body.launch_x;
projectile_coord_y = ground;
} else {
projectile_coord_x = ((trg.body._x + trg.body.projectile._x) * (trg._xscale * 0.01)) + trg.ix;
projectile_coord_y = (trg.body._y + trg.body.projectile._y) + trg.iy;
}
projectile._xscale = trg._xscale;
projectile._x = projectile_coord_x;
projectile._y = projectile_coord_y;
projectile.character = "projectile";
if (trg._name == "you") {
projectile.speed = config[trg._name][trg.character][trg.animation + "_speed"] * (projectile._xscale * 0.01);
projectile.damage = config[trg._name][trg.character][trg.animation + "_damage"];
projectile.wave = config[trg._name][trg.character][trg.animation + "_distance"];
} else {
projectile.speed = config[trg._name][game_mode][trg.character][trg.animation + "_speed"] * (projectile._xscale * 0.01);
projectile.damage = config[trg._name][game_mode][trg.character][trg.animation + "_damage"];
projectile.wave = config[trg._name][game_mode][trg.character][trg.animation + "_distance"];
}
projectile.parent = trg;
projectile.coord = {};
projectile.obj = obj;
switch (obj.my_class) {
case "projectile" :
case "static" :
projectile.onEnterFrame = projectile_logic;
}
projectile_detect(projectile);
}
function projectile_logic() {
this._x = this._x - this.speed;
if ((((((this._x - this.attack._x) - (this._width * 0.5)) > back_max) && (this.speed < 0)) || ((((this._x - this.attack._x) + (this._width * 0.5)) < back_min) && (this.speed > 0))) || (this._currentframe == this._totalframes)) {
this.removeMovieClip();
}
get_projectile_coords(this);
}
function exception_01_logic() {
this.y = this.y - this.jump_vel;
this.jump_vel = this.jump_vel - gravity;
this.y = Math.min(this.y, ground);
this.iy = int(this.y);
this._y = this.iy;
if (this.iy == ground) {
this.gotoAndPlay("miss_land");
delete this.onEnterFrame;
set_interval("return_setup", 0.3, [this]);
this.detect.removeMovieClip();
}
get_projectile_coords(this);
}
function get_projectile_coords(trg) {
coord_x = (all._x + trg._x) + characters._x;
attack_coord_x = trg.attack._x * (trg._xscale * 0.01);
coord_y = (all._y + trg._y) + characters._y;
attack_coord_y = trg.attack._y;
trg.coord.attack = {x:coord_x + attack_coord_x, y:coord_y + attack_coord_y};
}
function projectile_detect(trg) {
detect = trg.createEmptyMovieClip("detect", 1020);
detect.resulting = trg.obj.resulting;
detect.enemy = trg.parent.enemy;
detect.onEnterFrame = function () {
this.attack_width = this._parent.attack._width;
this.attack_height = this._parent.attack._height;
this.attack_x = this._parent.coord.attack.x;
this.attack_y = this._parent.coord.attack.y;
this.enemy_width = this._parent.parent.enemy.body.hit._width;
this.enemy_height = this._parent.parent.enemy.body.hit._height;
this.enemy_x = this._parent.parent.enemy.coord.hit.x;
this.enemy_y = this._parent.parent.enemy.coord.hit.y;
this.hit_x = Math.abs(this.attack_x - this.enemy_x) - ((this.attack_width + this.enemy_width) * 0.5);
this.hit_y = Math.abs(this.attack_y - this.enemy_y) - ((this.attack_height + this.enemy_height) * 0.5);
if ((this.enemy._name == "cpu") && (!this.block_chance)) {
this.block_chance = true;
rnd = int(Math.random() * 100) + 1;
if (rnd <= this.enemy.data.block_chance) {
this.enemy.auto_direction = 0;
basic_move("block", this.enemy);
block_wait(this.enemy);
}
}
this.hit = (((this.hit_x <= 0) && (this.hit_y <= 0)) && (!isNaN(this.hit_x))) && (!isNaN(this.hit_y));
if (this.hit) {
if (!this.already_damaged) {
update_health(this._parent.parent.enemy, this._parent.damage, this._parent.parent.enemy.animation != "block", this.resulting, false);
this.already_damaged = true;
}
switch (this._parent.obj.my_class) {
case "projectile" :
place_projectile_hit(this._parent.obj.type, this._parent.parent.enemy.ix, this.attack_y);
if (!this._parent.obj.keep) {
this._parent.removeMovieClip();
} else {
this.removeMovieClip();
}
break;
case "static" :
place_projectile_hit(this._parent.obj.type, this._parent.parent.enemy.ix, this.attack_y);
this.removeMovieClip();
}
}
};
}
function stuck_fix(trg) {
if ((((trg.body._currentframe == 1) || ((trg._currentframe > 130) && (trg.jumper == undefined))) && (trg.data.health > 0)) && (trg.enemy.data.health > 0)) {
trg.frame_bug++;
if (trg.frame_bug >= 3) {
trace((((trg._name + " frame bug = ") + (trg.body._currentframe == 1)) + " / ") + ((trg._currentframe > 130) && (trg.jumper == undefined)));
trg.jumper.removeMovieClip();
trg.body.gotoAndStop("ready");
trg.animation = "ready";
trg.frame_bug = 0;
}
} else {
trg.frame_bug = 0;
}
}
function basic_move(pot_move, trg) {
switch (pot_move) {
case "kick" :
case "punch" :
switch (trg.animation) {
case "move" :
case "ready" :
case "run" :
make_move(trg, pot_move);
setup_detection(trg, "basic");
play_sound(pot_move, 100, 0);
if (trg.ix < trg.enemy.ix) {
trg._xscale = -100;
}
if (trg.ix <= trg.enemy.ix) {
break;
}
trg._xscale = 100;
}
case "block" :
if (trg.ix < trg.enemy.ix) {
trg._xscale = -100;
}
if (trg.ix > trg.enemy.ix) {
trg._xscale = 100;
}
make_move(trg, pot_move);
break;
case "jump" :
make_move(trg, pot_move);
}
}
function release_block(trg) {
trg.body.gotoAndPlay("release");
if (trg.auto_pilot != undefined) {
counter_attack(trg);
}
}
function check_obstruct(trg) {
block_dist = trg._x - trg.enemy._x;
cpu.blocked = false;
if (((trg.iy == ground) && (trg.enemy.iy == ground)) && (cpu.animation != "fall")) {
if ((block_dist > -80) && (block_dist < -45)) {
key_right = false;
if (cpu.auto_direction == -1) {
cpu.blocked = true;
}
}
if ((block_dist < 80) && (block_dist > 45)) {
key_left = false;
if (cpu.auto_direction == 1) {
cpu.blocked = true;
}
}
}
}
function check_jump(trg) {
if (((trg.hit_back == 0) && (trg.animation != "hit")) && (trg.animation != "fall")) {
if (trg.auto_pilot == undefined) {
}
jumper = trg.createEmptyMovieClip("jumper", 1050);
jumper.jump_vel = trg.data.jump_power;
play_sound("jump1", 100, 0);
trg.body.gotoAndPlay(1);
jumper.onEnterFrame = jump_wait;
}
}
function jump_wait() {
if (this._parent.body._currentframe == 3) {
delete this.onEnterFrame;
this._parent.max_speed = int(this._parent.data.run_speed * 0.75);
this._parent.speed = this._parent.max_speed * jumper._parent.jump_x;
this._parent.acceleration = this._parent.max_speed;
make_smoke(this._parent, "jump");
this.onEnterFrame = jump_logic;
}
if (this._parent.body._currentframe > 3) {
this._parent.body.gotoAndPlay(1);
}
}
function run_logic(trg) {
trg.run_timer = trg.run_timer + (trg.speed != 0);
if (trg.speed == 0) {
trg.run_timer = 0;
}
switch (trg.auto_pilot != undefined) {
case true :
trg.run = trg.auto_pilot.run && (trg.run_timer >= (run_duration * fps));
break;
case false :
trg.run = trg.run_timer >= (run_duration * fps);
}
if (trg.run) {
trg.max_speed = trg.data.run_speed;
if (trg.from == "move") {
trg.from = "run";
trg.speed = (trg.data.run_speed * (key_right - key_left)) * 0.5;
}
}
if (!trg.run) {
trg.max_speed = trg.data.move_speed;
if (trg.from == "run") {
trg.from = "move";
trg.speed = (trg.data.move_speed * (key_right - key_left)) * 0.5;
}
}
trg.acceleration = trg.max_speed * 0.5;
}
function get_coords(trg) {
coord_x = (all._x + trg.ix) + characters._x;
attack_coord_x = (trg.body._x + trg.body.attack._x) * (trg._xscale * 0.01);
hit_coord_x = (trg.body._x + trg.body.hit._x) * (trg._xscale * 0.01);
coord_y = (all._y + trg.iy) + characters._y;
attack_coord_y = trg.body._y + trg.body.attack._y;
hit_coord_y = trg.body._y + trg.body.hit._y;
trg.coord.attack = {x:coord_x + attack_coord_x, y:coord_y + attack_coord_y};
trg.coord.hit = {x:coord_x + hit_coord_x, y:coord_y + hit_coord_y};
}
function place_generic_hit(trg) {
generic_hit = effects.attachMovie("generic_hit", "genric_hit", effects.getNextHighestDepth());
generic_hit._x = trg._x;
if (trg.enemy.coord.attack.y == undefined) {
trg.enemy.coord.attack.y = trg._y - (trg.height * 0.5);
} else {
generic_hit._y = trg.enemy.coord.attack.y;
}
generic_hit.onEnterFrame = projectile_hit_logic;
}
function make_move(trg, pot_move) {
switch (trg.animation) {
case "move" :
case "ready" :
case "run" :
trg.animation = pot_move;
trg.old_animation = trg.animation;
trg.gotoAndStop(trg.animation);
if (pot_move == "jump") {
check_jump(trg);
} else {
body_cycle(trg);
}
trg.speed = 0;
trg.pot = 0;
}
}
function check_animation(trg) {
switch (trg.animation) {
case "move" :
case "ready" :
case "run" :
if (trg.speed == 0) {
trg.animation = "ready";
}
if (trg.speed == 0) {
break;
}
trg.animation = trg.from;
}
if (trg.animation != trg.old_animation) {
trg.old_animation = trg.animation;
trg.gotoAndStop(trg.animation);
}
scale_flip = (trg.animation == "move") || (trg.animation == "ready");
if (scale_flip) {
if (trg.ix < trg.enemy.ix) {
trg._xscale = -100;
}
if (trg.ix > trg.enemy.ix) {
trg._xscale = 100;
}
}
force_scale = (trg.animation == "run") || (trg.animation == "jump");
if (force_scale) {
if (trg.speed < 0) {
trg._xscale = 100;
}
if (trg.speed > 0) {
trg._xscale = -100;
}
}
if (((trg.animation == "move") || (trg.animation == "run")) && (!root[trg._name + "_move_sound"])) {
move_sound(trg._name, "start");
}
if (((trg.animation != "move") && (trg.animation != "run")) && (root[trg._name + "_move_sound"])) {
move_sound(trg._name, "stop");
}
}
function setup_detection(trg, type, obj) {
detect = trg.createEmptyMovieClip("detect", 1021);
detect.resulting = obj.resulting;
detect.type = type;
detect.onEnterFrame = function () {
this.attack_width = this._parent.body.attack._width;
this.attack_height = this._parent.body.attack._height;
this.attack_x = this._parent.coord.attack.x;
this.attack_y = this._parent.coord.attack.y;
this.enemy_width = this._parent.enemy.body.hit._width;
this.enemy_height = this._parent.enemy.body.hit._height;
this.enemy_x = this._parent.enemy.coord.hit.x;
this.enemy_y = this._parent.enemy.coord.hit.y;
this.hit_x = Math.abs(this.attack_x - this.enemy_x) - ((this.attack_width + this.enemy_width) * 0.5);
this.hit_y = Math.abs(this.attack_y - this.enemy_y) - ((this.attack_height + this.enemy_height) * 0.5);
this.hit = (((this.hit_x <= 0) && (this.hit_y <= 0)) && (!isNaN(this.hit_x))) && (!isNaN(this.hit_y));
switch (type) {
case "basic" :
damage = this._parent.data.basic_damage;
break;
case "combo" :
damage = this._parent.data[this._parent.animation + "_damage"];
}
if (this.hit && (this._parent.enemy.data.transform_state != "invincible")) {
if (this._parent.enemy.animation == "block") {
rnd = int(Math.random() * 2);
damage = int(damage * (rnd * 0.25));
}
update_health(this._parent.enemy, damage, this._parent.enemy.animation != "block", this.resulting, true);
this.removeMovieClip();
}
};
}
function body_cycle(trg) {
trg.body.total = trg.body._totalframes;
trg.body.onEnterFrame = function () {
if ((this._parent.enemy.animation == "win") && (this._parent.animation == "fall")) {
trace("FIX WIN");
delete this.onEnterFrame;
}
if (this.total == this._currentframe) {
delete this.onEnterFrame;
this.stop();
if (this._parent.data.transform_state == "waiting") {
this._parent.animation = "ready";
this._parent.gotoAndStop("ready");
turn_back(this._parent);
}
if (((this._parent.data.health > 0) && (this._parent.animation != "win")) && (this._parent.enemy.animation != "win")) {
this._parent.animation = "ready";
this._parent.detect.removeMovieClip();
}
if (clock.round_time <= 0) {
this._parent.animation = "ready";
this._parent.gotoAndStop("ready");
trace("OUT OF TIME FIX");
}
}
};
}
function end_game() {
if (game_mode == "tournament") {
root.after_tournament();
} else {
root.after_arcade();
}
}
function hit_back_setup(attacker, attacked, damage, pushed, resulting) {
if (attacker.character == "projectile") {
if (isNaN(attacker.parent.coord.hit.x)) {
dir = (attacker.parent._x < attacked._x) - (attacker.parent._x > attacked._x);
} else {
dir = (attacker.parent.coord.hit.x < attacked.coord.hit.x) - (attacker.parent.coord.hit.x > attacked.coord.hit.x);
}
}
if (attacker.character != "projectile") {
if (isNaN(attacker.coord.hit.x)) {
dir = attacked._xscale * 0.01;
} else {
dir = (attacker.coord.hit.x < attacked.coord.hit.x) - (attacker.coord.hit.x > attacked.coord.hit.x);
}
}
if (attacked.iy == ground) {
attacked.jumper.removeMovieClip();
attacked.jump_x = 0;
if (attacked.data.health <= 0) {
dist = hit_push * 2;
hit_back(attacked, dir, attacker.data.basic_damage, dist, "calculate", attacker.auto_pilot != undefined);
attacked.animation = "fall";
attacked.gotoAndStop("fall");
play_sound("fall", 100, 0);
hold_moves("all");
}
if ((attacked.data.health > 0) && (pushed)) {
dist = hit_push;
hit_back(attacked, dir, attacker.data.basic_damage, dist, "release");
if (resulting[0] == "fall") {
jumper = attacked.createEmptyMovieClip("jumper", 1050);
jumper.jump_vel = 0;
attacked.jump_x = 0;
attacked.animation = "fall";
attacked.gotoAndStop("fall");
play_sound("fall", 100, 0);
jumper.onEnterFrame = jump_hit_logic;
} else {
attacked.animation = "hit";
attacked.gotoAndStop("hit");
if (attacked.data.health > 0) {
check_the_hit(attacked);
}
}
}
} else {
if (attacked.data.health <= 0) {
hold_moves("all");
} else {
hold_moves("fall");
}
attacked.jumper.jump_vel = 0;
attacked.jump_x = 0;
attacked.animation = "fall";
attacked.gotoAndStop("fall");
play_sound("fall", 100, 0);
attacked.jumper.onEnterFrame = jump_hit_logic;
}
body_cycle(attacked);
}
function jump_hit_logic() {
this._parent.y = this._parent.y - this.jump_vel;
this.jump_vel = this.jump_vel - gravity;
this._parent.y = Math.min(this._parent.y, ground);
this._parent.iy = int(this._parent.y);
this._parent._y = this._parent.iy;
this._parent.body.shadow._y = ground - this._parent.iy;
if (this._parent.iy == ground) {
make_smoke(this._parent, "land");
this.jx = this._parent.jump_x;
this._parent.jump_x = 0;
this._parent.speed = 0;
this._parent.acceleration = 0;
this._parent.run_timer = 0;
this._parent.old_frame = undefined;
this.timer = 0;
this.onEnterFrame = jump_fall_wait;
}
}
function jump_fall_wait() {
this.new_frame = this._parent._currentframe;
if (this.new_frame == this.old_frame) {
this.timer++;
if (this.timer >= (1 * fps)) {
this.effects = false;
for (ce in effects) {
if (effects[ce]) {
this.effects = true;
}
}
if (!this.effects) {
after_jump_hit(this._parent);
this.removeMovieClip();
}
}
}
this.old_frame = this.new_frame;
}
function after_jump_hit(trg) {
if (trg.data.health > 0) {
trg.body.play();
if (clock.round_time > 0) {
continue_moves();
}
}
if (trg.data.health <= 0) {
pre_calculate_end(trg);
hold_moves("all");
}
}
function jump_logic() {
this._parent.y = this._parent.y - this.jump_vel;
this.jump_vel = this.jump_vel - gravity;
this._parent.y = Math.min(this._parent.y, ground);
this._parent.iy = int(this._parent.y);
this._parent._y = this._parent.iy;
this.frame = this._parent.body._currentframe;
if (this._parent.auto_pilot == undefined) {
if (key_x && (!this.kick)) {
this.kick = true;
}
}
if ((this._parent.auto_pilot != undefined) && (this.auto_kick)) {
this.kick = true;
}
if (this.frame > 4) {
this.kick = false;
}
if (this.kick) {
this._parent.gotoAndStop("jump_kick");
this._parent.body.gotoAndStop(this.frame);
if (!this.setup) {
this.setup = true;
setup_detection(this._parent, "basic");
}
}
if ((this.jump_vel <= 0) && (this._parent.iy != ground)) {
this._parent.body.gotoAndStop("down");
if (((this._parent.auto_pilot == undefined) && (this._parent.pot == 0)) && (this.kick)) {
this._parent.auto_direction = (-this._parent._xscale) * 0.01;
}
}
this._parent.body.shadow._y = ground - this._parent.iy;
if (this._parent.iy == ground) {
if (this._parent.body._currentframe == 4) {
if (this._parent.auto_pilot == undefined) {
this._parent.auto_direction = 0;
}
play_sound("jump_land", 100, 0);
make_smoke(this._parent, "land");
this.jx = this._parent.jump_x;
this._parent.jump_x = 0;
this._parent.speed = 0;
this._parent.acceleration = 0;
this._parent.run_timer = 0;
this._parent.body.gotoAndPlay(5);
this._parent.iy = ground;
this._parent.animation = "ready";
if ((key_right - key_left) == this.jx) {
this._parent.speed = this._parent.data.run_speed * this.jx;
this._parent.acceleration = this._parent.speed;
this._parent.run_timer = run_duration * fps;
}
this.removeMovieClip();
}
}
}
function hold_moves(type_of) {
if (type_of == "all") {
cpu.pot = 0;
cpu.auto_direction = 0;
cpu.detect.removeMovieClip();
delete cpu.auto_pilot.onEnterFrame;
you.pot = 0;
you.auto_direction = 0;
you.detect.removeMovieClip();
delete you.auto_pilot.onEnterFrame;
stop_key_combo();
}
if (type_of == "fall") {
cpu.pot = 0;
cpu.auto_direction = 0;
cpu.detect.removeMovieClip();
delete cpu.auto_pilot.onEnterFrame;
if (you.data.health == 0) {
you.pot = 0;
you.auto_direction = 0;
you.detect.removeMovieClip();
stop_key_combo();
}
}
}
function continue_moves() {
if (you.auto_pilot != undefined) {
auto_start(you);
}
if (cpu.auto_pilot != undefined) {
auto_start(cpu);
}
start_key_combo();
}
function pre_calculate_end(trg) {
switch (trg.enemy.data.transform_state) {
case "waiting" :
set_interval("calculate_end", 3, [trg]);
break;
case "transformed" :
turn_back(trg.enemy);
set_interval("calculate_end", 3, [trg]);
break;
case undefined :
calculate_end(trg);
}
}
function calculate_end(trg) {
stop_music("music_fight" + level_music);
hold_clock = true;
delete win_type;
if (trg._name == "you") {
fallen = you;
standing = cpu;
winner = "cpu";
} else {
fallen = cpu;
standing = you;
winner = "you";
}
standing.data.wins++;
if (fallen.data.health == 0) {
show_message("ko");
}
if (standing.data.wins == 2) {
win_animation(standing);
win_type = "game";
}
if (standing.data.wins < 2) {
set_interval("next_round", 3, [trg]);
win_type = "round";
}
if ((round == 3) && (win_type == undefined)) {
if (standing.data.wins > fallen.data.wins) {
win_animation(standing);
}
if (standing.data.wins == fallen.data.wins) {
if ((standing.data.health * (health_bar_width / standing.data.health_max)) > (fallen.data.health * (health_bar_width / fallen.data.health_max))) {
win_animation(standing);
} else {
win_animation(fallen);
}
}
win_type = "game";
}
if (winner == "you") {
play_sound(win_type + "_win", 100, 0);
} else {
play_sound(win_type + "_lose", 100, 0);
}
if (win_type == "round") {
end_of_round_stats();
}
}
function pre_out_of_time() {
show_message("out_of_time");
hold_moves("all");
if ((you.data.health * (health_bar_width / you.data.health_max)) > (cpu.data.health * (health_bar_width / cpu.data.health_max))) {
trg = you;
} else {
trg = cpu;
}
switch (trg.data.transform_state) {
case "waiting" :
set_interval("out_of_time", 3);
return;
case "transformed" :
turn_back(trg);
set_interval("out_of_time", 3);
return;
case undefined :
out_of_time();
}
}
function out_of_time() {
stop_music("music_fight" + level_music);
cpu.pot = 0;
cpu.auto_direction = 0;
cpu.detect.removeMovieClip();
delete cpu.auto_pilot.onEnterFrame;
you.pot = 0;
you.auto_direction = 0;
you.detect.removeMovieClip();
delete you.auto_pilot.onEnterFrame;
stop_key_combo();
if ((you.data.health * (health_bar_width / you.data.health_max)) > (cpu.data.health * (health_bar_width / cpu.data.health_max))) {
you.data.wins++;
winner = "you";
} else {
cpu.data.wins++;
winner = "cpu";
}
if (round == 3) {
if (you.data.wins == cpu.data.wins) {
if ((you.data.health * (health_bar_width / you.data.health_max)) > (cpu.data.health * (health_bar_width / cpu.data.health_max))) {
winner = "you";
win_animation(you);
} else {
winner = "cpu";
win_animation(cpu);
}
} else if (you.data.wins > cpu.data.wins) {
winner = "you";
win_animation(you);
} else {
winner = "cpu";
win_animation(cpu);
}
}
if (you.data.wins == 2) {
winner = "you";
win_animation(you);
}
if (cpu.data.wins == 2) {
winner = "cpu";
win_animation(cpu);
}
if (((round == 3) || (you.data.wins == 2)) || (cpu.data.wins == 2)) {
win_type = "game";
} else {
win_type = "round";
set_interval("next_round", 2, [trg]);
}
if (winner == "you") {
play_sound(win_type + "_win", 100, 0);
} else {
play_sound(win_type + "_lose", 100, 0);
}
end_of_round_stats();
}
function check_the_hit(trg) {
hit_frame = trg._currentframe;
checker = trg.body.createEmptyMovieClip("checker", 99);
checker.timer = 0;
checker.onEnterFrame = function () {
this.timer++;
if (this.timer > 12) {
this._parent._parent.hit_back = 0;
this._parent._parent.animation = "ready";
this._parent._parent.gotoAndStop("ready");
trace("HIT FIX");
}
};
}
function hit_back(trg, dir, dam, dist, after) {
hitter = trg.createEmptyMovieClip("hitter", 1030);
hitter.hit_back = dir * dist;
trg.speed = hitter.hit_back;
trg.acceleration = hitter.hit_back;
hitter.after = after;
trg._xscale = 100 * dir;
hitter.onEnterFrame = function () {
this.hit_back = this.hit_back * 0.75;
this._parent.hit_back = int(this.hit_back);
this._parent.acceleration = this._parent.hit_back;
this._parent.speed = this._parent.hit_back;
if (Math.abs(this.hit_back) < 1) {
this._parent.hit_back = 0;
this._parent.acceleration = 0;
this._parent.speed = 0;
switch (this.after) {
case "release" :
this._parent.body.gotoAndPlay("release");
break;
case "calculate" :
pre_calculate_end(this._parent);
}
this.removeMovieClip();
}
};
}
function win_animation(trg) {
check_fx_on();
trg.jumper.removeMovieClip();
trg.jump_x = 0;
hold_moves("all");
update_wins(trg, 0);
won = trg._name == "you";
trg.animation = "win";
trg.gotoAndStop("win");
body_cycle(trg);
set_interval("make_trans", 4.5);
if (cpu_god_start) {
cpu_character = "god";
}
if (won) {
set_interval("show_message", 2, [root[trg._name + "_character"]]);
} else if (cpu_god_start) {
set_interval("show_message", 2, ["god"]);
} else {
set_interval("show_message", 2, [root[trg._name + "_character"]]);
}
camera_target = trg;
if (((cpu_character == "god") && (winner == "you")) && (game_mode == "tournament")) {
set_interval("show_menu", 5, ["win"]);
} else if ((((cpu_character == "jesus") || ((cpu_character == "satan") && (you_character == "jesus"))) && (winner == "you")) && (game_mode == "tournament")) {
set_interval("show_menu", 5, ["unlock"]);
} else {
set_interval("end_game", 5, [trg]);
}
}
function end_of_round_stats() {
update_wins(you, 0);
you.data.health = you.data.health_max;
update_wins(cpu, 0);
cpu.data.health = cpu.data.health_max;
}
function next_round(trg) {
make_trans();
set_interval("set_pieces", 0.5);
}
function set_pieces() {
update_health(you, 0, false, false, false);
update_health(cpu, 0, false, false, false);
nav.heart.gotoAndStop(1);
if (you.data.transform_state != undefined) {
you.gotoAndStop("ready");
quick_turn_back(you);
}
if (you.enemy.data.transform_state != undefined) {
cpu.gotoAndStop("ready");
quick_turn_back(cpu);
}
for (a in pieces) {
char = pieces[a];
trg = root[char];
set_character(char, trg);
trg._x = back_middle + (100 * offset);
trg.x = trg._x;
}
numbers_to_assets(2, "n", round_time, nav.clock, true);
round++;
round_info();
}
function update_health(trg, damage, pushed, resulting, generic_hit_effect) {
trg.data.health = trg.data.health - damage;
trg.data.health = Math.max(trg.data.health, 0);
health = trg.data.health;
max = trg.data.health_max;
my_health = int(health * (health_bar_width / max));
my_centre = nav[trg._name + "_health"].centre;
my_lower = nav[trg._name + "_health"].lower;
my_upper = nav[trg._name + "_health"].upper;
my_centre._x = my_lower._x;
my_centre._width = my_health;
my_upper._x = my_centre._x + my_centre._width;
my_centre._visible = (my_upper._visible = (my_lower._visible = my_health > 0));
if (damage) {
hit_back_setup(trg.enemy, trg, damage, pushed, resulting);
}
if (pushed) {
play_sound(trg.enemy.animation + "_land", 100, 0);
}
if (!pushed) {
play_sound(trg.enemy.animation + "_block", 100, 0);
}
if (generic_hit_effect) {
place_generic_hit(trg);
}
trg.stop_fx();
}
function update_wins(trg, amount) {
trg.data.wins = trg.data.wins + amount;
nav[trg._name + "_wins"].gotoAndStop(trg.data.wins + 1);
}
function set_interval(func, duration, para) {
if (int_lev == undefined) {
int_lev = 0;
}
int_lev++;
int_trg = interval.createEmptyMovieClip("int" + int_lev, int_lev);
int_trg.timer = 0;
int_trg.func = func;
int_trg.duration = duration;
int_trg.para = para;
int_trg.onEnterFrame = function () {
if (this.timer == int(this.duration * fps)) {
root[this.func](this.para[0], this.para[1], this.para[2], this.para[3], this.para[4]);
this.removeMovieClip();
}
this.timer++;
};
}
function mark(trg) {
marker = effects.attachMovie("marker", "marker", effects.getNextHighestDepth());
marker.ny = trg.body._height;
marker.trg = trg;
marker.timer = 0;
marker.speed = 0.2;
marker.wave = 10;
marker.onEnterFrame = function () {
this._x = this.trg.ix;
this.y = (this.trg.iy - this.ny) - 40;
this.timer = this.timer + this.speed;
this.float = Math.sin(this.timer) * this.wave;
this.iy = int(this.y + this.float);
this._y = this.iy;
};
}
function auto_start(trg) {
trg.createEmptyMovieClip("auto_pilot", 1040);
trg.auto_pilot.decision_timer = 0;
trg.auto_pilot.attack_timer = 0;
trg.auto_pilot.onEnterFrame = auto_pilot;
}
function make_decision(trg) {
made_decision = false;
if (!made_decision) {
if ((((((trg.ix - (trg.limit_x * 2)) <= back_min) && (trg._xscale == -100)) || (((trg.ix + trg.limit_x) >= back_max) && (trg._xscale == 100))) && ((Math.abs(trg.enemy.ix - trg.ix) < (hit_zone * 2)) && (trg.decision))) && (trg.animation == "ready")) {
made_decision = true;
jump_opponent(trg);
}
}
if (!made_decision) {
if (Math.abs(trg.enemy.ix - trg.ix) < (hit_zone * 0.5)) {
made_decision = true;
auto_play(trg, "defence");
}
}
if (!made_decision) {
trg.auto_direction = 0;
trg.auto_pilot.last_type = trg.auto_pilot.type;
rnd = int(Math.random() * 100) + 1;
if (rnd <= trg.data.offence) {
auto_play(trg, "offence");
} else {
rnd = int(Math.random() * 100) + 1;
if ((rnd <= 25) && (trg.decision)) {
jump_opponent(trg);
} else {
auto_play(trg, "defence");
}
}
if (trg.auto_pilot.last_type == trg.auto_pilot.type) {
trg.auto_pilot.run = true;
} else {
trg.auto_pilot.run = false;
}
made_decision = true;
}
}
function jump_opponent(trg) {
trg.auto_pilot.type = "jump_opponent";
trg.auto_direction = 0;
trg.jump_x = (trg.enemy.ix > trg.ix) - (trg.enemy.ix < trg.ix);
basic_move("jump", trg);
}
function jump_kick(trg) {
if ((trg.animation == "ready") || (trg.animation == "move")) {
trg.auto_pilot.type = "jump_opponent";
trg.auto_direction = 0;
trg.acceleration = 0;
trg.jump_x = (trg.enemy.ix > trg.ix) - (trg.enemy.ix < trg.ix);
basic_move("jump", trg);
trg.jumper.auto_kick = true;
}
}
function auto_play(trg, type) {
switch (type) {
case "offence" :
if (Math.abs(trg.enemy.ix - trg.ix) > (hit_zone * 2)) {
trg.auto_pilot.type = "offence";
trg.auto_direction = (trg.enemy.ix > trg.ix) - (trg.enemy.ix < trg.ix);
if (!trg.auto_direction) {
trg.auto_direction = 1 - (2 * int(Math.random() * 2));
}
}
break;
case "defence" :
if (Math.abs(trg.enemy.ix - trg.ix) >= (hit_zone * 2)) {
break;
}
trg.auto_pilot.type = "defence";
trg.auto_direction = (trg.enemy.ix < trg.ix) - (trg.enemy.ix > trg.ix);
if (trg.auto_direction) {
break;
}
trg.auto_direction = 1 - (2 * int(Math.random() * 2));
}
}
function auto_pilot() {
hit_zone = hit_area[this._parent._parent._name];
enemy_distance = Math.abs(this._parent.enemy.ix - this._parent.ix);
this.decision_timer = this.decision_timer + (this._parent.hit_back == 0);
if ((this.decision_timer % int(this._parent.data.decision_wait * fps)) == 0) {
if ((Math.abs(this._parent.enemy.ix - this._parent.ix) >= (hit_zone * 3)) && (this._parent.animation != "fall")) {
auto_play(this._parent, "offence");
} else {
make_decision(this._parent);
}
}
if (((int(this._parent.ix) == int(back_min + this._parent.limit_x)) || (int(this._parent.ix) == int(back_max - this._parent.limit_x))) && (this.type == "defence")) {
this._parent.auto_direction = 0;
}
if ((enemy_distance < hit_zone) && (this.type == "offence")) {
this._parent.auto_direction = 0;
}
if (this._parent.hit_back == 0) {
this.attack_timer++;
if (enemy_distance < hit_zone) {
if (((this._parent.enemy.animation == "punch") || (this._parent.enemy.animation == "kick")) || ((this._parent.enemy.animation == "jump") && (this._parent.enemy.jumper.kick))) {
rnd = int(Math.random() * 100) + 1;
if (rnd <= this._parent.data.block_chance) {
delete this.type;
this._parent.auto_direction = 0;
basic_move("block", this._parent);
block_wait(this._parent);
}
}
if ((this.attack_timer >= (this._parent.data.hit_wait * fps)) && (this.type != "deffence")) {
this.attack_timer = 0;
basic_move(attack_options[int(Math.random() * attack_options.length)], this._parent);
}
}
if ((enemy_distance >= hit_zone) && (enemy_distance < (hit_zone * 5))) {
if ((this.attack_timer >= (this._parent.data.hit_wait * fps)) && (this.type != "deffence")) {
this.attack_timer = 0;
rnd = int(Math.random() * 100) + 1;
if (rnd <= this._parent.data.combo_chance) {
auto_combo(this._parent);
} else {
rnd = int(Math.random() * 100) + 1;
if (rnd <= 25) {
jump_kick(this._parent);
}
}
}
}
}
}
function counter_attack(trg) {
rnd = int(Math.random() * 100) + 1;
if ((rnd <= trg.data.counter_chance) && (trg.animation != "jump")) {
counter = trg.body.createEmptyMovieClip("counter", 1030);
counter.onEnterFrame = function () {
if (this._parent._currentframe == this._parent._totalframes) {
counter_now(this._parent._parent);
this.removeMovieClip();
}
};
}
}
function counter_now(trg) {
trg.animation = attack_options[int(Math.random() * attack_options.length)];
trg.old_animation = trg.animation;
trg.gotoAndStop(trg.animation);
trg.speed = 0;
trg.pot = 0;
body_cycle(trg);
setup_detection(trg, "basic", true);
}
function block_wait(trg) {
blocker = trg.createEmptyMovieClip("blocker", 1022);
blocker.timer = 0;
blocker.onEnterFrame = function () {
this.timer++;
if (this.timer >= int(block_duration * fps)) {
release_block(this._parent);
this.removeMovieClip();
}
};
}
function auto_combo(trg) {
if (((trg.enemy.data.health > 0) && (trg.jumper == undefined)) && ((trg.data.transform_state == undefined) || (trg.data.transform_state == "transformed"))) {
combo_options = key_combo[trg.character];
old_combo = new_combo;
new_combo = int(Math.random() * combo_options.length);
while (old_combo == new_combo) {
new_combo = int(Math.random() * combo_options.length);
}
trg.jumper.removeMovieClip();
trg.jump_x = 0;
trg.auto_direction = 0;
if (trg.ix < trg.enemy.ix) {
trg._xscale = -100;
}
if (trg.ix > trg.enemy.ix) {
trg._xscale = 100;
}
combo_check(trg, combo_options[new_combo]);
}
}
play_options = ["defence", "offence"];
attack_options = ["kick", "punch"];
hit_area = {god:100, jesus:80, satan:145, eve:80, mary:80, moses:80, noah:80};
function cpu_logic() {
if (this.animation != "jump") {
run_logic(this);
}
this.decision = (((this.animation == "move") || (this.animation == "run")) || (this.animation == "ready")) || (this.animation == "jump");
this.potty = (((this.auto_direction * (!this.blocked)) * this.decision) + (this.jump_x * (this._y != ground))) * (this.hit_back == 0);
this.potty = Math.min(Math.max(this.potty, -1), 1);
this.pot = (this.max_speed * this.potty) + this.hit_back;
this.speed = this.speed + (this.acceleration * (this.pot > this.speed));
this.speed = this.speed - (this.acceleration * (this.pot < this.speed));
this.x = this.x + this.speed;
this.x = Math.min(Math.max(this.x, back_min + this.limit_x), back_max - this.limit_x);
this.ix = int(this.x);
this._x = this.ix;
stuck_fix(this);
get_coords(this);
check_animation(this);
}
function you_logic() {
if (this.animation != "jump") {
run_logic(this);
}
this.decision = (((this.animation == "move") || (this.animation == "run")) || (this.animation == "ready")) || (this.animation == "jump");
check_obstruct(this);
this.key_right = key_right * (this.x < (back_max - this.limit_x));
this.key_left = key_left * (this.x > (back_min + this.limit_x));
this.potty = (((this.key_right - this.key_left) + this.auto_direction) * this.decision) * (this.hit_back == 0);
this.potty = Math.min(Math.max(this.potty, -1), 1);
this.pot = (this.max_speed * this.potty) + this.hit_back;
this.speed = this.speed + (this.acceleration * (this.pot > this.speed));
this.speed = this.speed - (this.acceleration * (this.pot < this.speed));
this.x = this.x + this.speed;
this.x = Math.min(Math.max(this.x, back_min + this.limit_x), back_max - this.limit_x);
this.ix = int(this.x);
this._x = this.ix;
stuck_fix(this);
get_coords(this);
check_animation(this);
}
function load_xml() {
total_levels = 0;
xml_config = new XML();
xml_config.ignoreWhite = true;
xml_config.onLoad = function () {
sort_xml_config();
};
xml_config.load("config.xml");
}
function sort_xml_config() {
config = {};
info = xml_config.childNodes[0];
for (a in info.childNodes) {
temp_section = info.childNodes[a];
temp_section_name = temp_section.nodeName;
config[temp_section_name] = {};
for (b in temp_section.attributes) {
temp_section_var_name = b;
temp_section_var_value = array_string_or_number(temp_section.attributes[b]);
config[temp_section_name][temp_section_var_name] = temp_section_var_value;
}
for (b in temp_section.childNodes) {
temp_branch = temp_section.childNodes[b];
branch_trg = (config[temp_section_name][temp_branch.nodeName] = {});
for (c in temp_branch.attributes) {
branch_trg[c] = array_string_or_number(temp_branch.attributes[c]);
}
for (c in temp_branch.childNodes) {
temp_branch_c = temp_branch.childNodes[c];
branch_trg_c = (branch_trg[temp_branch_c.nodeName] = {});
for (d in temp_branch_c.attributes) {
branch_trg_c[d] = array_string_or_number(temp_branch_c.attributes[d]);
}
}
}
}
xml_loaded = true;
}
function array_string_or_number(value) {
value = value.split(",");
if (value.length == 1) {
value = value[0];
if (!isNaN(value)) {
value = Number(value);
}
} else {
for (a in value) {
if (!isNaN(value[a])) {
value[a] = Number(value[a]);
}
}
}
return(value);
}
function numbers_to_assets(n_len, n_id, n_amount, n_path, include_zeros) {
switch (include_zeros) {
case true :
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
a = 0;
while (a < n_len) {
n_path[n_id + (a + 1)].gotoAndStop(Number(n_broken.substr(a, 1)) + 1);
a++;
}
n_path.d1;
break;
case false :
a = 1;
while (a <= n_len) {
n_path[n_id + a]._visible = a > (n_len - Number(n_amount).toString().length);
a++;
}
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
a = 0;
while (a < n_len) {
n_path[n_id + (a + 1)].gotoAndStop(Number(n_broken.substr(a, 1)) + 1);
a++;
}
n_path.d1;
}
}
function numbers_to_text(n_len, n_amount, n_path, n_var) {
n_broken = n_amount.toString();
temp_zero = "";
a = n_len;
while (a > n_broken.length) {
temp_zero = temp_zero + "0";
a--;
}
n_broken = temp_zero + n_broken;
n_path[n_var] = n_broken;
n_path.d1;
}
function load_saved() {
saved_profile = SharedObject.getLocal("bible_fight", "/");
if (saved_profile.data.saved != true) {
saved_profile.data.saved = true;
saved_profile.data.tournament = {};
saved_profile.data.god_ready = false;
saved_profile.data.code = false;
a = 0;
while (a < character_order.length) {
saved_profile.data.tournament[character_order[a]] = "locked";
a++;
}
saved_profile.flush();
}
}
function load_wait() {
all.onEnterFrame = function () {
e_total = this.effects.getBytesTotal();
e_loaded = this.effects.getBytesLoaded();
s_total = root.sounds.getBytesTotal();
s_loaded = root.sounds.getBytesLoaded();
r_total = root.getBytesTotal();
r_loaded = root.getBytesLoaded();
split = Math.max(((r_total > 0) + (e_total > 0)) + (s_total > 0), 1);
split_total = 33.3333333333333 * split;
loading = int((((e_loaded + r_loaded) + s_loaded) / ((e_total + r_total) + s_total)) * split_total);
loading_screen.loader.gotoAndStop(Math.max(loading, 1));
if ((((((((e_total == e_loaded) && (e_total)) && (r_total == r_loaded)) && (r_total)) && (s_total == s_loaded)) && (s_total)) && (xml_loaded)) && (saved_profile.data.saved)) {
to_title();
delete this.onEnterFrame;
}
};
}
function make_trans() {
transition.attachMovie("transition1", "trans", 1);
}
function to_title() {
gotoAndStop (3);
title_screen();
}
function show_menu(frm) {
menu = menus.attachMovie("menus", "menu", 1);
menu.gotoAndStop(frm);
on_menu = frm;
if (((frm == "intro_locked") || (frm == "intro_unlocked")) || (frm == "intro_unlocking")) {
delete cpu_character;
delete you_character;
}
}
function title_screen() {
play_music("music_menu", 100);
show_menu("title");
}
function intro_screen(trans) {
play_music("music_menu", 100);
switch (trans) {
case true :
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("intro_screen", 0.5, [false]);
break;
case false :
show_menu("intro_unlocked");
}
}
function start_tournament() {
switch (!from_ladder) {
case true :
play_sound("mouse_click", 100, 0);
if ((you_character == saved_profile.data.last_character) && (saved_profile.data.last_character != undefined)) {
} else {
saved_profile.data.god_ready = false;
a = 0;
while (a < character_order.length) {
saved_profile.data.tournament[character_order[a]] = "locked";
a++;
}
saved_profile.data.last_character = you_character;
saved_profile.flush();
}
make_trans();
set_interval("sort_tournament_main", 0.5);
return;
case false :
make_trans();
play_sound("mouse_click", 100, 0);
set_interval("set_tournament_main", 0.5, [true]);
}
}
function tournament_screen(force) {
delete cpu_character;
game_mode = "tournament";
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("show_menu", 0.5, ["tournament_select"]);
set_interval("tournament_select_buttons", 0.54, [force]);
}
function tournament_deselect(char) {
menu.big_butts[char].gotoAndStop(1);
delete you_character;
play_sound("mouse_deselect", 100, 0);
menu.butts.gotoAndStop("no_select");
}
function tournament_select_buttons(force) {
if (you_character == undefined) {
menu.butts.gotoAndStop("no_select");
}
for (a in menu.big_butts) {
menu.big_butts[a].onPress = function () {
if (this._currentframe == 3) {
tournament_deselect(this._name);
} else {
choose_character("tournament", "you", this._name);
}
};
menu.big_butts[a].onRollOver = function () {
if (this._currentframe != 3) {
this.gotoAndStop("over");
}
};
menu.big_butts[a].onRollOut = function () {
if (this._currentframe != 3) {
this.gotoAndStop("up");
}
};
menu.big_butts[a].onDragOut = function () {
if (this._currentframe != 3) {
this.gotoAndStop("up");
}
};
}
if (force) {
menu.big_butts[you_character].gotoAndStop("up");
menu.big_butts[you_character].gotoAndStop("down");
if (you_character != undefined) {
menu.butts.gotoAndStop("ready");
}
}
}
function after_arcade() {
clear_game_board();
show_menu("intro_unlocked");
play_music("music_menu", 100);
}
function start_arcade() {
play_sound("mouse_fight", 100, 0);
make_trans();
set_interval("load_game", 0.5, ["arcade"]);
}
function arcade_area() {
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("show_menu", 0.5, ["arcade_area"]);
area = 0;
char_back = character_order[area];
}
function change_back(dir) {
area = area + dir;
char_back = character_order[area];
make_trans();
set_interval("to_background", 0.5);
}
function to_background() {
menu.area.gotoAndStop(char_back);
menu.area.righty.butt.gotoAndStop(1);
menu.area.lefty.butt.gotoAndStop(1);
menu.area.righty.gotoAndPlay(1);
menu.area.lefty.gotoAndPlay(1);
}
function arcade_screen(force) {
game_mode = "arcade";
play_sound("mouse_click", 100, 0);
make_trans();
if (saved_profile.data.code) {
set_interval("show_menu", 0.5, ["arcade_select_unlocked"]);
} else {
set_interval("show_menu", 0.5, ["arcade_select_locked"]);
wait_for_code();
}
set_interval("arcade_select_buttons", 0.54, [force]);
choosing = "you";
}
function arcade_deselect(char) {
if (char == you_character) {
menu.big_butts[char].gotoAndStop(1);
menu["you_" + char].gotoAndStop(1);
delete you_character;
choosing = "you";
}
if (char == cpu_character) {
menu.big_butts[char].gotoAndStop(1);
menu["cpu_" + char].gotoAndStop(1);
delete cpu_character;
}
play_sound("mouse_deselect", 100, 0);
check_choosing();
}
function check_choosing() {
old_state = flash_state;
if ((you_character == undefined) && (cpu_character == undefined)) {
flash_state = 1;
choosing = "you";
menu.butts.gotoAndStop("not_ready");
}
if ((you_character != undefined) && (cpu_character != undefined)) {
flash_state = 2;
menu.butts.gotoAndStop("ready");
choosing = "end";
}
if ((you_character == undefined) && (cpu_character != undefined)) {
flash_state = 3;
choosing = "you";
menu.butts.gotoAndStop("not_ready");
}
if ((you_character != undefined) && (cpu_character == undefined)) {
flash_state = 4;
choosing = "cpu";
menu.butts.gotoAndStop("not_ready");
}
menu.info.gotoAndPlay("choose_" + choosing);
if (flash_state != old_state) {
menu.info.text_flash.gotoAndPlay(1);
}
if (you_character == undefined) {
menu.butts.gotoAndStop("no_select");
}
}
function arcade_select_buttons(force) {
for (a in menu.big_butts) {
menu.big_butts[a].onPress = function () {
if (this._currentframe == 3) {
arcade_deselect(this._name);
} else {
choose_character("arcade", "", this._name);
}
};
menu.big_butts[a].onRollOver = function () {
if (this._currentframe != 3) {
this.gotoAndStop("over");
}
};
menu.big_butts[a].onRollOut = function () {
if (this._currentframe != 3) {
this.gotoAndStop("up");
}
};
menu.big_butts[a].onDragOut = function () {
if (this._currentframe != 3) {
this.gotoAndStop("up");
}
};
}
if (force) {
if (cpu_character != undefined) {
menu["cpu_" + cpu_character].gotoAndPlay(2);
menu.big_butts[cpu_character].gotoAndStop("down");
choosing = "you";
menu.butts.gotoAndStop("not_ready");
}
if (you_character != undefined) {
menu["you_" + you_character].gotoAndPlay(2);
menu.big_butts[you_character].gotoAndStop("down");
choosing = "cpu";
menu.butts.gotoAndStop("not_ready");
}
if ((cpu_character != undefined) && (you_character != undefined)) {
choosing = "end";
menu.butts.gotoAndStop("ready");
}
}
if (you_character == undefined) {
menu.butts.gotoAndStop("no_select");
}
}
function choose_character(game, control, char) {
switch (game) {
case "tournament" :
menu.big_butts[you_character].gotoAndStop("up");
root[control + "_character"] = char;
menu.big_butts[char].gotoAndStop("down");
play_sound("mouse_select", 100, 0);
you_charcater = char;
menu.butts.gotoAndStop("ready");
break;
case "arcade" :
if ((choosing == "cpu") && (char != you_character)) {
menu["cpu_" + char].gotoAndPlay(2);
cpu_character = char;
play_sound("mouse_select", 100, 0);
menu.big_butts[char].gotoAndStop("down");
}
if (choosing == "you") {
menu["you_" + char].gotoAndPlay(2);
you_character = char;
play_sound("mouse_select", 100, 0);
menu.big_butts[char].gotoAndStop("down");
}
check_choosing();
}
}
function show_controls(frm) {
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("set_controls", 0.5, [frm]);
}
function set_controls(frm) {
if (frm == "arcade") {
show_menu("controls_arcade");
} else {
show_menu("controls");
}
menu.controls.gotoAndStop(you_character);
switch (game_mode) {
case "arcade" :
if ((cpu_character == undefined) || (you_character == undefined)) {
menu.butts.gotoAndStop("not_ready");
} else {
menu.butts.gotoAndStop("ready");
}
break;
case "tournament" :
if (you_character == undefined) {
menu.butts.gotoAndStop("not_ready");
} else if (cpu_character == undefined) {
menu.butts.gotoAndStop("next");
} else {
menu.butts.gotoAndStop("ready");
}
}
}
function load_external() {
loadMovie ("external/effects.swf", effects);
loadMovie ("external/sounds.swf", sounds);
}
function sort_tournament_main(force) {
clear_game_board();
show_menu("tournament_main");
menu.ladder.you.gotoAndStop(you_character);
cpu_order = [];
i_count = 0;
active_show = false;
mini_set = [];
menu.ladder.movey.showy.gotoAndStop(you_character);
a = 0;
while (a < character_order.length) {
if (character_order[a] != you_character) {
if (saved_profile.data.tournament[character_order[a]] == "locked") {
cpu_order.push(character_order[a]);
}
menu.ladder.mini["i" + (i_count + 1)].gotoAndStop(character_order[a]);
if (saved_profile.data.tournament[character_order[a]] == "locked") {
if (!active_show) {
active_show = true;
menu.ladder.mini["i" + (i_count + 1)].chip.gotoAndStop("active");
mini_set.push([character_order[a], "active"]);
if (won) {
menu.ladder.movey.gotoAndPlay("s" + i_count);
} else {
menu.ladder.movey.gotoAndStop(("s" + i_count) + "_end");
}
end_place = i_count;
} else {
menu.ladder.mini["i" + (i_count + 1)].chip.gotoAndStop("locked");
mini_set.push([character_order[a], "locked"]);
}
}
if (saved_profile.data.tournament[character_order[a]] == "unlocked") {
menu.ladder.mini["i" + (i_count + 1)].chip.gotoAndStop("unlocked");
mini_set.push([character_order[a], "unlocked"]);
}
i_count++;
}
a++;
}
cpu_order.reverse();
cpu_character = cpu_order[cpu_order.length - 1];
if (cpu_character == "god") {
menu.ladder.movey._visible = 0;
menu.ladder.mini._visible = 0;
}
menu.ladder.timer = 0;
menu.ladder.onEnterFrame = function () {
this.timer++;
if (this.timer == 1) {
menu.ladder.you.gotoAndPlay(you_character);
menu.ladder.cpu.gotoAndPlay(cpu_character);
menu.ladder.play();
delete this.onEnterFrame;
}
};
}
function start_tournament_game() {
saved_profile.data.last_character = you_character;
saved_profile.flush();
play_sound("mouse_click", 100, 0);
make_trans();
delete char_back;
set_interval("load_game", 0.5, ["tournament"]);
set_interval("play_sound", 0.5, ["mouse_fight", 100, 0]);
}
function set_tournament_main(load_game) {
show_menu("tournament_main");
menu.ladder.gotoAndStop("end");
menu.ladder.you.gotoAndStop(you_character + "_end");
menu.ladder.cpu.gotoAndStop(cpu_character + "_end");
if (cpu_character == "god") {
menu.ladder.movey._visible = 0;
menu.ladder.mini._visible = 0;
}
menu.ladder.movey.showy.gotoAndStop(you_character);
a = 0;
while (a < mini_set.length) {
menu.ladder.mini["i" + (a + 1)].gotoAndStop(mini_set[a][0]);
if (cpu_character != "god") {
menu.ladder.mini["i" + (a + 1)].chip.gotoAndStop(mini_set[a][1]);
if (mini_set[a][1] == "active") {
menu.ladder.movey.gotoAndStop(("s" + a) + "_end");
}
} else {
menu.ladder.mini["i" + (a + 1)].chip.gotoAndStop(1);
}
a++;
}
if (load_game) {
menu.ladder.gotoAndStop("loading");
delete char_back;
set_interval("load_game", 0.5, ["tournament"]);
set_interval("play_sound", 0.5, ["mouse_fight", 100, 0]);
}
}
function load_game() {
if (game_mode == "arcade") {
show_menu("loading_arcade");
menu.you_image.gotoAndPlay(you_character);
menu.cpu_image.gotoAndPlay(cpu_character);
menu.cpu_image.gotoAndStop(menu.cpu_image._currentframe + 4);
load_bar = menu.loading;
} else {
menu.ladder.gotoAndStop("loading");
load_bar = menu.ladder.loading;
}
all.createEmptyMovieClip("back", 10);
load_order = [you_character, cpu_character];
if ((you_character == "god") || (cpu_character == "god")) {
load_order = character_order;
}
cpu_god_start = cpu_character == "god";
trace(cpu_god_start);
load_level_content();
if (game_mode == "tournament") {
level_music = (end_place % 2) + 1;
} else {
old_level = level_music;
while (old_level == level_music) {
level_music = int(Math.random() * 2) + 1;
}
}
}
function load_level_content() {
char_num_load = 0;
load_amount = load_order.length + 1;
load_multi = 100 / load_amount;
load_adj = 0;
load_background();
}
function load_characters() {
if (char_num_load < load_order.length) {
char_to_load = characters[load_order[char_num_load]];
if (!char_to_load.getBytesTotal()) {
loadMovie (("external/" + load_order[char_num_load]) + ".swf", characters[load_order[char_num_load]]);
all.onEnterFrame = function () {
c_total = char_to_load.getBytesTotal();
c_loaded = char_to_load.getBytesLoaded();
prog = (load_multi / c_total) * c_loaded;
loading = int(prog + load_adj);
if (c_total) {
load_bar.gotoAndStop(loading);
}
if ((c_total == c_loaded) && (c_total)) {
delete this.onEnterFrame;
load_adj = load_adj + load_multi;
char_num_load++;
load_characters();
}
};
} else {
load_adj = load_adj + load_multi;
load_bar.gotoAndStop(load_adj);
char_num_load++;
load_characters();
}
} else {
set_interval("make_trans", 1.5);
set_interval("start_game", 2);
set_interval("stop_music", 2, ["music_menu"]);
}
}
function load_background() {
if (char_back) {
loadMovie (("external/" + char_back) + "_back.swf", all.back);
} else {
loadMovie (("external/" + cpu_character) + "_back.swf", all.back);
}
all.onEnterFrame = function () {
c_total = all.back.getBytesTotal();
c_loaded = all.back.getBytesLoaded();
prog = (load_multi / c_total) * c_loaded;
loading = int(prog) + load_adj;
if (c_total) {
load_bar.gotoAndStop(loading);
}
if ((c_total == c_loaded) && (c_total)) {
delete this.onEnterFrame;
load_adj = load_adj + load_multi;
load_characters();
}
};
}
function after_unlock() {
play_sound("mouse_click", 100, 0);
clear_game_board();
saved_profile.data.god_ready = true;
saved_profile.data.tournament[cpu_character] = "unlocked";
saved_profile.flush();
cpu_character = "god";
delete char_back;
make_trans();
level_music = 2;
set_interval("set_tournament_main", 0.5, [true]);
}
function after_win() {
clear_game_board();
make_trans();
set_interval("after_tournament", 0.5);
}
function after_tournament() {
play_music("music_menu", 100);
sent_to = false;
if (won) {
saved_profile.data.tournament[cpu_character] = "unlocked";
if ((cpu_character == "god") && (winner == "you")) {
trace("EVERY THING GONE");
a = 0;
while (a < character_order.length) {
saved_profile.data.tournament[character_order[a]] = "locked";
a++;
}
saved_profile.data.last_character = you_character;
saved_profile.flush();
show_menu("intro_unlocked");
sent_to = true;
}
saved_profile.flush();
}
if (!sent_to) {
sort_tournament_main();
sent_to = true;
}
won = false;
}
function start_game() {
round = 1;
pro_lev = 0;
menu.removeMovieClip();
back = all.back.attachMovie("back", "back", 1);
back_min = 0;
back_max = int(back.back.masker._width);
back_middle = int(back_max * 0.5);
back._x = int((-(back_max * 0.5)) + (stage_w * 0.5));
characters._x = back._x;
effects._x = back._x;
combo_duration = int(config.general.combo_duration * fps);
run_duration = config.general.run_duration;
gravity = config.general.gravity;
hit_push = config.general.hit_push;
block_duration = config.general.block_duration;
round_time = config.general.round_time;
start_rounds = config.general.start_rounds;
cpu = characters[cpu_character].attachMovie(cpu_character, "cpu", 100);
you = characters[you_character].attachMovie(you_character, "you", 200);
levels = {eve:1, god:7, jesus:6, satan:5, mary:4, moses:3, noah:2};
for (l in character_order) {
characters[character_order[l]].swapDepths(levels[character_order[l]]);
}
if (characters[cpu_character].getDepth() > characters[you_character].getDepth()) {
characters[you_character].swapDepths(characters.getNextHighestDepth());
}
you.enemy = cpu;
cpu.enemy = you;
pieces = ["cpu", "you"];
for (a in pieces) {
char = pieces[a];
trg = root[char];
trg.data = {};
set_character(char, trg);
if (char == "you") {
for (b in config[char][root[char + "_character"]]) {
trg.data[b] = config[char][root[char + "_character"]][b];
}
} else {
for (b in config[char][game_mode][root[char + "_character"]]) {
trg.data[b] = config[char][game_mode][root[char + "_character"]][b];
}
}
trg.data.wins = 0;
trg.data.health_max = trg.data.health;
trg._x = back_middle + (100 * offset);
trg.x = trg._x;
delete trg.data.transform_state;
}
setup_nav();
make_camera();
auto_start(cpu);
round_info();
}
function round_info() {
play_music("music_fight" + level_music, 100);
hold_moves("all");
show_message("round" + round);
set_interval("show_message", 1.5, ["fight"]);
set_interval("start_round", 3);
}
function show_message(ms) {
show_menu("messages");
menu.messages.gotoAndPlay(ms);
if (ms == "ko") {
behind.attachMovie("ko", "ko", 100);
}
}
function start_round() {
stampede_you = false;
fish_loaves_you = false;
headed_dog_you = false;
stampede_cpu = false;
fish_loaves_cpu = false;
headed_dog_cpu = false;
transform_cpu = false;
continue_moves();
hold_clock = false;
start_clock();
menu.removeMovieClip();
}
function set_character(char, trg) {
num = Number(a);
offset = (num == 0) - (num != 0);
opp = 1 * (num == 0);
trg._xscale = 100 * offset;
trg.speed = 0;
trg.hit_back = 0;
trg.auto_direction = 0;
trg._y = ground;
trg.y = trg._y;
trg.iy = trg.y;
trg.jump_vel = 0;
trg.jump_x = 0;
trg.character = root[char + "_character"];
trg.from = "move";
trg.run_timer = 0;
trg.animation = "ready";
trg.gotoAndStop("ready");
trg.limit_x = int(trg._width * 0.5);
trg.coord = {};
trg.onEnterFrame = root[char + "_logic"];
root[pieces[a]] = trg;
}
function setup_nav() {
attachMovie("nav", "nav", 1900);
nav.heart.gotoAndStop(1);
nav.you_name.gotoAndStop(you_character);
nav.cpu_name.gotoAndStop(cpu_character);
nav.you_head.gotoAndStop(you_character);
nav.cpu_head.gotoAndStop(cpu_character);
update_health(you, 0, false);
update_health(cpu, 0, false);
nav.you_wins.gotoAndStop(1);
nav.cpu_wins.gotoAndStop(1);
numbers_to_assets(2, "n", round_time, nav.clock, true);
nav.mute_butt.gotoAndStop(sound_state);
}
function start_clock() {
clock = nav.clock;
clock.round_time = round_time;
delete clock.old_time;
clock.onEnterFrame = clock_logic;
}
function clock_logic() {
this.round_time = this.round_time - ((1 / fps) * (!hold_clock));
this.show_time = Math.ceil(this.round_time);
if (this.show_time != this.old_time) {
this.old_time = this.show_time;
numbers_to_assets(2, "n", this.show_time, this, true);
if (((this.show_time <= 10) && (this.show_time != 0)) && (this._parent.heart._currentframe == 1)) {
this._parent.heart.gotoAndPlay("loop");
}
}
if (((this.round_time < 0) && (you.animation != "death")) && (cpu.animation != "death")) {
delete this.onEnterFrame;
pre_out_of_time();
}
if ((this.show_time == 0) && (this._parent.heart._currentframe < 35)) {
this._parent.heart.gotoAndPlay("fade");
}
}
function clear_game_board() {
back.removeMovieClip();
for (a in characters) {
for (ab in characters[a]) {
characters[a][ab].removeMovieClip();
}
}
for (b in effects) {
effects[b].removeMovieClip();
}
for (c in interval) {
interval[c].removeMovieClip();
}
}
function back_to_select() {
tournament_screen(true);
}
function back_from(fm) {
stop_key_combo();
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("show_menu", 0.5, ["intro_unlocked"]);
}
function from_controls() {
if (from_ladder) {
from_ladder = false;
play_sound("mouse_click", 100, 0);
make_trans();
set_interval("set_tournament_main", 0.5);
} else if (game_mode == "tournament") {
tournament_screen(true);
} else {
arcade_screen(true);
}
}
function from_credits() {
make_trans();
if (game_mode == "tournament") {
tournament_screen(true);
} else {
arcade_screen(true);
}
}
function cheat(type_of) {
switch (type_of) {
case "unlock" :
saved_profile.data.god_ready = true;
saved_profile.data.code = true;
a = 0;
while (a < character_order.length) {
saved_profile.data.tournament[character_order[a]] = "unlocked";
a++;
}
saved_profile.flush();
break;
case "cache" :
saved_profile.clear();
saved_profile.flush();
load_saved();
}
}
function credit_screen() {
make_trans();
back_to = on_menu;
set_interval("show_menu", 0.5, ["credits"]);
}
function wait_for_code() {
key_press = false;
unlock_code = "";
key_count = 0;
the_code = [74, 69, 72, 79, 86, 65, 72];
key_listener = new Object();
key_listener.onKeyDown = function () {
if (((!key_press) && (Key.getCode() != 20)) && (Key.getCode() != 16)) {
key_press = true;
if (Key.getCode() == the_code[key_count]) {
} else {
key_count = -1;
}
key_count++;
if (key_count == the_code.length) {
saved_profile.data.code = true;
play_sound("unlock", 100, 0);
show_menu("arcade_select_unlocked");
arcade_select_buttons(true);
stop_key_combo();
}
}
};
key_listener.onKeyUp = function () {
key_press = false;
};
Key.addListener(key_listener);
}
function get_contols(trg) {
trace(you_character);
trg.gotoAndStop(you_character);
}
_quality = "low";
_global.root = this;
_focusrect = false;
stop();
character_order = ["eve", "noah", "moses", "mary", "satan", "jesus", "god"];
createEmptyMovieClip("all", 1000);
createEmptyMovieClip("fade", 1001);
createEmptyMovieClip("menus", 2000);
createEmptyMovieClip("transition", 2100);
createEmptyMovieClip("interval", 3000);
createEmptyMovieClip("sounds", 4000);
characters = all.createEmptyMovieClip("characters", 100);
behind = all.createEmptyMovieClip("behind", 20);
for (a in character_order) {
characters.createEmptyMovieClip(character_order[a], Number(a) + 1);
}
effects = all.createEmptyMovieClip("effects", 200);
stage_w = 600;
stage_h = 400;
ground = 360;
health_bar_width = 165;
fps = 30;
sound_state = "on";
load_saved();
load_external();
load_xml();
load_wait();
Instance of Symbol 21 MovieClip "version" in Frame 1
onClipEvent (load) {
this.swapDepths(1000000);
this._visible = 0;
version = "BUILD 0.3.3";
this.keyListener = new Object();
this.keyListener.onKeyDown = function () {
if (Key.isDown(67)) {
root.version._visible = !root.version._visible;
}
};
Key.addListener(this.keyListener);
}
Symbol 9 MovieClip Frame 100
stop();
Symbol 18 Button
on (press) {
root.cheat("cache");
}
Symbol 20 Button
on (press) {
root.cheat("unlock");
}
Symbol 21 MovieClip Frame 1
var startTime = getTimer();
var numFrames = 0;
var recentSetting = 10;
var recentNumFrames = 0;
var recentStartTime = startTime;
function calcFPS() {
numFrames++;
var _local1 = getTimer();
elapsedSeconds = (_local1 - startTime) / 1000;
actualFPS = int(numFrames / elapsedSeconds);
recentNumFrames++;
if (recentNumFrames == recentSetting) {
var _local2 = (_local1 - recentStartTime) / 1000;
recentFPSoutput = int(recentNumFrames / _local2) + " FPS";
recentStartTime = _local1;
recentNumFrames = 0;
}
}
this.swapDepths(9999999991);
Instance of Symbol 14 MovieClip "callCalcFPS" in Symbol 21 MovieClip Frame 1
onClipEvent (enterFrame) {
_parent.calcFPS();
}
Symbol 119 MovieClip Frame 1
stop();
Symbol 119 MovieClip Frame 23
gotoAndStop (1);
Symbol 119 MovieClip Frame 34
gotoAndPlay ("loop");
Symbol 119 MovieClip Frame 65
stop();
Symbol 189 MovieClip Frame 1
stop();
Symbol 192 Button
on (press) {
root.toggle_sound("off");
nextFrame();
}
Symbol 193 Button
on (press) {
root.toggle_sound("on");
prevFrame();
}
Symbol 194 MovieClip Frame 1
stop();
Symbol 197 Button
on (press) {
_parent.nav_controls.play();
_parent.mute_butt.gotoAndStop(_parent.mute_butt._currentframe + 2);
nextFrame();
}
Symbol 198 MovieClip Frame 1
stop();
Symbol 218 Button
on (release) {
nextFrame();
}
Symbol 224 Button
on (release) {
prevFrame();
}
Symbol 228 Button
on (release) {
play();
}
Symbol 229 MovieClip Frame 1
stop();
Symbol 229 MovieClip Frame 7
stop();
root.get_contols(controls);
Symbol 229 MovieClip Frame 14
_parent.control_butt.gotoAndStop(1);
_parent.mute_butt.gotoAndStop(_parent.mute_butt._currentframe - 2);
Symbol 238 Button
on (press) {
root.intro_screen(true);
nextFrame();
}
Symbol 239 MovieClip Frame 1
stop();
Symbol 246 Button
on (press) {
root.tournament_screen();
nextFrame();
}
Symbol 249 MovieClip Frame 1
stop();
Symbol 252 Button
on (release) {
gotoAndPlay ("flash");
}
Symbol 253 Button
on (press) {
root.arcade_screen();
_parent.nextFrame();
}
Symbol 254 MovieClip Frame 16
stop();
Symbol 255 MovieClip Frame 1
stop();
Symbol 256 Button
on (press) {
root.arcade_screen();
nextFrame();
}
Symbol 257 MovieClip Frame 1
stop();
Symbol 267 MovieClip Frame 1
stop();
Symbol 275 MovieClip Frame 1
stop();
Symbol 283 MovieClip Frame 1
stop();
Symbol 291 MovieClip Frame 1
stop();
Symbol 299 MovieClip Frame 1
stop();
Symbol 307 MovieClip Frame 1
stop();
Symbol 315 MovieClip Frame 1
stop();
Symbol 319 MovieClip Frame 1
stop();
Symbol 319 MovieClip Frame 15
gotoAndPlay (2);
Symbol 322 MovieClip Frame 1
stop();
Symbol 322 MovieClip Frame 15
gotoAndPlay (2);
Symbol 327 MovieClip Frame 12
stop();
Symbol 330 MovieClip Frame 41
gotoAndPlay ("choose_you");
Symbol 330 MovieClip Frame 82
gotoAndPlay ("choose_cpu");
Symbol 330 MovieClip Frame 84
stop();
Symbol 335 Button
on (press) {
root.show_controls("arcade");
nextFrame();
}
Symbol 342 Button
on (press) {
root.back_from("arcade_select");
nextFrame();
}
Symbol 345 Button
on (press) {
root.arcade_area();
nextFrame();
}
Symbol 346 MovieClip Frame 1
stop();
Symbol 350 Button
on (press) {
_parent._parent.butts.nextFrame();
root.credit_screen();
nextFrame();
}
Symbol 351 MovieClip Frame 1
stop();
Symbol 352 MovieClip Frame 1
stop();
Symbol 352 MovieClip Frame 10
stop();
Symbol 363 Button
on (press) {
root.change_back(1);
nextFrame();
}
Symbol 364 MovieClip Frame 1
stop();
Symbol 368 Button
on (press) {
root.change_back(-1);
nextFrame();
}
Symbol 369 MovieClip Frame 1
stop();
Symbol 381 MovieClip Frame 1
stop();
Symbol 386 Button
on (press) {
root.start_arcade();
nextFrame();
}
Symbol 387 Button
on (press) {
root.from_controls();
nextFrame();
}
Symbol 388 MovieClip Frame 1
stop();
Symbol 391 Button
on (press) {
root.show_controls();
nextFrame();
}
Symbol 392 Button
on (press) {
root.back_from("tournament_select");
nextFrame();
}
Symbol 393 Button
on (release) {
root.start_tournament();
nextFrame();
}
Symbol 394 MovieClip Frame 1
stop();
Symbol 402 MovieClip Frame 1
stop();
Symbol 410 MovieClip Frame 1
stop();
Symbol 420 MovieClip Frame 1
stop();
Symbol 428 MovieClip Frame 1
stop();
Symbol 437 MovieClip Frame 1
stop();
Symbol 445 MovieClip Frame 1
stop();
Symbol 448 Button
on (press) {
root.credits_screen();
}
Symbol 465 MovieClip Frame 1
stop();
Symbol 465 MovieClip Frame 11
stop();
Symbol 465 MovieClip Frame 21
stop();
Symbol 465 MovieClip Frame 31
stop();
Symbol 465 MovieClip Frame 41
stop();
Symbol 465 MovieClip Frame 51
stop();
Symbol 465 MovieClip Frame 61
stop();
Symbol 465 MovieClip Frame 71
stop();
Symbol 472 MovieClip Frame 1
stop();
Symbol 472 MovieClip Frame 2
stop();
Symbol 472 MovieClip Frame 3
stop();
Symbol 479 MovieClip Frame 1
stop();
Symbol 479 MovieClip Frame 2
stop();
Symbol 479 MovieClip Frame 3
stop();
Symbol 486 MovieClip Frame 1
stop();
Symbol 486 MovieClip Frame 2
stop();
Symbol 486 MovieClip Frame 3
stop();
Symbol 493 MovieClip Frame 1
stop();
Symbol 493 MovieClip Frame 2
stop();
Symbol 493 MovieClip Frame 3
stop();
Symbol 500 MovieClip Frame 1
stop();
Symbol 500 MovieClip Frame 2
stop();
Symbol 500 MovieClip Frame 3
stop();
Symbol 507 MovieClip Frame 1
stop();
Symbol 507 MovieClip Frame 2
stop();
Symbol 507 MovieClip Frame 3
stop();
Symbol 510 MovieClip Frame 1
play();
Symbol 510 MovieClip Frame 9
stop();
Symbol 510 MovieClip Frame 10
play();
Symbol 510 MovieClip Frame 19
stop();
Symbol 510 MovieClip Frame 20
play();
Symbol 510 MovieClip Frame 29
stop();
Symbol 510 MovieClip Frame 30
play();
Symbol 510 MovieClip Frame 39
stop();
Symbol 510 MovieClip Frame 40
play();
Symbol 510 MovieClip Frame 49
stop();
Symbol 511 Button
on (press) {
root.start_tournament_game();
nextFrame();
}
Symbol 512 Button
on (press) {
root.from_ladder = true;
root.show_controls();
nextFrame();
}
Symbol 513 Button
on (press) {
root.back_to_select();
nextFrame();
}
Symbol 514 Button
on (press) {
nextFrame();
}
Symbol 515 MovieClip Frame 1
stop();
Symbol 522 MovieClip Frame 1
stop();
Symbol 522 MovieClip Frame 100
stop();
Symbol 523 MovieClip Frame 1
stop();
Symbol 523 MovieClip Frame 13
stop();
Symbol 542 MovieClip Frame 1
stop();
Symbol 542 MovieClip Frame 2
stop();
Symbol 542 MovieClip Frame 3
stop();
Symbol 542 MovieClip Frame 4
stop();
Symbol 542 MovieClip Frame 5
stop();
Symbol 542 MovieClip Frame 6
stop();
Symbol 542 MovieClip Frame 7
stop();
Symbol 560 MovieClip Frame 1
stop();
Symbol 560 MovieClip Frame 6
stop();
Symbol 560 MovieClip Frame 10
stop();
Symbol 560 MovieClip Frame 15
stop();
Symbol 560 MovieClip Frame 19
stop();
Symbol 560 MovieClip Frame 24
stop();
Symbol 560 MovieClip Frame 28
stop();
Symbol 560 MovieClip Frame 33
stop();
Symbol 560 MovieClip Frame 37
stop();
Symbol 560 MovieClip Frame 42
stop();
Symbol 560 MovieClip Frame 46
stop();
Symbol 560 MovieClip Frame 51
stop();
Symbol 560 MovieClip Frame 55
stop();
Symbol 560 MovieClip Frame 60
stop();
Symbol 560 MovieClip Frame 64
stop();
Symbol 571 MovieClip Frame 1
maskee.cacheAsBitmap = true;
maskMC.cacheAsBitmap = true;
maskee.setMask(maskMC);
start_btn.onRelease = function () {
gotoAndPlay (1);
};
stop();
Symbol 576 Button
on (press) {
root.from_credits();
}
Symbol 577 MovieClip Frame 1
stop();
Symbol 594 MovieClip Frame 1
stop();
Symbol 599 Button
on (release) {
root.from_controls();
nextFrame();
}
Symbol 600 Button
on (press) {
root["start_" + root.game_mode]();
nextFrame();
}
Symbol 601 Button
on (press) {
root["start_" + root.game_mode]();
nextFrame();
}
Symbol 603 Button
on (press) {
root.arcade_area();
nextFrame();
}
Symbol 629 MovieClip Frame 1
stop();
Symbol 629 MovieClip Frame 2
play();
Symbol 629 MovieClip Frame 39
stop();
Symbol 629 MovieClip Frame 40
play();
Symbol 629 MovieClip Frame 77
stop();
Symbol 629 MovieClip Frame 78
play();
Symbol 629 MovieClip Frame 116
stop();
Symbol 629 MovieClip Frame 117
play();
Symbol 629 MovieClip Frame 153
stop();
Symbol 629 MovieClip Frame 154
play();
Symbol 629 MovieClip Frame 210
stop();
Symbol 629 MovieClip Frame 211
play();
Symbol 629 MovieClip Frame 267
stop();
Symbol 629 MovieClip Frame 268
play();
Symbol 629 MovieClip Frame 325
stop();
Symbol 629 MovieClip Frame 326
play();
Symbol 629 MovieClip Frame 382
stop();
Symbol 629 MovieClip Frame 383
play();
Symbol 629 MovieClip Frame 438
stop();
Symbol 629 MovieClip Frame 439
play();
Symbol 629 MovieClip Frame 494
stop();
Symbol 629 MovieClip Frame 495
play();
Symbol 629 MovieClip Frame 549
stop();
Symbol 629 MovieClip Frame 552
play();
Symbol 629 MovieClip Frame 639
stop();
Symbol 639 Button
on (release) {
root.after_unlock();
nextFrame();
}
Symbol 640 MovieClip Frame 1
stop();
Symbol 643 MovieClip Frame 164
stop();
Symbol 644 Button
on (release) {
gotoAndPlay ("flash");
}
Symbol 649 MovieClip Frame 59
gotoAndPlay ("pulse");
Symbol 706 Button
on (press) {
root.after_win();
nextFrame();
}
Symbol 707 MovieClip Frame 1
stop();
Symbol 708 MovieClip Frame 125
stop();
Instance of Symbol 352 MovieClip in Symbol 709 MovieClip [menus] Frame 41
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
Instance of Symbol 352 MovieClip in Symbol 709 MovieClip [menus] Frame 71
onClipEvent (enterFrame) {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
this.nextFrame();
} else {
this.prevFrame();
}
}
Symbol 710 MovieClip [transition1] Frame 17
this.removeMovieClip();
Symbol 711 MovieClip [ko] Frame 87
this.removeMovieClip();
Symbol 713 MovieClip [special_dark] Frame 25
this.removeMovieClip();