Combined Code
movieClip 2 circle1 {
}
frame 1 {
function AIcircle() {
if (this.alive) {
if (pet2._x <= this._x - 30) {
this._xscale = 100;
this._x -= this.speed;
} else {
if (pet2._x >= this._x + 30) {
this._x += this.speed;
this._xscale = -100;
}
}
if (pet2._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (pet2._y >= this._y + 20) {
this._y += this.speed;
}
}
} else {}
}
function RenderEnemy() {
counter = 0;
while (counter < MonstersInScene.length) {
MonstersInScene[counter].gotoFunction();
++counter;
}
}
function gotoRed() {
if (warmthnum <= 100) {
if (red._x <= pet._x - 20) {
pet._x -= petspeed;
} else {
if (red._x >= pet._x + 20) {
pet._x += petspeed;
}
}
if (red._y <= pet._y - 20) {
pet._y -= petspeed;
} else {
if (red._y >= pet._y + 20) {
pet._y += petspeed;
}
}
} else {
petMoving = false;
desiredecision();
}
}
function gotoBlue() {
if (thirstnum <= 500) {
if (blue._x <= pet._x - 20) {
pet._x -= petspeed;
} else {
if (blue._x >= pet._x + 20) {
pet._x += petspeed;
}
}
if (blue._y <= pet._y - 20) {
pet._y -= petspeed;
} else {
if (blue._y >= pet._y + 20) {
pet._y += petspeed;
}
}
} else {
petMoving = false;
desiredecision();
}
}
function gotoYellow() {
if (funnum <= 500) {
if (yellow._x <= pet._x - 20) {
pet._x -= petspeed;
} else {
if (yellow._x >= pet._x + 20) {
pet._x += petspeed;
}
}
if (yellow._y <= pet._y - 20) {
pet._y -= petspeed;
} else {
if (yellow._y >= pet._y + 20) {
pet._y += petspeed;
}
}
} else {
petMoving = false;
desiredecision();
}
}
function desiredecision() {
if (petMoving == false) {
desiredecide = Math.ceil(Math.random() * 300) + 1;
}
if (desiredecide >= 20 && desiredecide <= 44) {
desire = 'FUN';
petMoving = true;
}
if (desiredecide >= 44 && desiredecide <= 70) {
desire = 'WARMTH';
petMoving = true;
}
if (desiredecide >= 70 && desiredecide <= 150) {
desire = 'H20';
petMoving = true;
}
}
function gotoRed2() {
if (warmthnum2 <= 100) {
if (red._x <= pet2._x - 20) {
pet2._x -= petspeed2;
} else {
if (red._x >= pet2._x + 20) {
pet2._x += petspeed2;
}
}
if (red._y <= pet2._y - 20) {
pet2._y -= petspeed2;
} else {
if (red._y >= pet2._y + 20) {
pet2._y += petspeed2;
}
}
} else {
petMoving2 = false;
desiredecision2();
}
}
function gotoBlue2() {
if (thirstnum2 <= 500) {
if (blue._x <= pet2._x - 20) {
pet2._x -= petspeed2;
} else {
if (blue._x >= pet2._x + 20) {
pet2._x += petspeed2;
}
}
if (blue._y <= pet2._y - 20) {
pet2._y -= petspeed2;
} else {
if (blue._y >= pet2._y + 20) {
pet2._y += petspeed2;
}
}
} else {
petMoving2 = false;
desiredecision2();
}
}
function gotoYellow2() {
if (funnum2 <= 500) {
if (yellow._x <= pet2._x - 20) {
pet2._x -= petspeed2;
} else {
if (yellow._x >= pet2._x + 20) {
pet2._x += petspeed2;
}
}
if (yellow._y <= pet2._y - 20) {
pet2._y -= petspeed2;
} else {
if (yellow._y >= pet2._y + 20) {
pet2._y += petspeed2;
}
}
} else {
petMoving2 = false;
desiredecision2();
}
}
function desiredecision2() {
if (petMoving2 == false) {
desiredecide2 = Math.ceil(Math.random() * 300) + 1;
}
if (desiredecide2 >= 20 && desiredecide2 <= 44) {
desire2 = 'FUN';
petMoving2 = true;
}
if (desiredecide2 >= 44 && desiredecide2 <= 70) {
desire2 = 'WARMTH';
petMoving2 = true;
}
if (desiredecide2 >= 70 && desiredecide2 <= 150) {
desire2 = 'H20';
petMoving2 = true;
}
}
function gotoRed3() {
if (warmthnum3 <= 100) {
if (red._x <= pet3._x - 20) {
pet3._x -= petspeed3;
} else {
if (red._x >= pet3._x + 20) {
pet3._x += petspeed3;
}
}
if (red._y <= pet3._y - 20) {
pet3._y -= petspeed3;
} else {
if (red._y >= pet3._y + 20) {
pet3._y += petspeed3;
}
}
} else {
petMoving3 = false;
desiredecision3();
}
}
function gotoBlue3() {
if (thirstnum3 <= 500) {
if (blue._x <= pet3._x - 20) {
pet3._x -= petspeed3;
} else {
if (blue._x >= pet3._x + 20) {
pet3._x += petspeed3;
}
}
if (blue._y <= pet3._y - 20) {
pet3._y -= petspeed3;
} else {
if (blue._y >= pet3._y + 20) {
pet3._y += petspeed3;
}
}
} else {
petMoving3 = false;
desiredecision3();
}
}
function gotoYellow3() {
if (funnum3 <= 500) {
if (yellow._x <= pet3._x - 20) {
pet3._x -= petspeed3;
} else {
if (yellow._x >= pet3._x + 20) {
pet3._x += petspeed3;
}
}
if (yellow._y <= pet3._y - 20) {
pet3._y -= petspeed3;
} else {
if (yellow._y >= pet3._y + 20) {
pet3._y += petspeed3;
}
}
} else {
petMoving3 = false;
desiredecision3();
}
}
function gotoGreen3() {
if (green._x <= pet3._x - 20) {
pet3._x -= petspeed3;
} else {
if (green._x >= pet3._x + 20) {
pet3._x += petspeed3;
}
}
if (green._y <= pet3._y - 20) {
pet3._y -= petspeed3;
} else {
if (green._y >= pet3._y + 20) {
pet3._y += petspeed3;
}
}
}
function desiredecision3() {
if (petMoving3 == false) {
desiredecide3 = Math.ceil(Math.random() * 300) + 1;
}
if (desiredecide3 >= 20 && desiredecide3 <= 44) {
desire3 = 'FUN';
petMoving3 = true;
}
if (desiredecide3 >= 44 && desiredecide3 <= 70) {
desire3 = 'WARMTH';
petMoving3 = true;
}
if (desiredecide3 >= 70 && desiredecide3 <= 150) {
desire3 = 'H20';
petMoving3 = true;
}
}
function gotoPurple4() {
if (warmthnum4 <= 100) {
if (purple._x <= circle1._x - 20) {
circle1._x -= petspeed4;
} else {
if (purple._x >= circle1._x + 20) {
circle1._x += petspeed4;
}
}
if (purple._y <= circle1._y - 20) {
circle1._y -= petspeed4;
} else {
if (purple._y >= circle1._y + 20) {
circle1._y += petspeed4;
}
}
} else {
petMoving4 = false;
desiredecision4();
}
}
function gotoOrange4() {
if (thirstnum4 <= 500) {
if (orange._x <= circle1._x - 20) {
circle1._x -= petspeed4;
} else {
if (orange._x >= circle1._x + 20) {
circle1._x += petspeed4;
}
}
if (orange._y <= circle1._y - 20) {
circle1._y -= petspeed4;
} else {
if (orange._y >= circle1._y + 20) {
circle1._y += petspeed4;
}
}
} else {
petMoving4 = false;
desiredecision4();
}
}
function gotoGreen4() {
if (funnum4 <= 500) {
if (green._x <= circle1._x - 20) {
circle1._x -= petspeed4;
} else {
if (green._x >= pet4._x + 20) {
circle1._x += petspeed4;
}
}
if (green._y <= circle1._y - 20) {
circle1._y -= petspeed4;
} else {
if (green._y >= circle1._y + 20) {
circle1._y += petspeed4;
}
}
} else {
petMoving4 = false;
desiredecision4();
}
}
function desiredecision4() {
if (petMoving4 == false) {
desiredecide4 = Math.ceil(Math.random() * 300) + 1;
}
if (desiredecide4 >= 20 && desiredecide4 <= 44) {
desire4 = 'FUN';
petMoving4 = true;
}
if (desiredecide4 >= 44 && desiredecide4 <= 70) {
desire4 = 'WARMTH';
petMoving4 = true;
}
if (desiredecide4 >= 70 && desiredecide4 <= 150) {
desire4 = 'H20';
petMoving4 = true;
}
}
MonstersInScene = new Array();
tag = 0;
var lovenum = 0;
var petspeed = 2;
var warmthnum = 50;
var thirstnum = 50;
var funnum = 50;
var desire = 'nothing1';
var petMoving = false;
var desiredecide;
var petspeed2 = 2;
var warmthnum2 = 50;
var thirstnum2 = 50;
var funnum2 = 50;
var desire2 = 'nothing2';
var petMoving2 = false;
var desiredecide2;
var petspeed3 = 2;
var warmthnum3 = 50;
var thirstnum3 = 50;
var funnum3 = 50;
var desire3 = 'nothing3';
var petMoving3 = false;
var desiredecide3;
var petspeed4 = 2;
var warmthnum4 = 50;
var thirstnum4 = 50;
var funnum4 = 50;
var desire4 = 'nothing4';
var petMoving4 = false;
var desiredecide4;
var lovecontact1 = false;
var lovecontact2 = false;
var lovecontact3 = false;
var lovecontact4 = false;
var babyborn = false;
SpawnEnemy = function () {
if (MonstersInScene.length <= 4) {
SpawnEnemyDiceRoll = Math.ceil(Math.random() * 2) + 0;
if (SpawnEnemyDiceRoll == 1) {
attachedObjcircle = _root.attachMovie('circle1', 'circle1' + tag, tag, {'_x': pet2._x + 200, '_y': pet2._y});
++tag;
attachedObjcircle.health = 100;
attachedObjcircle.speed = 4;
attachedObjcircle.hit = false;
attachedObjcircle.alive = true;
attachedObjcircle.gotoFunction = AIcircle;
MonstersInScene.push(attachedObjcircle);
++tag;
} else {
attachedObjcircle2 = _root.attachMovie('circle1', 'circle1' + tag, tag, {'_x': pet2._x + 200, '_y': pet2._y});
}
++tag;
attachedObjcircle2.health = 100;
attachedObjcircle2.speed = 4;
attachedObjcircle2.hit = false;
attachedObjcircle2.alive = true;
attachedObjcircle2.gotoFunction = AIcircle;
MonstersInScene.push(attachedObjcircle2);
++tag;
}
};
onEnterFrame = function () {
if (pet.hitTest(red)) {
warmthnum += 10;
thirstnum -= 4;
funnum -= 2;
}
if (pet.hitTest(blue)) {
thirstnum += 10;
funnum -= 5;
warmthnum -= 2;
}
if (pet.hitTest(yellow)) {
funnum += 10;
thirstnum -= 3;
warmthnum -= 1;
}
if (desire == 'WARMTH') {
gotoRed();
}
if (desire == 'H20') {
gotoBlue();
}
if (desire == 'FUN') {
gotoYellow();
}
if (pet2.hitTest(red)) {
warmthnum2 += 10;
thirstnum2 -= 4;
funnum2 -= 2;
}
if (pet2.hitTest(blue)) {
thirstnum2 += 10;
funnum2 -= 5;
warmthnum2 -= 2;
}
if (pet2.hitTest(yellow)) {
funnum2 += 10;
thirstnum2 -= 3;
warmthnum2 -= 1;
}
if (desire2 == 'WARMTH') {
gotoRed2();
}
if (desire2 == 'H20') {
gotoBlue2();
}
if (desire2 == 'FUN') {
gotoYellow2();
}
if (pet3.hitTest(red)) {
warmthnum3 += 10;
thirstnum3 -= 4;
funnum3 -= 2;
pet3._xscale += 0.1;
pet3._yscale += 0.3;
}
if (pet3.hitTest(blue)) {
thirstnum3 += 10;
funnum3 -= 5;
warmthnum3 -= 2;
pet3._xscale += 0.5;
pet3._yscale += 0.2;
}
if (pet3.hitTest(yellow)) {
funnum3 += 10;
thirstnum3 -= 3;
warmthnum3 -= 1;
pet3._xscale += 0.2;
pet3._yscale += 0.4;
}
if (desire3 == 'WARMTH') {
gotoRed3();
}
if (desire3 == 'H20') {
gotoBlue3();
}
if (desire3 == 'FUN') {
gotoYellow3();
}
if (circle1.hitTest(green)) {
warmthnum4 += 10;
thirstnum4 -= 4;
funnum4 -= 2;
}
if (circle1.hitTest(purple)) {
thirstnum4 += 10;
funnum4 -= 5;
warmthnum4 -= 2;
}
if (circle1.hitTest(orange)) {
funnum4 += 10;
thirstnum4 -= 3;
warmthnum4 -= 1;
}
if (desire4 == 'WARMTH') {
gotoGreen4();
}
if (desire4 == 'H20') {
gotoPurple4();
}
if (desire4 == 'FUN') {
gotoOrange4();
}
if (pet2.hitTest(pet)) {
if (lovecontact3 == false && lovecontact2 == true) {
lovenum = 3;
pet2._x -= 100;
pet2._y -= 100;
lovecontact3 = true;
babyborn = true;
SpawnEnemy();
}
if (lovecontact2 == false && lovecontact1 == true) {
lovenum = 2;
pet2._x -= 100;
pet2._y -= 100;
lovecontact2 = true;
SpawnEnemy();
}
if (lovecontact1 == false) {
lovenum = 1;
pet2._x -= 100;
pet2._y -= 100;
lovecontact1 = true;
SpawnEnemy();
}
}
if (babyborn == true) {
pet3._visible = true;
}
if (pet3._xscale >= 400) {
gotoGreen3();
}
desiredecision4();
desiredecision3();
desiredecision2();
desiredecision();
RenderEnemy();
};
}
movieClip 4 {
}
movieClip 6 {
}
movieClip 8 {
}
movieClip 10 {
}
movieClip 12 {
}
instance pet3 of movieClip 12 {
onClipEvent (load) {
this._visible = false;
}
}