Combined Code
movieClip 10 {
}
// unknown tag 88 length 67
button 14 {
on (press) {
trace('catAI in control');
_root.entitystatusforallcat = 'cat';
}
}
button 15 {
on (press) {
trace('player in control of cat');
_root.entitystatusforallcat = 'player';
}
}
movieClip 17 {
frame 7 {
removeMovieClip(_parent);
}
}
movieClip 19 bird {
frame 1 {
stop();
}
}
button 21 {
on (press) {
trace('catAI in control');
_root.entitystatusforallcat = 'cat';
}
}
button 22 {
on (press) {
trace('player in control of cat');
_root.entitystatusforallcat = 'player';
}
}
movieClip 26 {
frame 4 {
function playSound() {
var randomcatdie = Math.random() * 5 + 1;
if (catdead == false) {
if (randomcatdie >= 0 && randomcatdie <= 2) {
trace(randomcatdie);
catdieSound1 = new Sound(this);
catdieSound1.attachSound('catdie1');
catdieSound1.start();
}
if (randomcatdie >= 1 && randomcatdie <= 3) {
catdieSound2 = new Sound(this);
catdieSound2.attachSound('catdie2');
catdieSound2.start();
}
if (randomcatdie >= 2 && randomcatdie <= 4) {
catdieSound3 = new Sound(this);
catdieSound3.attachSound('catdie3');
catdieSound3.start();
}
if (randomcatdie >= 3 && randomcatdie <= 5) {
catdieSound4 = new Sound(this);
catdieSound4.attachSound('catdie4');
catdieSound4.start();
}
if (randomcatdie >= 4 && randomcatdie <= 6) {
catdieSound5 = new Sound(this);
catdieSound5.attachSound('catdie5');
catdieSound5.start();
}
}
catdead = true;
}
var catdead = false;
if (catdead == false) {
playSound();
}
}
frame 5 {
removeMovieClip(_parent);
}
}
movieClip 27 cat {
frame 1 {
stop();
}
}
movieClip 29 {
}
button 30 {
on (press) {
trace('dog AI in control');
_root.entitystatusforalldog = 'dog';
}
}
button 31 {
on (press) {
trace('dog AI in control');
_root.entitystatusforalldog = 'player';
}
}
movieClip 32 dog {
}
movieClip 34 attention {
}
movieClip 36 player {
}
frame 1 {
function AIdog() {
cathitcounter = 0;
while (cathitcounter < CatsInScene.length) {
if (this.hitTest(CatsInScene[cathitcounter])) {
bark = Math.ceil(Math.random() * 4) + 1;
if (bark == 1) {
this._x += 60;
} else {
if (bark == 2) {
this._y -= 60;
} else {
if (bark == 3) {
this._y += 60;
}
}
}
}
++cathitcounter;
}
if (this.hitTest(fire)) {
if (this.warmth <= 4) {
this.warmth += 2;
}
if (this.thirst >= 3) {
this.thirst -= 2;
}
}
if (this.hitTest(boring)) {
if (this.fun >= 2) {
this.fun -= 3;
}
}
if (this.hitTest(river)) {
if (this.warmth >= 4) {
this.warmth -= 2;
}
}
if (this.hitTest(red)) {
this.warmth += 1;
this.thirst -= 1;
}
if (this.hitTest(blue)) {
this.thirst += 1;
}
if (this.hitTest(yellow)) {
trace('weee');
this.fun += 1;
}
if (this.alive) {
var funtext = this.fun;
var thirsttext = this.thirst;
var warmthtext = this.warmth;
this.funnum.text = funtext;
this.thirstnum.text = thirsttext;
this.warmthnum.text = warmthtext;
this.entitystatus = entitystatusforalldog;
this.currenttarget = targetforalldog;
if (this.entitystatus == 'player') {
this.currenttarget = 'none';
if (Key.isDown(68)) {
this._x += 5;
}
if (Key.isDown(65)) {
this._x -= 5;
}
if (Key.isDown(87)) {
this._y -= 5;
}
if (Key.isDown(83)) {
this._y += 5;
}
} else {
if (this.entitystatus == 'dog') {
if (directionsgivendog == false) {
if (this.warmth <= 100) {
this.currenttarget = 'warmth';
} else {
if (this.fun <= 200) {
this.currenttarget = 'fun';
} else {
if (this.thirst <= 300) {
this.currenttarget = 'thirst';
}
}
}
} else {
this.currenttarget = targetforalldog;
}
if (this.currenttarget == 'player') {
if (player._x <= this._x - 30) {
this.body._xscale = -100;
this._x -= this.speed;
} else {
if (player._x >= this._x + 30) {
this._x += 5;
this.body._xscale = 100;
}
}
if (player._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (player._y >= this._y + 20) {
this._y += this.speed;
}
}
} else {
if (this.currenttarget == 'fun') {
if (this.fun <= 20) {
if (yellow._x >= this._x - 20) {
this._x += this.speed;
} else {
if (yellow._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (yellow._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (yellow._y >= this._y + 20) {
this._y += this.speed;
}
}
}
} else {
if (this.currenttarget == 'warmth') {
if (this.warmth <= 500) {
if (red._x >= this._x - 20) {
this._x += this.speed;
} else {
if (red._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (red._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (red._y >= this._y + 20) {
this._y += this.speed;
}
}
}
} else {
if (this.currenttarget == 'thirst') {
if (this.thirst <= 50) {
if (blue._x >= this._x - 20) {
this._x += this.speed;
} else {
if (blue._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (blue._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (blue._y >= this._y + 20) {
this._y += this.speed;
}
}
}
}
}
}
}
}
}
}
}
function AIcat() {
doghitcounter = 0;
while (doghitcounter < DogsInScene.length) {
if (this.hitTest(DogsInScene[doghitcounter])) {
trace('REEER!');
this.alive = false;
}
++doghitcounter;
}
if (this.hitTest(fire)) {
if (this.warmth <= 4) {
this.warmth += 2;
}
if (this.thirst >= 3) {
this.thirst -= 2;
}
}
if (this.hitTest(boring)) {
if (this.fun >= 2) {
this.fun -= 3;
}
}
if (this.hitTest(river)) {
if (this.warmth >= 4) {
this.warmth -= 2;
}
}
if (this.hitTest(red)) {
this.warmth += 1;
this.thirst -= 1;
}
if (this.hitTest(blue)) {
this.thirst += 1;
}
if (this.hitTest(yellow)) {
this.fun += 1;
}
if (this.alive) {
var funtext = this.fun;
var thirsttext = this.thirst;
var warmthtext = this.warmth;
this.funnum.text = funtext;
this.thirstnum.text = thirsttext;
this.warmthnum.text = warmthtext;
this.entitystatus = entitystatusforallcat;
this.currenttarget = targetforallcat;
if (this.entitystatus == 'player') {
this.currenttarget = 'none';
if (Key.isDown(68)) {
this._x += 5;
}
if (Key.isDown(65)) {
this._x -= 5;
}
if (Key.isDown(87)) {
this._y -= 5;
}
if (Key.isDown(83)) {
this._y += 5;
}
} else {
if (this.entitystatus == 'cat') {
if (this.warmth <= 100) {
this.currenttarget = 'warmth';
} else {
if (this.fun <= 200) {
this.currenttarget = 'fun';
} else {
if (this.thirst <= 300) {
this.currenttarget = 'thirst';
}
}
}
if (this.currenttarget == 'player') {
if (player._x <= this._x - 30) {
this.body._xscale = -100;
this._x -= this.speed;
} else {
if (player._x >= this._x + 30) {
this._x += 5;
this.body._xscale = 100;
}
}
if (player._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (player._y >= this._y + 20) {
this._y += this.speed;
}
}
} else {
if (this.currenttarget == 'fun') {
if (this.fun <= 20) {
if (yellow._x >= this._x - 20) {
this._x += this.speed;
} else {
if (yellow._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (yellow._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (yellow._y >= this._y + 20) {
this._y += this.speed;
}
}
}
} else {
if (this.currenttarget == 'warmth') {
if (this.warmth <= 500) {
if (red._x >= this._x - 20) {
this._x += this.speed;
} else {
if (red._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (red._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (red._y >= this._y + 20) {
this._y += this.speed;
}
}
}
} else {
if (this.currenttarget == 'thirst') {
if (this.thirst <= 50) {
if (blue._x >= this._x - 20) {
this._x += this.speed;
} else {
if (blue._x <= this._x + 20) {
this._x -= this.speed;
}
}
if (blue._y <= this._y - 20) {
this._y -= this.speed;
} else {
if (blue._y >= this._y + 20) {
this._y += this.speed;
}
}
}
}
}
}
}
}
}
} else {
this.gotoAndStop('death');
}
}
function desiredecision() {
trace('deciding');
}
function RenderDogs() {
counter = 0;
while (counter < DogsInScene.length) {
DogsInScene[counter].gotoFunction();
++counter;
}
}
function RenderCats() {
counter = 0;
while (counter < CatsInScene.length) {
CatsInScene[counter].gotoFunction();
++counter;
}
}
ambientSound = new Sound(this);
ambientSound.attachSound('park');
ambientSound.start(0, 99);
var directionsgivendog = false;
var targetgivendog = 'fun';
DogsInScene = new Array();
tag = 0;
var doglovenum = 0;
var dogspeed = 2;
var dogwarmth = 50;
var dogthirst = 50;
var dogfun = 50;
var dogdesire = 'nothing1';
var dogMoving = false;
var dogdesiredecide;
var targetforalldog = 'player';
var selectedentitydog = 'player';
var entitystatusforalldog = 'dog';
SpawnDog = function () {
if (DogsInScene.length <= 10) {
attachedObjdog = _root.attachMovie('dog', 'dog' + tag, tag, {'_x': 200, '_y': 200});
}
++tag;
attachedObjdog.health = 100;
attachedObjdog.speed = 4;
attachedObjdog.thirst = 4;
attachedObjdog.warmth = 4;
attachedObjdog.fun = 4;
attachedObjdog.hit = false;
attachedObjdog.alive = true;
attachedObjdog.moving = false;
attachedObjdog.directiongiven = false;
attachedObjdog.currenttarget = 'player';
attachedObjdog.entitystatus = 'none';
attachedObjdog.gotoFunction = AIdog;
DogsInScene.push(attachedObjdog);
++tag;
};
CatsInScene = new Array();
var catlovenum = 0;
var catspeed = 2;
var catwarmth = 50;
var catthirst = 50;
var catfun = 50;
var catdesire = 'nothing1';
var catMoving = false;
var catdesiredecide;
var targetforallcat = 'player';
var selectedentitycat = 'player';
var entitystatusforallcat = 'cat';
tag = 0;
SpawnCat = function () {
if (CatsInScene.length <= 9) {
attachedObjcat = _root.attachMovie('cat', 'cat' + tag, tag, {'_x': Math.ceil(Math.random() * 100) + 100, '_y': Math.ceil(Math.random() * 100) + 100, '_xscale': Math.ceil(Math.random() * 100) + 100});
}
++cattag;
attachedObjcat.health = 100;
attachedObjcat.speed = Math.ceil(Math.random() * 4) + 1;
attachedObjcat.thirst = 4;
attachedObjcat.warmth = 4;
attachedObjcat.fun = 4;
attachedObjcat.hit = false;
attachedObjcat.alive = true;
attachedObjcat.moving = false;
attachedObjcat.currenttarget = 'player';
attachedObjcat.entitystatus = 'none';
attachedObjcat.gotoFunction = AIcat;
CatsInScene.push(attachedObjcat);
++tag;
};
onEnterFrame = function () {
if (selectedentitydog == 'player') {
if (Key.isDown(68)) {
player._x += 5;
}
if (Key.isDown(65)) {
player._x -= 5;
}
if (Key.isDown(87)) {
player._y -= 5;
}
if (Key.isDown(83)) {
player._y += 5;
}
} else {
if (selectedentitydog == 'dog') {
} else {
if (selectedentitydog == 'cat') {
}
}
}
RenderDogs();
RenderCats();
if (DogsInScene.length >= 9) {
_root.dogspawnbutton._visible = false;
}
if (CatsInScene.length >= 9) {
_root.catspawnbutton._visible = false;
}
if (DogsInScene.hitTest(player)) {
trace('WOOO!');
}
};
}
movieClip 40 {
}
movieClip 41 {
}
movieClip 43 {
}
button 45 {
on (press) {
trace('clicked spawn');
_root.SpawnDog();
dogspawnSound = new Sound(this);
dogspawnSound.attachSound('dogbark');
dogspawnSound.start();
}
}
movieClip 47 {
}
button 48 {
on (press) {
trace('target fun');
_root.directionsgivendog = true;
_root.targetforalldog = 'fun';
}
}
button 49 {
on (press) {
trace('target player');
_root.directionsgivendog = true;
_root.targetforalldog = 'player';
}
}
button 50 {
on (press) {
trace('target warmth');
_root.directionsgivendog = true;
_root.targetforalldog = 'warmth';
}
}
movieClip 52 {
}
button 54 {
on (press) {
loadMovieNum(_url, 0);
}
}
// unknown tag 88 length 62
button 64 {
on (press) {
trace('clicked spawn cat');
_root.SpawnCat();
catspawnSound = new Sound(this);
catspawnSound.attachSound('catmeow');
catspawnSound.start();
}
}
button 66 {
on (press) {
trace('target fun');
_root.targetforallcat = 'fun';
}
}
button 67 {
on (press) {
trace('target player');
_root.targetforallcat = 'player';
}
}
button 68 {
on (press) {
trace('target warmth');
_root.targetforallcat = 'warmth';
}
}
button 69 {
on (press) {
_root.directionsgivendog = false;
}
}