Combined Code
movieClip 4 {
}
// unknown tag 88 length 67
button 8 {
on (press) {
trace('dog AI in control');
_root.entitystatusforall = 'dog';
}
}
button 9 {
on (press) {
trace('dog AI in control');
_root.entitystatusforall = 'player';
}
}
movieClip 10 dog {
}
movieClip 12 player {
}
frame 1 {
function AIdog() {
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 v4 = this.fun;
var v2 = this.thirst;
var v3 = this.warmth;
this.funnum.text = v4;
this.thirstnum.text = v2;
this.warmthnum.text = v3;
this.entitystatus = entitystatusforall;
this.currenttarget = targetforall;
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 (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;
}
}
}
}
}
}
}
}
}
}
}
function desiredecision() {
trace('deciding');
}
function RenderDogs() {
counter = 0;
while (counter < DogsInScene.length) {
DogsInScene[counter].gotoFunction();
++counter;
}
}
ambientSound = new Sound(this);
ambientSound.attachSound('park');
ambientSound.start(0, 99);
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 targetforall = 'player';
var selectedentity = 'player';
var entitystatusforall = '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.currenttarget = 'player';
attachedObjdog.entitystatus = 'none';
attachedObjdog.gotoFunction = AIdog;
DogsInScene.push(attachedObjdog);
++tag;
};
onEnterFrame = function () {
if (selectedentity == '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 (selectedentity == 'dog') {
}
}
RenderDogs();
if (DogsInScene.length >= 9) {
_root.dogspawnbutton._visible = false;
}
};
}
movieClip 15 {
}
button 18 {
on (press) {
trace('clicked spawn');
_root.SpawnDog();
dogspawnSound = new Sound(this);
dogspawnSound.attachSound('dogbark');
dogspawnSound.start();
}
}
movieClip 20 {
}
button 21 {
on (press) {
trace('target fun');
_root.targetforall = 'fun';
}
}
button 22 {
on (press) {
trace('target player');
_root.targetforall = 'player';
}
}
button 23 {
on (press) {
trace('target warmth');
_root.targetforall = 'warmth';
}
}
movieClip 25 {
}
button 27 {
on (press) {
loadMovieNum(_url, 0);
}
}
// unknown tag 88 length 62