Frame 1
stop();
Frame 3
function hit(dammage) {
walls_now = walls_now - dammage;
}
enemy_depth = 100;
e_d = enemy_depth;
e_num = 20;
e_online = 0;
enemy_next = 3;
enemy_limit = 50;
enemy_worth = 5;
i = 0;
catapult_price = 350;
catapult_number = 0;
catapult_upgrade_price = 400;
catapult_upgrade_add = 10;
catapult_upgrade = 100;
catapult_hitsize = 30;
cash = 0;
Set("port\u00E9e_archers", 170);
archer_number = 0;
archer_price = 100;
archer_limit = 40;
archer_upgrade_price = 200;
archer_upgrade = 50;
walls_limit = 200;
walls_now = 200;
walls_display = (walls_now + "/") + walls_limit;
walls_upgrade_price = 50;
walls_upgrade_add = 15;
walls_upgrade = 25;
walls_repair_price = 40;
walls_repair = 20;
cata.stop();
timer = 0;
wave_time = 200;
_root.catapult1._visible = false;
_root.catapult2._visible = false;
_root.catapult3._visible = false;
_root.catapult4._visible = false;
level = 0;
sit = "create_level";
Instance of Symbol 81 MovieClip "damage" in Frame 3
onClipEvent (enterFrame) {
_width = _root.catapult_hitsize;
_height = _root.catapult_hitsize;
}
Instance of Symbol 83 MovieClip "archer_zone" in Frame 3
onClipEvent (load) {
size = _root["port\u00E9e_archers"] * 2;
_width = size;
_height = size;
showing = "yes";
}
onClipEvent (enterFrame) {
size = _root["port\u00E9e_archers"] * 2;
_width = size;
_height = size;
if (showing == "yes") {
_visible = true;
} else if (showing == "no") {
_visible = false;
}
}
Instance of Symbol 167 MovieClip "menu_batiments" in Frame 3
onClipEvent (load) {
gotoAndStop ("closed");
_x = 210;
_y = 100;
}
Instance of Symbol 169 MovieClip "description_cursor" in Frame 3
onClipEvent (enterFrame) {
_x = _root._xmouse;
_y = _root._ymouse;
}
Frame 4
if (sit == "waiting") {
play_level.gotoAndStop("go");
sit == "waiting open";
}
if (sit == "create_level") {
a = e_num;
while (a > 0) {
_root.attachMovie("enemy", "enemy" + e_d, e_d);
_root["enemy" + e_d].wave = random(3);
e_d++;
e_online++;
a--;
}
if (e_num < enemy_limit) {
e_num = e_num + enemy_next;
}
if (e_d >= 1000) {
e_d = enemy_depth;
}
level++;
sit = "playing";
timer = 0;
}
if (sit == "playing") {
timer++;
if (e_online == 0) {
sit = "waiting";
}
}
display_level = "level " + (level + 1);
walls_display = (walls_now + "/") + walls_limit;
Frame 5
gotoAndPlay ("loop");
Symbol 29 MovieClip Frame 23
gotoAndPlay (1);
Symbol 29 MovieClip Frame 29
_root.hit(1);
Symbol 29 MovieClip Frame 41
gotoAndPlay ("attacking");
Symbol 31 Button
on (press) {
health = health - 1;
}
Symbol 38 MovieClip Frame 1
gotoAndStop(random(4) + 2);
Symbol 43 MovieClip [enemy] Frame 1
side = random(3);
if (side == 0) {
_y = (random(800) - 50);
_x = 750;
}
if (side == 1) {
_x = (random(400) + 350);
_y = -50;
}
if (side == 2) {
_x = (random(400) + 350);
_y = 750;
}
speed = 1.5;
health = 1;
sit = "wave";
_rotation = (Math.atan2(_root.castle_zone._y - _y, _root.castle_zone._x - _x) / (Math.PI/180));
progressx = speed * Math.cos((Math.PI/180) * _rotation);
progressy = speed * Math.sin((Math.PI/180) * _rotation);
Symbol 43 MovieClip [enemy] Frame 2
if (_root.archer_number > 0) {
if (inzone != 1) {
a = _root.castle_zone._y - _y;
b = _root.castle_zone._x - _x;
distance = Math.sqrt((a * a) + (b * b));
}
if (distance < _root["port\u00E9e_archers"]) {
inzone = 1;
chance = random(250 - (_root.archer_number * 2));
if (chance <= (_root.archer_number / 25)) {
sit = "dead";
}
}
}
if (sit == "wave") {
if ((wave == 0) and (_root.timer > (_root.wave_time * wave))) {
sit = "walking";
} else if ((wave == 1) and (_root.timer > (_root.wave_time * wave))) {
sit = "walking";
} else if ((wave == 2) and (_root.timer > (_root.wave_time * wave))) {
sit = "walking";
} else if (_visible == true) {
_visible = false;
}
}
if (sit == "walking") {
if (_visible == false) {
_visible = true;
}
_y = (_y + progressy);
_x = (_x + progressx);
if (_root.castle_zone.hitTest(_x, _y, true)) {
sit = "attacking";
}
}
if (sit == "attacking") {
anim.gotoAndPlay("attacking");
sit = "attack.wait";
}
if (health == 0) {
sit = "dead";
}
if (_root.damage.hitTest(_x, _y, true)) {
sit = "dead";
}
if (sit == "dead") {
gotoAndPlay ("dead");
}
Symbol 43 MovieClip [enemy] Frame 3
gotoAndPlay (2);
Symbol 43 MovieClip [enemy] Frame 12
stop();
_root.e_online--;
_root.cash = _root.cash + _root.enemy_worth;
removeMovieClip(this);
Symbol 49 Button
on (press) {
play();
}
Symbol 54 Button
on (press) {
_root.menu_batiments.gotoAndStop("archery");
}
on (rollOver) {
_root.description_cursor.description = "archery";
}
on (rollOut) {
_root.description_cursor.description = "";
}
Symbol 55 Button
on (press) {
_root.menu_batiments.gotoAndStop("Magic");
}
on (rollOver) {
_root.description_cursor.description = "Magician School";
}
on (rollOut) {
_root.description_cursor.description = "";
}
Symbol 58 Button
on (press) {
_root.menu_batiments.gotoAndStop("factory");
}
on (rollOver) {
_root.description_cursor.description = "factory";
}
on (rollOut) {
_root.description_cursor.description = "";
}
Symbol 70 MovieClip Frame 1
stop();
Instance of Symbol 64 MovieClip in Symbol 70 MovieClip Frame 1
on (press) {
if (this._parent._parent.timer >= 199) {
this._parent._parent.ready = 1;
trace("touched");
}
}
Symbol 71 MovieClip Frame 1
ready = 0;
timer = 200;
Symbol 71 MovieClip Frame 2
if (_root.sit == "playing") {
if (ready == 1) {
anim._rotation = Math.atan2(_root._ymouse - _y, _root._xmouse - _x) / (Math.PI/180);
_root.onMouseDown = function () {
if (ready == 1) {
anim.play();
timer = 0;
_root.i++;
_root.cata.duplicateMovieClip("catapult_balle" + _root.i, _root.i);
_root["catapult_balle" + _root.i]._x = _root._xmouse;
_root["catapult_balle" + _root.i]._y = _root._ymouse;
if (_root.i > 5) {
_root.i = 0;
}
ready = 0;
}
};
}
if (timer < 200) {
timer++;
}
timerbar._xscale = timer / 2;
}
Symbol 71 MovieClip Frame 3
gotoAndPlay (2);
Symbol 79 MovieClip Frame 28
_root.damage._x = _x;
_root.damage._y = _y;
Symbol 79 MovieClip Frame 30
_root.damage._x = -200;
_root.damage._y = -200;
Symbol 79 MovieClip Frame 35
stop();
Symbol 127 MovieClip Frame 1
stop();
Symbol 129 Button
on (press) {
startDrag (this);
}
on (release) {
stopDrag();
}
Symbol 132 Button
on (press) {
gotoAndStop ("closed");
}
Symbol 142 Button
on (rollOver) {
if (_root.archer_number < _root.archer_limit) {
_root.description_cursor.description = _root.archer_price;
} else {
_root.description_cursor.description = "no more place";
}
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if ((_root.cash >= _root.archer_price) and (_root.archer_number < _root.archer_limit)) {
_root.archer_number++;
_root.archer_graphic.nextFrame();
_root.cash = _root.cash - _root.archer_price;
}
}
Symbol 144 Button
on (rollOver) {
_root.description_cursor.description = _root.archer_upgrade_price;
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if (_root.cash >= _root.archer_upgrade_price) {
_root["port\u00E9e_archers"] = _root["port\u00E9e_archers"] + _root.archer_upgrade;
_root.cash = _root.cash - _root.archer_upgrade_price;
_root.archer_upgrade_price = _root.archer_upgrade_price + 100;
}
}
Symbol 146 Button
on (press) {
if (_root.archer_zone.showing == "no") {
_root.archer_zone.showing = "yes";
} else if (_root.archer_zone.showing == "yes") {
_root.archer_zone.showing = "no";
}
}
Symbol 159 Button
on (rollOver) {
if (_root.catapult_number < 4) {
_root.description_cursor.description = _root.catapult_price;
} else {
_root.description_cursor.description = "no more place";
}
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if ((_root.cash >= _root.catapult_price) and (_root.catapult_number < 4)) {
_root.catapult_number++;
_root["catapult" + _root.catapult_number]._visible = true;
_root.cash = _root.cash - _root.catapult_price;
}
}
Symbol 160 Button
on (rollOver) {
_root.description_cursor.description = _root.catapult_upgrade_price;
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if (_root.cash >= _root.catapult_upgrade_price) {
_root.catapult_hitsize = _root.catapult_hitsize + _root.catapult_upgrade_add;
_root.cash = _root.cash - _root.catapult_upgrade_price;
_root.catapult_upgrade_price = _root.catapult_upgrade_price + _root.catapult_upgrade;
}
}
Symbol 161 Button
on (rollOver) {
_root.description_cursor.description = _root.walls_upgrade_price;
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if (_root.cash >= _root.walls_upgrade_price) {
_root.walls_limit = _root.walls_limit + _root.walls_upgrade_add;
_root.walls_now = _root.walls_now + _root.walls_upgrade_add;
_root.cash = _root.cash - _root.walls_upgrade_price;
}
}
Symbol 162 Button
on (rollOver) {
_root.description_cursor.description = _root.walls_repair_price;
}
on (rollOut) {
_root.description_cursor.description = "";
}
on (press) {
if ((_root.cash >= _root.walls_repair_price) and (_root.walls_now != _root.walls_limit)) {
_root.walls_now = _root.walls_now + _root.walls_repair;
_root.cash = _root.cash - _root.walls_repair_price;
while (_root.walls_now > _root.walls_limit) {
_root.walls_now--;
}
}
}
Symbol 178 Button
on (press) {
_root.sit = "create_level";
play();
}
Symbol 181 MovieClip Frame 1
stop();