Frame 1
function onMouseMove() {
mouseActive = true;
mouseActiveUntil = frameNum + 100;
ymouse = _ymouse;
xmouse = Math.max(leftX, _xmouse);
xmouse = Math.min(rightX, xmouse);
}
function update() {
frameNum++;
if (mouseActiveUntil < frameNum) {
mouseActive = false;
}
updateWheel();
updateFood();
}
function recycleFood(food) {
eatenFood.push(food);
food._visible = false;
var _local3 = freshFood.length;
var _local1 = 0;
while (_local1 < _local3) {
if (freshFood[_local1] == food) {
freshFood.splice(_local1, 1);
break;
}
_local1++;
}
}
function pushWheel(hamForce, hamX) {
var _local3 = hamX - wheel._x;
wheelVel = wheelVel + (_local3 * 0.03);
var _local1 = 0.04;
tarWheelVel = hamForce;
if (hamForce != 0) {
if (hamForce > (wheelVel + (_local1 * 2))) {
wheelVel = wheelVel + _local1;
} else if (hamForce < (wheelVel - (_local1 * 2))) {
wheelVel = wheelVel - _local1;
} else {
wheelVel = tarWheelVel;
}
}
}
function updateWheel() {
if (fric > 0.98) {
fricAcc = -0.01;
} else if (fric < 0.94) {
fricAcc = 0.01;
}
fric = fric + fricAcc;
wheelVel = wheelVel * fric;
wheelAng = wheelAng + ((wheelVel * distPerDeg) * (Math.PI/180));
var _local2 = (wheelRadius - 3) * Math.cos(wheelAng);
var _local1 = (wheelRadius - 3) * Math.sin(wheelAng);
wheelSpokes.clear();
wheelSpokes.lineStyle(2, wheelSpokeColor);
wheelSpokes.lineTo(-_local2, -_local1);
}
function updateFood() {
var _local2 = 0;
while (_local2 < freshFood.length) {
food = freshFood[_local2];
if (food.drag) {
var _local4 = food.pos.x;
var _local3 = food.pos.y;
food._x = (food.pos.x = Math.max(Math.min(_xmouse, rightX - food.radius), leftX + food.radius));
food._y = (food.pos.y = _ymouse);
food.vel.x = food.pos.x - _local4;
food.vel.y = food.pos.y - _local3;
} else {
var _local5 = 0.8;
var _local1 = 0.3;
food.vel.y = food.vel.y + _local5;
food.pos.y = food.pos.y + food.vel.y;
food.pos.x = food.pos.x + food.vel.x;
if ((food.pos.y + food.radius) > groundY) {
food.pos.y = groundY - food.radius;
food.vel.y = food.vel.y * -1;
food.vel.y = food.vel.y * _local1;
food.vel.x = food.vel.x * groundFric;
}
if (food.pos.x < (leftX + food.radius)) {
food.pos.x = leftX + food.radius;
food.vel.x = food.vel.x * -1;
food.vel.x = food.vel.x * _local1;
} else if (food.pos.x > (rightX - food.radius)) {
food.pos.x = rightX - food.radius;
food.vel.x = food.vel.x * -1;
food.vel.x = food.vel.x * _local1;
}
if (food.pos.y < (topY + food.radius)) {
food.pos.y = topY + food.radius;
food.vel.y = food.vel.y * -1;
food.vel.y = food.vel.y * _local1;
}
food._y = food.pos.y;
food._x = food.pos.x;
}
_local2++;
}
}
function onMouseUp() {
food.drag = false;
}
function onMouseDown() {
var _local1 = com.abowman.math.Trig.distTo(_xmouse, _ymouse, wheel._x, wheel._y);
if (_local1 <= (wheelRadius * 0.1)) {
ham.gotoWheel();
return(undefined);
}
if (eatenFood.length > 0) {
food = MovieClip(eatenFood.pop());
food._visible = true;
freshFood.push(food);
food.pos.x = (food._x = _xmouse);
food.pos.y = (food._y = _ymouse);
food.drag = true;
}
}
System.security.allowDomain("bin.clearspring.com");
System.security.allowDomain("widgets.clearspring.com");
var up_waterColor;
var up_foodColor;
var up_bgColor;
var up_wheelColor;
var up_bodyColor;
var up_eyeColor;
var up_earColor;
var up_feetColor;
var up_snoutColor;
var up_wheelOuterColor;
var waterColor;
var foodColor;
var bgColor;
var wheelColor;
var bodyColor;
var eyeColor;
var earColor;
var tailColor;
var feetColor;
var snoutColor;
var wheelOuterColor;
var rightX = 280;
var leftX = 0;
var topY = 0;
var xmouse;
var ymouse;
var wheelSpokeColor;
if (up_tailColor == undefined) {
tailColor = 15130302 /* 0xE6DEBE */;
} else {
tailColor = parseInt("0x" + up_tailColor);
}
if (up_foodColor == undefined) {
foodColor = 13347104 /* 0xCBA920 */;
} else {
foodColor = parseInt("0x" + up_foodColor);
}
if (up_waterColor == undefined) {
waterColor = 14741503 /* 0xE0EFFF */;
} else {
waterColor = parseInt("0x" + up_waterColor);
}
if (up_bgColor == undefined) {
bgColor = 16777215 /* 0xFFFFFF */;
} else {
bgColor = parseInt("0x" + up_bgColor);
}
if (up_wheelColor == undefined) {
wheelColor = 16777215 /* 0xFFFFFF */;
} else {
wheelColor = parseInt("0x" + up_wheelColor);
}
if (up_wheelSpokeColor == undefined) {
wheelSpokeColor = 14606046 /* 0xDEDEDE */;
} else {
wheelSpokeColor = parseInt("0x" + up_wheelSpokeColor);
}
if (up_bodyColor == undefined) {
bodyColor = 15130302 /* 0xE6DEBE */;
} else {
bodyColor = parseInt("0x" + up_bodyColor);
}
if (up_eyeColor == undefined) {
eyeColor = 0;
} else {
eyeColor = parseInt("0x" + up_eyeColor);
}
if (up_earColor == undefined) {
earColor = 13944984 /* 0xD4C898 */;
} else {
earColor = parseInt("0x" + up_earColor);
}
if (up_feetColor == undefined) {
feetColor = 13944984 /* 0xD4C898 */;
} else {
feetColor = parseInt("0x" + up_feetColor);
}
if (up_snoutColor == undefined) {
snoutColor = 16250089 /* 0xF7F4E9 */;
} else {
snoutColor = parseInt("0x" + up_snoutColor);
}
if (up_wheelOuterColor == undefined) {
wheelOuterColor = 14889522 /* 0xE33232 */;
} else {
wheelOuterColor = parseInt("0x" + up_wheelOuterColor);
}
if (up_wheelCenterColor == undefined) {
wheelCenterColor = 15002415 /* 0xE4EB2F */;
} else {
wheelCenterColor = parseInt("0x" + up_wheelCenterColor);
}
var bg = createEmptyMovieClip("bg", getNextHighestDepth());
var wheel = createEmptyMovieClip("wheel", getNextHighestDepth());
var wheelSpokes = wheel.createEmptyMovieClip("spokes", wheel.getNextHighestDepth());
var wheelCenter = wheel.createEmptyMovieClip("center", wheel.getNextHighestDepth());
var wheelRadius = 100;
var distPerDeg = (((Math.PI*2) * wheelRadius) / 360);
var water = WaterBottle.create(this, getNextHighestDepth(), {w:52, h:125, bottleColor:52479, waterColor:waterColor, capColor:3355443, cornerRadius:5});
var mouseActive;
var mouseActiveUntil;
var frameNum = 0;
water._x = 5;
water._y = 5;
var grav = 0.8;
var groundY = 210;
var groundFric = 0.8;
var sw = 550;
var fricAcc = 0.01;
var fric = 0.98;
bg.lineStyle(2);
bg.beginFill(bgColor);
com.abowman.graphics.Draw.drawRoundRect(bg, leftX, topY, rightX, groundY, 5);
bg.endFill();
wheel.lineStyle(6, 3355443);
wheel.beginFill(wheelColor);
com.abowman.graphics.Draw.drawOval(wheel, 0, 0, wheelRadius, wheelRadius);
wheel.endFill();
wheel.lineStyle(3, wheelOuterColor);
com.abowman.graphics.Draw.drawOval(wheel, 0, 0, wheelRadius, wheelRadius);
wheelCenter.lineStyle(2, 3355443);
wheelCenter.beginFill(wheelCenterColor);
com.abowman.graphics.Draw.drawOval(wheelCenter, 0, 0, wheelRadius * 0.08, wheelRadius * 0.08);
wheelCenter.endFill();
wheel._x = 167;
wheel._y = 105;
var ham = Hamster.create(this, getNextHighestDepth(), {bodyColor:bodyColor, eyeColor:eyeColor, earColor:earColor, feetColor:feetColor, snoutColor:snoutColor, tailColor:tailColor});
var txtFormat = new TextFormat();
txtFormat.size = 14;
txtFormat.font = "Icicle Country 2";
var color = 0;
if (bgColor == color) {
color = 16777215 /* 0xFFFFFF */;
}
txtFormat.color = color;
txtFormat.url = "http://aBowman.com/google-modules/hamster";
txtFormat.target = "_top";
var aBowman = this;
aBowman.createTextField("txt", aBowman.getNextHighestDepth(), 0, 0, 50, 50);
aBowman.txt.antiAliasType = "advanced";
aBowman.txt.gridFitType = "subpixel";
aBowman.txt.autoSize = true;
aBowman.txt.text = "aBowman";
aBowman.txt.embedFonts = true;
aBowman.txt.html = true;
aBowman.txt.setTextFormat(txtFormat);
aBowman.txt._x = 218;
aBowman.txt._y = -1;
wheelCenter.onPress = function () {
};
ham.groundY = groundY;
ham.tiltHead(-0.471238898038469);
wheel.force = 0;
var wheelVel = 0;
var tarWheelVel = 0;
var wheelAng = 0;
var getOffWheel;
var getOnWheel;
var food;
var freshFood = new Array();
var eatenFood = new Array();
var totFood = 10;
var waterPos = {};
waterPos.x = water._x + water.spoutX;
waterPos.y = water._y + water.spoutY;
var i = 0;
while (i < totFood) {
eatenFood[i] = Food.create(this, this.getNextHighestDepth(), {color:foodColor, radius:4});
eatenFood[i]._visible = false;
i++;
}
var activeFood = 0;
var dest = {};
onEnterFrame = update;
Symbol 2 MovieClip [__Packages.WaterBottle] Frame 0
class WaterBottle extends MovieClip
{
var bottleColor, waterColor, capColor, tubeColor, w, h, capH, capW, tubeH, tubeW, cornerRadius, mcTube, createEmptyMovieClip, getNextHighestDepth, mcCap, mcBottle, mcWaterMask, mcWater, spoutY, spoutX;
function WaterBottle () {
super();
}
static function create(parent, depth, args) {
var _local1 = WaterBottle(parent.attachMovie(symbolName, "WaterBottle" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
bottleColor = args.bottleColor;
waterColor = args.waterColor;
capColor = args.capColor;
tubeColor = 10066329 /* 0x999999 */;
w = args.w;
h = args.h;
capH = h / 10;
capW = w / 2;
tubeH = 20;
tubeW = 6;
cornerRadius = args.cornerRadius;
mcTube = createEmptyMovieClip("mcTube", getNextHighestDepth());
mcCap = createEmptyMovieClip("mcCap", getNextHighestDepth());
mcBottle = createEmptyMovieClip("mcBottle", getNextHighestDepth());
mcWaterMask = createEmptyMovieClip("mcWaterMask", getNextHighestDepth());
mcWater = createEmptyMovieClip("mcWater", getNextHighestDepth());
mcWater.setMask(mcWaterMask);
mcCap._y = h;
mcCap._x = (w / 2) - (capW / 2);
mcTube._x = mcCap._x + (capW * 0.5);
mcTube._y = mcCap._y + (capH * 0.95);
var _local3 = -35;
mcTube._rotation = _local3;
spoutY = mcTube._y + (Math.sin((Math.PI/2) + ((_local3 * Math.PI) / 180)) * tubeH);
spoutX = mcTube._x + (Math.cos((Math.PI/2) + ((_local3 * Math.PI) / 180)) * tubeH);
trace(Math.sin((_local3 * Math.PI) / 180) * tubeH);
draw();
}
function draw() {
mcBottle.lineStyle(2, lineColor);
com.abowman.graphics.Draw.drawRoundRect(mcBottle, 0, 0, w, h, cornerRadius);
mcWaterMask.beginFill(waterColor);
com.abowman.graphics.Draw.drawRoundRect(mcWaterMask, 1, 1, w - 2, h - 2, cornerRadius);
mcWaterMask.endFill();
mcWater.beginFill(waterColor);
com.abowman.graphics.Draw.drawRoundRect(mcWater, 0, 0, w, h, 0);
mcWater.endFill();
mcCap.lineStyle(2, lineColor);
mcCap.beginFill(capColor);
com.abowman.graphics.Draw.drawRoundRect(mcCap, 0, 0, capW, capH, 0);
mcCap.endFill();
mcTube.lineStyle(2, lineColor);
mcTube.beginFill(tubeColor);
com.abowman.graphics.Draw.drawRoundRect(mcTube, (-tubeW) * 0.5, 0, tubeW, tubeH, 0);
mcTube.endFill();
}
static var symbolName = "__Packages.WaterBottle";
static var symbolLinked = Object.registerClass(symbolName, WaterBottle);
var lineColor = 0;
}
Symbol 3 MovieClip [__Packages.com.abowman.graphics.Draw] Frame 0
class com.abowman.graphics.Draw
{
function Draw () {
}
static function drawOval(mc, x, y, rx, ry) {
mc.moveTo(rx + x, y);
mc.curveTo(rx + x, (0.4142 * ry) + y, (0.7071 * rx) + x, (0.7071 * ry) + y);
mc.curveTo((0.4142 * rx) + x, ry + y, x, ry + y);
mc.curveTo((-0.4142 * rx) + x, ry + y, (-0.7071 * rx) + x, (0.7071 * ry) + y);
mc.curveTo((-rx) + x, (0.4142 * ry) + y, (-rx) + x, y);
mc.curveTo((-rx) + x, (-0.4142 * ry) + y, (-0.7071 * rx) + x, (-0.7071 * ry) + y);
mc.curveTo((-0.4142 * rx) + x, (-ry) + y, x, (-ry) + y);
mc.curveTo((0.4142 * rx) + x, (-ry) + y, (0.7071 * rx) + x, (-0.7071 * ry) + y);
mc.curveTo(rx + x, (-0.4142 * ry) + y, rx + x, y);
}
static function drawRoundRect(mc, x, y, w, h, cornerRadius) {
if (arguments.length < 4) {
return(undefined);
}
if (cornerRadius > 0) {
var _local3;
var _local4;
var _local9;
var _local8;
var _local11;
var _local10;
if (cornerRadius > (Math.min(w, h) / 2)) {
cornerRadius = Math.min(w, h) / 2;
}
_local3 = (Math.PI/4);
mc.moveTo(x + cornerRadius, y);
mc.lineTo((x + w) - cornerRadius, y);
_local4 = -1.5707963267949;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x + w, (y + h) - cornerRadius);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x + cornerRadius, y + h);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x, y + cornerRadius);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
} else {
mc.moveTo(x, y);
mc.lineTo(x + w, y);
mc.lineTo(x + w, y + h);
mc.lineTo(x, y + h);
mc.lineTo(x, y);
}
}
static function drawOval2(mc, x, y, rx, ry, ang) {
var _local17 = rx;
var _local20 = 0.7071 * rx;
var _local18 = 0.4142 * rx;
var _local16 = ry;
var _local19 = 0.7071 * ry;
var _local22 = 0.4142 * ry;
var _local14 = {x:_local17, y:_local22};
var _local13 = {x:_local20, y:_local19};
var _local12 = {x:_local18, y:_local16};
var _local11 = {x:0, y:_local16};
var _local7 = {x:-_local17, y:0};
var _local10 = {x:-_local17, y:_local22};
var _local9 = {x:-_local20, y:_local19};
var _local8 = {x:-_local18, y:_local16};
if ((ang != 0) && (ang != undefined)) {
var _local6 = Math.cos(ang);
var _local5 = Math.sin(ang);
var _local2 = _local14.x;
var _local1 = _local14.y;
_local14.x = (_local6 * _local2) - (_local5 * _local1);
_local14.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local13.x;
_local1 = _local13.y;
_local13.x = (_local6 * _local2) - (_local5 * _local1);
_local13.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local12.x;
_local1 = _local12.y;
_local12.x = (_local6 * _local2) - (_local5 * _local1);
_local12.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local11.x;
_local1 = _local11.y;
_local11.x = (_local6 * _local2) - (_local5 * _local1);
_local11.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local7.x;
_local1 = _local7.y;
_local7.x = (_local6 * _local2) - (_local5 * _local1);
_local7.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local10.x;
_local1 = _local10.y;
_local10.x = (_local6 * _local2) - (_local5 * _local1);
_local10.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local9.x;
_local1 = _local9.y;
_local9.x = (_local6 * _local2) - (_local5 * _local1);
_local9.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local8.x;
_local1 = _local8.y;
_local8.x = (_local6 * _local2) - (_local5 * _local1);
_local8.y = (_local6 * _local1) + (_local5 * _local2);
}
mc.moveTo((-_local7.x) + x, (-_local7.y) + y);
mc.curveTo(_local14.x + x, _local14.y + y, _local13.x + x, _local13.y + y);
mc.curveTo(_local12.x + x, _local12.y + y, _local11.x + x, _local11.y + y);
mc.curveTo(_local8.x + x, _local8.y + y, _local9.x + x, _local9.y + y);
mc.curveTo(_local10.x + x, _local10.y + y, _local7.x + x, _local7.y + y);
mc.curveTo((-_local14.x) + x, (-_local14.y) + y, (-_local13.x) + x, (-_local13.y) + y);
mc.curveTo((-_local12.x) + x, (-_local12.y) + y, (-_local11.x) + x, (-_local11.y) + y);
mc.curveTo((-_local8.x) + x, (-_local8.y) + y, (-_local9.x) + x, (-_local9.y) + y);
mc.curveTo((-_local10.x) + x, (-_local10.y) + y, (-_local7.x) + x, (-_local7.y) + y);
}
static function drawSquare2(mc, x, y, rx, ry, ang) {
var _local12 = rx;
var _local11 = ry;
var _local1 = {x:_local12, y:0};
var _local2 = {x:0, y:_local11};
if ((ang != 0) && (ang != undefined)) {
var _local8 = Math.cos(ang);
var _local7 = Math.sin(ang);
var _local4 = _local1.x;
var _local3 = _local1.y;
_local1.x = (_local8 * _local4) - (_local7 * _local3);
_local1.y = (_local8 * _local3) + (_local7 * _local4);
_local4 = _local2.x;
_local3 = _local2.y;
_local2.x = (_local8 * _local4) - (_local7 * _local3);
_local2.y = (_local8 * _local3) + (_local7 * _local4);
}
mc.moveTo(_local1.x + x, _local1.y + y);
mc.lineTo(_local2.x + x, _local2.y + y);
mc.lineTo((-_local1.x) + x, (-_local1.y) + y);
mc.lineTo((-_local2.x) + x, (-_local2.y) + y);
mc.lineTo(_local1.x + x, _local1.y + y);
}
static function drawRect(mc, x1, y1, width, height) {
mc.moveTo(x1, y1);
mc.lineTo(x1 + width, y1);
mc.lineTo(x1 + width, y1 + height);
mc.lineTo(x1, y1 + height);
mc.lineTo(x1, y1);
}
static function drawWedge(mc, x, y, startAngle, arc, radius, yRadius) {
if (arguments.length < 5) {
return(undefined);
}
mc.moveTo(x, y);
if (yRadius == undefined) {
yRadius = radius;
}
var _local20;
var _local2;
var _local3;
var _local5;
var _local14;
var _local19;
var _local18;
var _local13;
var _local11;
var _local12;
var _local10;
if (Math.abs(arc) > 360) {
arc = 360;
}
_local14 = Math.ceil(Math.abs(arc) / 45);
_local20 = arc / _local14;
_local2 = (-(_local20 / 180)) * Math.PI;
_local3 = (-(startAngle / 180)) * Math.PI;
if (_local14 > 0) {
_local19 = x + (Math.cos((startAngle / 180) * Math.PI) * radius);
_local18 = y + (Math.sin(((-startAngle) / 180) * Math.PI) * yRadius);
mc.lineTo(_local19, _local18);
var _local4 = 0;
while (_local4 < _local14) {
_local3 = _local3 + _local2;
_local5 = _local3 - (_local2 / 2);
_local13 = x + (Math.cos(_local3) * radius);
_local11 = y + (Math.sin(_local3) * yRadius);
_local12 = x + (Math.cos(_local5) * (radius / Math.cos(_local2 / 2)));
_local10 = y + (Math.sin(_local5) * (yRadius / Math.cos(_local2 / 2)));
mc.curveTo(_local12, _local10, _local13, _local11);
_local4++;
}
mc.lineTo(x, y);
}
}
static function drawArc(mc, x, y, radius, arc, startAngle, yRadius) {
if (arguments.length < 5) {
return(null);
}
if (yRadius == undefined) {
yRadius = radius;
}
var _local17;
var _local3;
var _local2;
var _local5;
var _local14;
var _local10;
var _local8;
var _local9;
var _local7;
var _local13;
var _local12;
if (Math.abs(arc) > 360) {
arc = 360;
}
_local14 = Math.ceil(Math.abs(arc) / 45);
_local17 = arc / _local14;
_local3 = (-(_local17 / 180)) * Math.PI;
_local2 = (-(startAngle / 180)) * Math.PI;
_local10 = x - (Math.cos(_local2) * radius);
_local8 = y - (Math.sin(_local2) * yRadius);
if (_local14 > 0) {
var _local4 = 0;
while (_local4 < _local14) {
_local2 = _local2 + _local3;
_local5 = _local2 - (_local3 / 2);
_local9 = _local10 + (Math.cos(_local2) * radius);
_local7 = _local8 + (Math.sin(_local2) * yRadius);
_local13 = _local10 + (Math.cos(_local5) * (radius / Math.cos(_local3 / 2)));
_local12 = _local8 + (Math.sin(_local5) * (yRadius / Math.cos(_local3 / 2)));
mc.curveTo(_local13, _local12, _local9, _local7);
_local4++;
}
}
return({x:_local9, y:_local7});
}
static function calcGradient(hex, percent) {
var _local2 = hexToRGB(hex);
var _local1 = RGBToHLS(_local2.r, _local2.g, _local2.b);
_local1.l = _local1.l * (percent / 100);
if (_local1.l > 240) {
_local1.l = 240;
}
if (_local1.l < 0) {
_local1.l = 0;
}
_local2 = HLSToRGB(_local1.h, _local1.l, _local1.s);
return(RGBToHex(_local2.r, _local2.g, _local2.b));
}
static function hexToRGB(hex) {
var _local1 = new Object();
_local1.r = hex >> 16;
var _local2 = hex ^ (_local1.r << 16);
_local1.g = _local2 >> 8;
_local1.b = _local2 ^ (_local1.g << 8);
return(_local1);
}
static function RGBToHex(r, g, b) {
var _local1 = ((r << 16) ^ (g << 8)) ^ b;
return(_local1);
}
static function RGBToHLS(r, g, b) {
var _local9;
var _local8;
var _local7;
var _local1 = Math.max(Math.max(r, g), b) / 255;
var _local5 = Math.min(Math.min(r, g), b) / 255;
var _local2 = _local1 - _local5;
_local8 = (_local1 + _local5) / 2;
_local7 = ((_local1 == _local5) ? 0 : (((_local8 <= 0.5) ? ((_local2 / _local8) / 2) : (_local2 / (2 - (_local8 * 2))))));
if ((r / 255) == _local1) {
_local9 = ((g - b) / _local2) / 255;
} else if ((g / 255) == _local1) {
_local9 = 2 + (((b - r) / _local2) / 255);
} else if ((b / 255) == _local1) {
_local9 = 4 + (((r - g) / _local2) / 255);
}
_local9 = _local9 * 40;
if (_local9 < 0) {
_local9 = _local9 + 240;
}
_local9 = Math.round(_local9);
return({h:(isNaN(_local9) ? 0 : (_local9)), l:Math.round(_local8 * 240), s:Math.round(_local7 * 240)});
}
static function HLSToRGB(h, l, s) {
var _local10;
var _local11;
var _local9;
if (s == 0) {
_local9 = Math.round((l / 240) * 255);
_local11 = _local9;
_local10 = _local11;
} else {
h = h / 240;
l = l / 240;
s = s / 240;
var _local2;
var _local1;
var _local5 = ((l < 0.5) ? (l * (s + 1)) : ((l + s) - (l * s)));
var _local4 = (l * 2) - _local5;
var _local3 = 0;
while (_local3 < 3) {
switch (_local3) {
case 0 :
_local1 = h + 0.333333333333333;
break;
case 1 :
_local1 = h;
break;
case 2 :
_local1 = h - 0.333333333333333;
}
if (_local1 < 0) {
_local1++;
} else if (_local1 > 1) {
_local1--;
}
if ((_local1 * 6) < 1) {
_local2 = _local4 + (((_local5 - _local4) * 6) * _local1);
} else if ((_local1 * 2) < 1) {
_local2 = _local5;
} else if ((_local1 * 3) < 2) {
_local2 = _local4 + (((_local5 - _local4) * (0.666666666666667 - _local1)) * 6);
} else {
_local2 = _local4;
}
switch (_local3) {
case 0 :
_local10 = Math.round(_local2 * 255);
break;
case 1 :
_local11 = Math.round(_local2 * 255);
break;
case 2 :
_local9 = Math.round(_local2 * 255);
}
_local3++;
}
}
return({r:_local10, g:_local11, b:_local9});
}
}
Symbol 4 MovieClip [__Packages.Food] Frame 0
class Food extends MovieClip
{
var color, radius, pos, vel, active, _visible, lineStyle, beginFill, endFill, _x, _y;
function Food () {
super();
}
static function create(parent, depth, args) {
var _local1 = Food(parent.attachMovie(symbolName, "Food" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
color = args.color;
radius = args.radius;
pos = {x:0, y:0};
vel = {x:0, y:0};
draw(radius);
}
function hide() {
active = false;
_visible = false;
}
function draw(radius) {
lineStyle(1);
beginFill(color);
com.abowman.graphics.Draw.drawOval(this, 0, 0, radius, radius);
endFill();
}
function update() {
pos.x = pos.x + vel.x;
pos.y = pos.y + vel.y;
pos.x = Math.max(pos.x, 1);
pos.x = Math.min(pos.x, Stage.width);
pos.y = Math.max(pos.y, 1);
pos.y = Math.min(pos.y, Stage.height);
_x = pos.x;
_y = pos.y;
if (active && (!_visible)) {
_visible = true;
}
}
static var symbolName = "__Packages.Food";
static var symbolLinked = Object.registerClass(symbolName, Food);
}
Symbol 5 MovieClip [__Packages.Hamster] Frame 0
class Hamster extends MovieClip
{
var cageRight, app, cageLeft, tailColor, groundY, lookHere, midHandPt, mouthPt, lowEarDepth1, getNextHighestDepth, lowEarDepth2, mcLines, createEmptyMovieClip, lowHeadDepth, mcBody, legFL, legFR, foodDepth, legRL, legRR, legAngF, legAngR, legs, mcTail, mcSegB, mcHead, mcHeadCrown, hiHeadDepth, mcHeadZ, bottomDepth, mcMouthR, mcFaceUpperR, mcEye1, mcEar1, mcHeadX, mcMouthL, mcFaceUpperL, mcEye2, depth2, mcEar2, hiEarDepth1, hiEarDepth2, onEnterFrame, mcHiDepth1, mcHiDepth2, mcHeadHiDepth1, mcHeadHiDepth2, _y, _x, eyesClosed, sleeping, sleepAtDest, getOffWheel, getOnWheel, wheelClicked, food, dest, goingTo, eating, sniffing, gotoRandomAt, stopDrinkAt, drinkStartAt, drinking, stopCleanAt, cleaning, legQuad, isTired, restAt, sleepID, runAt, tarWheelAng, _rotation, lookPt;
function Hamster () {
super();
}
static function create(parentMC, depth, args) {
var _local1 = parentMC.attachMovie(symbolName, "Hamster" + depth, depth);
_local1.app = parentMC;
_local1.depth = depth;
_local1.init(args);
return(_local1);
}
function init(args) {
cageRight = app.rightX;
cageLeft = app.leftX;
var _local26;
var _local8;
var _local6;
var _local2;
var _local9;
var _local5;
var _local10;
_local8 = args.eyeColor;
_local6 = args.earColor;
_local9 = args.snoutColor;
tailColor = args.tailColor;
trace("earColor=" + _local6);
_local5 = (bodyColor = args.bodyColor);
_local10 = _local5;
groundY = app.groundY;
_local2 = args.feetColor;
lookHere = {};
midHandPt = {};
mouthPt = {};
lowEarDepth1 = getNextHighestDepth();
lowEarDepth2 = getNextHighestDepth() + 1;
mcLines = createEmptyMovieClip("mcLines", getNextHighestDepth() + 2);
lowHeadDepth = getNextHighestDepth() + 3;
var _local3 = _local10;
var _local11 = 13;
mcBody = createEmptyMovieClip("mcBody", getNextHighestDepth());
updateLegs(1, 0);
legFL = LegV2.create(this, getNextHighestDepth() + 4, {legLen:_local11, footLen:3, footColor:_local2, fillColor:_local3, col:0, base:legBaseFL, frontPt:frontInLeftPt, rearPt:midChestPt, sidePt:frontLeftPt, len:0, angOffset:Math.PI, front:true});
legFR = LegV2.create(this, getNextHighestDepth(), {legLen:_local11, footLen:3, footColor:_local2, fillColor:_local3, col:0, base:legBaseFR, frontPt:frontInRightPt, rearPt:midChestPt, sidePt:frontRightPt, len:0, angOffset:0, front:true});
foodDepth = getNextHighestDepth() + 1;
legRL = LegV2.create(this, getNextHighestDepth() + 2, {legLen:_local11, footLen:12, footColor:_local2, fillColor:_local3, col:0, base:legBaseRL, frontPt:legInnerR, sidePt:rearLeftPt, rearPt:rearPt, len:0, angOffset:(Math.PI/2)});
legRR = LegV2.create(this, getNextHighestDepth(), {legLen:_local11, footLen:12, footColor:_local2, fillColor:_local3, col:0, base:legBaseRR, frontPt:legInnerR, sidePt:rearRightPt, rearPt:rearPt, len:0, angOffset:4.71238898038469});
var _local7 = (Math.PI/2);
legRR.legAng = (legRL.legAng = (legAngF = _local7));
legFR.legAng = (legFL.legAng = (legAngR = _local7));
ht = (legBaseFR.y + 2) + (Math.sin(_local7) * _local11);
legs = new Array();
legs.push(legRR);
legs.push(legFR);
legs.push(legRL);
legs.push(legFL);
legs[0].num = 0;
legs[1].num = 1;
legs[2].num = 2;
legs[3].num = 3;
mcTail = mcBody.createEmptyMovieClip("mcTail", mcBody.getNextHighestDepth());
mcSegB = mcBody.createEmptyMovieClip("mcSegB", mcBody.getNextHighestDepth());
mcHead = createEmptyMovieClip("mcHead", getNextHighestDepth() + 20);
mcHeadCrown = mcHead.createEmptyMovieClip("mcHeadCrown", mcHead.getNextHighestDepth());
mcHeadCrown._y = 0;
mcHeadCrown.beginFill(bodyColor);
com.abowman.graphics.Draw.drawOval(mcHeadCrown, 0, 0, 15, 15);
mcHeadCrown.endFill();
hiHeadDepth = mcHead.getDepth();
mcHeadZ = createHeadYZ(mcHead, -20, -16, 40, 29, _local5);
mcHeadZ.trans({x:5, y:0, z:0});
bottomDepth = mcHeadZ.getDepth();
mcMouthR = createMouthSide(mcHead, mcHead.getNextHighestDepth(), 1, _local9);
mcFaceUpperR = createFaceUpperSide(mcHead, mcHead.getNextHighestDepth(), 1, _local5);
mcEye1 = createEye(mcHead, mcHead.getNextHighestDepth(), _local8);
mcEye1.rotateX(-0.15707963267949);
mcEye1.rotateY(-0.471238898038469);
mcEye1.scale(1.3);
mcEar1 = createHamsterearPt(this, getNextHighestDepth() + 10, 16, 16, 1, _local6);
mcEar1.rotateZ(-0.785398163397448);
mcEar1.rotateY(-0.785398163397448);
mcEar1.scale(0.7);
mcHeadX = createHeadXY(mcHead, 35, 40, _local5);
mcHeadX.scale(0.6);
mcHeadX.trans({x:0, y:2, z:0});
mcMouthL = createMouthSide(mcHead, mcHead.getNextHighestDepth(), -1, _local9);
mcFaceUpperL = createFaceUpperSide(mcHead, mcHead.getNextHighestDepth(), -1, _local5);
mcEye2 = createEye(mcHead, mcHead.getNextHighestDepth(), _local8);
mcEye2.rotateX(0.15707963267949);
mcEye2.rotateY(0.471238898038469);
mcEye2.scale(1.3);
depth2 = mcHead.getNextHighestDepth();
mcEar2 = createHamsterearPt(this, getNextHighestDepth() + 1, 16, 16, -1, _local6);
mcEar2.rotateZ(-0.785398163397448);
mcEar2.rotateY((Math.PI/4));
mcEar2.scale(0.7);
hiEarDepth1 = mcEar1.getDepth();
hiEarDepth2 = mcEar2.getDepth();
mcHead._y = 0;
tiltHead(0);
onEnterFrame = update;
setInterval(this, "randomStumble", 3000);
mcHiDepth1 = createEmptyMovieClip("mcHiDepth1", getNextHighestDepth());
mcHiDepth2 = createEmptyMovieClip("mcHiDepth2", getNextHighestDepth());
mcHeadHiDepth1 = mcHead.createEmptyMovieClip("mcHeadHiDepth1", mcHead.getNextHighestDepth());
mcHeadHiDepth2 = mcHead.createEmptyMovieClip("mcHeadHiDepth2", mcHead.getNextHighestDepth());
if (Math.random() > 0.5) {
_y = groundY - ht;
_x = app.wheel._x + ((Math.random() * app.wheelRadius) * 2);
isOnWheel = true;
ang = Math.PI;
} else {
_y = groundY - ht;
_x = 50 + (Math.random() * 200);
ang = Math.random() * Math.PI;
getRandomDest();
}
trace("mcEye1.opoints[1].y=" + mcEye1.opoints[1].y);
trace("mcEye1.opoints[1].y=" + mcEye1.opoints[1].y);
blink();
}
function blink() {
closeEyes();
_global.setTimeout(this, "blink", 5000 + (Math.random() * 30000));
}
function closeEyes() {
eyesClosed = true;
}
function sleep() {
sleeping = true;
closeEyes();
}
function wakeUp() {
eyesClosed = false;
sleeping = false;
sleepAtDest = false;
}
function goToSleep() {
getRandomDest();
sleepAtDest = true;
if (isOnWheel) {
getOffWheel = true;
}
}
function randomStumble() {
if (Math.random() > 0.5) {
legVel = legVel * Math.random();
}
}
function lookForFood() {
var _local8 = -1000;
var _local7 = 1000;
var _local12 = 50;
var _local11 = ang + headAng;
if (_local11 < (Math.PI/4)) {
_local8 = _x - _local12;
} else if (_local11 > 2.35619449019234) {
_local7 = _x + _local12;
}
var _local5 = app.freshFood;
var _local10 = _local5.length;
var _local9;
var _local3;
var _local4;
var _local6 = 1000;
var _local2 = 0;
while (_local2 < _local10) {
_local3 = _local5[_local2]._x;
if ((_local3 > _local8) && (_local3 < _local7)) {
_local4 = Math.abs(_local3 - _x);
if (_local4 < _local6) {
_local9 = _local5[_local2];
_local6 = _local4;
}
}
_local2++;
}
if (_local9 != undefined) {
gotoFood(_local9);
}
}
function gotoWheel() {
if (!isOnWheel) {
getOnWheel = true;
wheelClicked = true;
}
}
function gotoFood(food) {
this.food = food;
dest = food.pos;
goingTo = FOOD;
}
function setHeadAng(a) {
headAng = a;
}
function drawTail(mc, x, y, w, h, ang, fillColor) {
var _local2 = {x:0, y:h / 2};
var _local3 = {x:-w, y:0};
if ((ang != 0) && (ang != undefined)) {
var _local10 = Math.cos(ang);
var _local9 = Math.sin(ang);
var _local7 = _local2.x;
var _local6 = _local2.y;
_local2.x = (_local10 * _local7) - (_local9 * _local6);
_local2.y = (_local10 * _local6) + (_local9 * _local7);
_local7 = _local3.x;
_local6 = _local3.y;
_local3.x = (_local10 * _local7) - (_local9 * _local6);
_local3.y = (_local10 * _local6) + (_local9 * _local7);
}
mc.clear();
mc.beginFill(fillColor);
mc.moveTo(_local2.x + x, _local2.y + y);
mc.lineTo(_local3.x + x, _local3.y + y);
mc.lineTo((-_local2.x) + x, (-_local2.y) + y);
mc.endFill();
mcLines.moveTo(_local2.x + x, _local2.y + y);
mcLines.lineTo(_local3.x + x, _local3.y + y);
mcLines.lineTo((-_local2.x) + x, (-_local2.y) + y);
}
function createEye(mc, depth, fillColor) {
var _local4 = new Array();
_local4.push({x:3, y:0, z:0});
_local4.push({x:0, y:-5.5, z:0, curve:true});
_local4.push({x:-3, y:0, z:0});
_local4.push({x:0, y:5, z:0, curve:true});
return(HamsterPart.create(mc, depth, {points:_local4, fillColor:fillColor, lineColor:fillColor}));
}
function createHamsterearPt(mc, depth, w, h, side, fillColor) {
var _local3 = new Array();
_local3.push({x:0, y:0, z:0});
_local3.push({x:0, y:-11, z:0});
_local3.push({x:0, y:-18, z:0, curve:true});
_local3.push({x:-9, y:-18, z:0});
_local3.push({x:-18, y:-18, z:0, curve:true});
_local3.push({x:-18, y:-9, z:0});
_local3.push({x:-17, y:-2, z:0, curve:true});
_local3.push({x:-12, y:0, z:0});
return(HamsterPart.create(mc, depth, {points:_local3, fillColor:fillColor}));
}
function createMouthSide(mcHead, depth, side, fillColor) {
var _local1 = new Array();
_local1.push({x:-1, y:-5, z:side * 3, lineColor:3355443});
_local1.push({x:2, y:-4, z:0});
_local1.push({x:0, y:3, z:0});
_local1.push({x:-8, y:6, z:0, lineColor:fillColor});
_local1.push({x:-30, y:5, z:side * 8});
_local1.push({x:-25, y:0, z:side * 15});
_local1.push({x:-10, y:0, z:side * 8});
_local1.push({x:-1, y:-5, z:side * 3});
return(HamsterPart.create(mcHead, depth, {points:_local1, fillColor:fillColor}));
}
function createFaceUpperSide(mcHead, depth, side, fillColor) {
var _local1 = new Array();
_local1.push({x:0, y:-8, z:0});
_local1.push({x:-8, y:-16, z:0});
_local1.push({x:-30, y:-18, z:side * 15});
_local1.push({x:-25, y:0, z:side * 15});
_local1.push({x:-10, y:0, z:side * 8});
_local1.push({x:0, y:-8, z:0});
return(HamsterPart.create(mcHead, depth, {points:_local1, fillColor:fillColor}));
}
function createHeadXY(mcHead, nh, nw, fillColor) {
var _local4 = new Array();
_local4.push({x:10, y:-31, z:0});
_local4.push({x:32, y:-31, z:0, curve:true});
_local4.push({x:45, y:-18, z:0});
_local4.push({x:58, y:-4, z:undefined});
_local4.push({x:59, y:3, z:0});
_local4.push({x:54, y:13, z:0});
_local4.push({x:37, y:19, z:0});
_local4.push({x:14, y:20, z:undefined});
return(HamsterPart.create(mcHead, mcHead.getNextHighestDepth(), {points:_local4, fillColor:fillColor}));
}
function createHeadYZ(mcHead, nx, ny, nw, nh, fillColor) {
var _local3 = new Array();
_local3.push({x:0, y:11, z:-8});
_local3.push({x:0, y:6, z:-15});
_local3.push({x:0, y:0, z:-18});
_local3.push({x:0, y:-9, z:-15});
_local3.push({x:0, y:-14, z:-8});
_local3.push({x:0, y:-15, z:0});
_local3.push({x:0, y:-14, z:8});
_local3.push({x:0, y:-9, z:15});
_local3.push({x:0, y:0, z:18});
_local3.push({x:0, y:6, z:15});
_local3.push({x:0, y:11, z:9});
_local3.push({x:0, y:14, z:0});
_local3.push({x:0, y:11, z:-8});
return(HamsterPart.create(mcHead, mcHead.getNextHighestDepth(), {points:_local3, fillColor:fillColor}));
}
function createHeadXZ(mcHead, nx, ny, nw, nh, fillColor) {
var _local3 = new Array();
_local3.push({x:6, y:0, z:-18});
_local3.push({x:28, y:0, z:-6});
_local3.push({x:32, y:0, z:-3});
_local3.push({x:35, y:0, z:0});
_local3.push({x:32, y:0, z:3});
_local3.push({x:28, y:0, z:6});
_local3.push({x:6, y:0, z:18});
return(HamsterPart.create(mcHead, mcHead.getNextHighestDepth(), {points:_local3, fillColor:fillColor}));
}
function eatFood() {
if (foodInMouth) {
food._x = mouthPt.x - _x;
food._y = mouthPt.y - _y;
var _local2 = com.abowman.math.Trig.distTo(midHandPt.x - _x, midHandPt.y - _y, food._x, food._y);
if (_local2 < 5) {
foodInMouth = false;
}
} else {
food._x = midHandPt.x - _x;
food._y = midHandPt.y - _y;
nodHead();
}
eating = true;
}
function nodHead(ang, acc) {
if (acc == undefined) {
acc = chewAcc;
}
if (ang == undefined) {
ang = maxChewAng;
}
if (chewAng > ang) {
chewVel = chewVel - acc;
} else {
chewVel = chewVel + acc;
}
chewAng = chewAng + chewVel;
}
function sniffFood() {
if (sniffing) {
nodHead();
if (stopSniffAt <= frameNum) {
sniffing = false;
startSniffAt = frameNum + int(Math.random() * maxSniff);
}
} else if (startSniffAt <= frameNum) {
sniffing = true;
stopSniffAt = frameNum + int(Math.random() * maxSniff);
}
}
function lookRandom() {
if (lookRandomAt == undefined) {
lookRandomAt = (frameNum + minLookRandom) + int(Math.random() * maxLookRandom);
}
if (lookRandomAt <= frameNum) {
var _local2 = 40;
var _local3 = _x - (_local2 / 2);
if (ang < (Math.PI/4)) {
_local3 = _x;
} else if (ang > 2.35619449019234) {
_local2 = _x - _local2;
}
lookRandomAt = (frameNum + minLookRandom) + int(Math.random() * maxLookRandom);
lookHere.x = _local3 + (_local2 * Math.random());
lookHere.y = _y - (50 * Math.random());
}
}
function gotoRandom() {
if (gotoRandomAt == undefined) {
gotoRandomAt = (frameNum + minGotoRandom) + int(Math.random() * (maxGotoRandom - minGotoRandom));
}
if (gotoRandomAt < frameNum) {
getRandomDest();
}
}
function getRandomDest() {
trace("getRandomDest");
dest = {};
var _local2 = 300;
if (_x < (_local2 / 2)) {
dest.x = (_local2 * 0.5) + ((Math.random() * _local2) * 0.3);
dest.x = Math.max(_x + 100, dest.x);
} else {
dest.x = (_local2 * 0.5) - ((Math.random() * _local2) * 0.3);
dest.x = Math.min(_x - 100, dest.x);
}
lookHere.y = (dest.y = _y);
lookHere.x = dest.x;
goingTo = RANDOM;
gotoRandomAt = undefined;
}
function stopEating() {
eating = false;
food.removeMovieClip();
food = undefined;
dest = undefined;
waterLevel = waterLevel - 2;
}
function pickUpFood() {
var _local3 = food.color;
var _local5 = food.radius;
dest = {x:food.pos.x, y:food.pos.y};
app.recycleFood(food);
food = Food.create(this, foodDepth, {color:_local3, radius:_local5});
if (goingTo == FOOD) {
goingTo = NOTHING;
}
foodInMouth = true;
eatFood();
_global.setTimeout(this, "stopEating", minEatTime + (Math.random() * maxEatTime));
}
function look(lookPt) {
var _local3 = this;
var _local5 = _local3.mcHead._x + _local3._x;
var _local10 = _local3.mcHead._y + _local3._y;
var _local8 = lookPt.x;
var _local7 = lookPt.y;
var _local6 = Math.abs(_local8 - _local5);
var _local9 = _local7 - _local10;
var _local2;
var _local4;
var _local12 = _local5 + Math.max(_local6, 30);
_local2 = com.abowman.math.Trig.angleTo(_local5, _local10, _local12, _local7);
_local4 = _local3.headAngZ + ((_local2 - _local3.headAngZ) * 0.2);
_local3.tiltHead(_local4 + chewAng);
_local2 = _local3.ang;
_local6 = _local8 - _local5;
_local9 = 30 * Math.sin(_local2);
var _local13 = Math.atan2(_local9, _local6);
_local2 = com.abowman.math.Trig.fixAngle(_local13 - _local2);
if (_local2 > Math.PI) {
_local2 = -3.14159265358979 + (_local2 % Math.PI);
}
_local2 = Math.min(_local2, 2.1);
_local2 = Math.max(_local2, -2.1);
_local4 = _local2;
var _local11 = _local3.headAng;
_local4 = _local11 + ((_local2 - _local11) * 0.3);
_local3.setHeadAng(_local4);
}
function getAngToPoint(pt) {
var _local2 = com.abowman.math.Trig.angleTo(_x, _y, _x + 30, pt.y);
return(_local2 + (Math.PI*2));
}
function drink() {
nodHead();
if (stopDrinkAt == undefined) {
stopDrinkAt = (frameNum + minDrink) + ((maxDrink - minDrink) * Math.random());
drinkStartAt = frameNum;
drinking = true;
}
if (stopDrinkAt < frameNum) {
waterLevel = (frameNum - drinkStartAt) * 0.1;
drinking = false;
goingTo = NOTHING;
stopDrinkAt = undefined;
trace("*****waterLevel" + waterLevel);
}
}
function cleanFace(cosAng, sinAng) {
if (stopCleanAt == undefined) {
stopCleanAt = (frameNum + minClean) + ((maxClean - minClean) * Math.random());
if ((ang > 2.35619449019234) && (ang < 3.92699081698724)) {
legFL.swapDepths(mcHiDepth2);
} else if ((ang < (Math.PI/4)) || (ang > 5.49778714378214)) {
legFR.swapDepths(mcHiDepth2);
} else if ((ang > (Math.PI/4)) && (ang < 2.35619449019234)) {
legFR.swapDepths(mcHiDepth1);
legFL.swapDepths(mcHiDepth2);
}
}
handZ = 2;
lookHere.x = ((cosAng * 40) + _x) + mcHead._x;
lookHere.y = (25 + _y) + mcHead._y;
legCleanVel = 0.8;
legCleanAng = legCleanAng + legCleanVel;
legAngF = 0.471238898038469;
legFR.moveOval(legCleanAng, cosAng, sinAng, 2, 2, 0);
legFL.moveOval(legCleanAng, cosAng, sinAng, 2, 2, 0);
nodHead();
if (stopCleanAt < frameNum) {
cleaning = false;
stopCleanAt = undefined;
legQuad = 0;
}
}
function decideWhatToDo() {
if (waterLevel <= 0) {
if (goingTo != WATER) {
waterLevel = 0;
goingTo = WATER;
dest = app.waterPos;
lookHere.x = dest.x;
lookHere.y = dest.y;
if (isOnWheel) {
isOnWheel = false;
getOnWheel = true;
isTired = false;
restAt = undefined;
}
}
return(undefined);
}
if (app.freshFood.length > 0) {
lookForFood();
}
if (goingTo == FOOD) {
if (sleepID != undefined) {
_global.clearTimeout(sleepID);
sleepID = undefined;
}
if (isOnWheel) {
isOnWheel = false;
isTired = false;
restAt = undefined;
}
lookHere.x = food._x;
lookHere.y = food._y;
var _local6 = food._x - ((mcHead._x + mcMouthR._x) + _x);
var _local5 = food._y - ((mcHead._y + mcMouthR._y) + _y);
if (food.drag) {
if ((Math.abs(_local6) < 35) && (Math.abs(_local5) < 25)) {
lookHere.y = lookHere.y - 15;
}
}
if ((Math.abs(_local6) < 5) && (Math.abs(_local5) < 5)) {
if (food.drag || ((food._y + food.radius) == groundY)) {
pickUpFood();
}
}
sniffFood();
return(undefined);
}
if (app.mouseActive) {
if (sleepID != undefined) {
_global.clearTimeout(sleepID);
sleepID = undefined;
}
if (!wheelClicked) {
if (goingTo != MOUSE) {
dest = {};
gotoRandomAt = undefined;
goingTo = MOUSE;
}
lookHere.x = (dest.x = app.xmouse);
lookHere.y = (dest.y = app.ymouse);
runAt = undefined;
return(undefined);
}
} else if (goingTo == MOUSE) {
dest = undefined;
goingTo = NOTHING;
}
if (getOnWheel) {
dest = {};
var _local3 = app.wheel._x;
var _local7 = app.wheel._y;
var _local4 = app.wheel._width / 2;
if (_x < _local3) {
dest.x = _local3 + (_local4 * 1.5);
tarWheelAng = 0;
} else {
dest.x = _local3 - (_local4 * 1.5);
tarWheelAng = Math.PI;
}
goingTo = WHEEL;
getOnWheel = false;
dest.y = _local7 + (_local4 * 0.5);
lookHere.x = dest.x;
lookHere.y = dest.y;
}
if (goingTo == WHEEL) {
if ((dest.x - app.wheel._x) > 0) {
if (((_x - app.wheel._x) > -10) && (ang < 1.25663706143592)) {
isOnWheel = true;
goingTo = NOTHING;
legVel = 0.2;
wheelClicked = false;
}
} else if (((_x - app.wheel._x) < 10) && (ang > 1.88495559215388)) {
isOnWheel = true;
goingTo = NOTHING;
legVel = 0.2;
wheelClicked = false;
}
return(undefined);
}
if (goingTo == NOTHING) {
if (sleepID == undefined) {
sleepID = _global.setTimeout(this, "goToSleep", sleepInterval);
trace("sleepID=" + sleepID);
}
if ((!sleeping) && (!isOnWheel)) {
lookRandom();
gotoRandom();
if ((Math.random() * 90) < 1) {
cleaning = true;
}
if (runAt == undefined) {
runAt = (frameNum + minWait) + ((maxWait - minWait) * Math.random());
}
if (frameNum > runAt) {
isTired = false;
restAt = undefined;
runAt = undefined;
getOnWheel = true;
}
}
} else {
lookRandomAt = undefined;
}
}
function runOnWheel(cos, sin) {
var _local7 = ht;
var _local8 = cos;
var _local3 = app.wheel;
var _local6 = app.wheelRadius - 3;
var _local4 = com.abowman.math.Trig.angleTo(_local3._x, _local3._y, _x, _y);
_x = (Math.cos(_local4) * (_local6 - _local7)) + _local3._x;
_y = (Math.sin(_local4) * (_local6 - _local7)) + _local3._y;
if (isTired) {
legVel = legVel - hamAcc;
} else {
legVel = legVel + hamAcc;
}
legVel = Math.max(0, legVel);
legVel = Math.min(maxHamVel, legVel);
var _local2 = (_local8 * legVel) * hamVelToForce;
app.pushWheel(_local2, _x);
_local2 = _local2 - app.wheelVel;
var _local5 = _local4 - (Math.PI/2);
vx = Math.cos(_local5) * _local2;
vy = Math.sin(_local5) * _local2;
_y = _y + vy;
_x = _x + vx;
_rotation = (_local5 * 180) / Math.PI;
run(cos, sin);
if (legVel > 0) {
angAcc = ((dir * maxAngAcc) * legVel) / maxHamVel;
if (int(Math.random() * angChance) == (angChance / 2)) {
dir = dir * -1;
}
ang = ang + angAcc;
if (tarWheelAng == 0) {
if ((ang < -0.2) || (ang > 0.2)) {
ang = ang + ((-ang) * 0.2);
}
} else if ((ang < 2.94159265358979) || (ang > 3.34159265358979)) {
ang = ang + ((Math.PI - ang) * 0.2);
}
if ((ang < 0.01) && (ang > 0)) {
ang = 0;
}
}
}
function update() {
frameNum++;
lookPt = lookHere;
var _local3 = Math.cos(ang);
var _local5 = Math.sin(ang);
mouthPt.x = ((mcMouthR.opoints[2].cx + mcHead._x) + mcMouthR._x) + _x;
mouthPt.y = ((mcMouthR.opoints[2].cy + mcHead._y) + mcMouthR._y) + _y;
midHandPt.x = ((legFR.ftPos.xpos + legFL.ftPos.xpos) / 2) + _x;
midHandPt.y = ((legFR.ftPos.ypos + legFL.ftPos.ypos) / 2) + _y;
if ((((!sleeping) && (!eating)) && (!drinking)) && (!cleaning)) {
decideWhatToDo();
} else if (sleeping && (app.mouseActive)) {
wakeUp();
}
var _local12;
if (isOnWheel) {
lookHere.x = _x + (50 * _local3);
lookHere.y = _y;
}
if (lookPt != undefined) {
_local12 = getAngToPoint(lookPt);
}
legAngR = (Math.PI/2);
legAngF = (Math.PI/2);
handZ = 20;
var _local6 = walkAng;
if (isOnWheel) {
lookHere.x = _x + (70 * _local3);
lookHere.y = _y - 20;
if (isTired) {
if (runAt == undefined) {
runAt = (frameNum + minRest) + ((maxRest - minRest) * Math.random());
trace("runAt=" + runAt);
}
if (frameNum > runAt) {
isTired = false;
restAt = undefined;
}
} else {
if (restAt == undefined) {
restAt = (frameNum + minRun) + ((maxRun - minRun) * Math.random());
trace("restAt=" + restAt);
}
if (frameNum > restAt) {
isTired = true;
runAt = undefined;
if ((Math.random() * 3) < 1) {
getOffWheel = true;
}
}
}
if (getOffWheel && (legVel < 0.3)) {
getOffWheel = false;
isOnWheel = false;
isTired = false;
restAt = undefined;
runAt = undefined;
dest = {};
if (ang > (Math.PI/2)) {
dest.x = app.wheel._x - app.wheelRadius;
} else {
dest.x = app.wheel._x + app.wheelRadius;
}
dest.y = groundY - 20;
lookHere.y = (dest.y = _y - (Math.random() * 50));
lookHere.x = dest.x;
goingTo = RANDOM;
gotoRandomAt = undefined;
}
if ((frameNum % 500) == 0) {
trace("-2");
waterLevel = waterLevel - 2;
}
runOnWheel(_local3, _local5);
} else {
if (goingTo != NOTHING) {
if (goingTo == WATER) {
if (Math.abs(lookHere.x - mouthPt.x) < 20) {
lookHere.y = app.waterPos.y - 15;
drink();
}
} else if ((_local12 < 5.3) && (Math.abs(lookPt.x - _x) < 60)) {
_local6 = _local12;
legAngR = 1.25663706143592;
handZ = 8;
}
} else if (sleepAtDest) {
_local6 = walkAng;
legAngR = 0.471238898038469;
legAngF = 0.471238898038469;
handZ = 4;
lookHere.x = _x + (50 * _local3);
lookHere.y = _y + 10;
_global.setTimeout(this, "sleep", 1000 + (Math.random() * 2000));
} else {
_local6 = eatStandAng;
legAngR = (Math.PI/4);
handZ = 8;
}
if (eating) {
lookHere.x = ((_local3 * 40) + _x) + mcHead._x;
lookHere.y = (30 + _y) + mcHead._y;
lookPt = lookHere;
legAngF = (Math.PI/4);
legAngR = (Math.PI/4);
handZ = 4;
_local6 = eatStandAng;
eatFood();
} else if (cleaning) {
_local6 = eatStandAng;
cleanFace(_local3, _local5);
}
vy = vy + grav;
_y = _y + vy;
if ((_y + ht) >= groundY) {
vy = 0;
vx = 0;
_y = groundY - ht;
}
if (_rotation != 0) {
_rotation = _rotation + ((-_rotation) * 0.5);
if (Math.abs(_rotation) <= 1) {
_rotation = 0;
}
}
if (dest != undefined) {
var _local15 = walk(_local3, _local5);
if ((!_local15) && (goingTo == RANDOM)) {
goingTo = NOTHING;
}
} else {
legRR.update4({x:0, z:0}, _local3, _local5);
legRL.update4({x:0, z:0}, _local3, _local5);
}
if (isStanding && (!cleaning)) {
legFR.updateLeg(_local3, _local5, -1.5707963267949);
legFL.updateLeg(_local3, _local5, -1.5707963267949);
}
}
standTo2(_local6);
if (lookPt != undefined) {
look(lookPt);
}
mcLines.clear();
mcLines.lineStyle(outlineWidth);
headPos.xpos = (mcBody._x + (_local3 * headPos.x)) + (_local5 * headPos.z);
headPos.ypos = (mcBody._y + headPos.y) - headBounce;
mcHead._x = headPos.xpos;
mcHead._y = headPos.ypos;
updateHead();
legBaseFR.z = legBaseFR.z + (((-handZ) - legBaseFR.z) * 0.3);
legBaseFL.z = legBaseFL.z + ((handZ - legBaseFL.z) * 0.3);
legRR.legAng = legRR.legAng + ((legAngR - legRR.legAng) * 0.2);
legRL.legAng = legRL.legAng + ((legAngR - legRL.legAng) * 0.2);
legFR.legAng = legFR.legAng + ((legAngF - legFR.legAng) * 0.2);
legFL.legAng = legFL.legAng + ((legAngF - legFL.legAng) * 0.2);
ht = (legBaseRR.y + 2) + (Math.sin(legRR.legAng) * legRR.legLen);
updateLegs(_local3, _local5);
var _local4 = com.abowman.math.Trig.fixAngle(headAng + ang);
if (headAngZ > -0.3) {
if ((_local4 <= 2) && (_local4 >= 1)) {
if (!ear1Top) {
mcEar1.swapDepths(hiEarDepth1);
ear1Top = true;
}
if (!ear2Top) {
mcEar2.swapDepths(hiEarDepth2);
ear2Top = true;
}
} else if ((_local4 > 2) && (_local4 < 4)) {
if (!ear1Top) {
mcEar1.swapDepths(hiEarDepth1);
ear1Top = true;
}
if (ear2Top) {
mcEar2.swapDepths(lowEarDepth2);
ear2Top = false;
}
} else if ((_local4 < 1) || (_local4 > 5.44)) {
if (ear1Top) {
mcEar1.swapDepths(lowEarDepth1);
ear1Top = false;
}
if (!ear2Top) {
mcEar2.swapDepths(hiEarDepth2);
ear2Top = true;
}
} else {
if (ear1Top) {
mcEar1.swapDepths(lowEarDepth1);
ear1Top = false;
}
if (ear2Top) {
mcEar2.swapDepths(lowEarDepth2);
ear2Top = false;
}
}
} else if ((_local4 <= 1.75) && (_local4 >= 1.35)) {
if (!ear1Top) {
mcEar1.swapDepths(hiEarDepth1);
ear1Top = true;
}
if (!ear2Top) {
mcEar2.swapDepths(hiEarDepth2);
ear2Top = true;
}
} else if ((_local4 > 1.75) && (_local4 < 4)) {
if (!ear1Top) {
mcEar1.swapDepths(hiEarDepth1);
ear1Top = true;
}
if (ear2Top) {
mcEar2.swapDepths(lowEarDepth2);
ear2Top = false;
}
} else if ((_local4 < 1.35) || (_local4 > 5.44)) {
if (ear1Top) {
mcEar1.swapDepths(lowEarDepth1);
ear1Top = false;
}
if (!ear2Top) {
mcEar2.swapDepths(hiEarDepth2);
ear2Top = true;
}
} else {
if (ear1Top) {
mcEar1.swapDepths(lowEarDepth1);
ear1Top = false;
}
if (ear2Top) {
mcEar2.swapDepths(lowEarDepth2);
ear2Top = false;
}
}
if ((legQuad != 1) && ((ang < (Math.PI/4)) || (ang > 5.49778714378214))) {
legQuad = 1;
legFR.swapDepths(legFR.depth + 10);
legFL.swapDepths(legFL.depth);
legRL.swapDepths(legRL.depth);
legRR.swapDepths(legRR.depth + 10);
} else if ((legQuad != 2) && ((ang > (Math.PI/4)) && (ang < 2.35619449019234))) {
legQuad = 2;
legFR.swapDepths(legFR.depth + 10);
legFL.swapDepths(legFL.depth + 15);
legRL.swapDepths(legRL.depth);
legRR.swapDepths(legRR.depth + 5);
} else if ((legQuad != 3) && ((ang > 2.35619449019234) && (ang < 3.92699081698724))) {
legQuad = 3;
legFR.swapDepths(legFR.depth);
legFL.swapDepths(legFL.depth + 10);
legRL.swapDepths(legRL.depth + 10);
legRR.swapDepths(legRR.depth);
} else if ((legQuad != 4) && ((ang > 3.92699081698724) && (ang < 5.49778714378214))) {
legQuad = 4;
legFR.swapDepths(legFR.depth);
legFL.swapDepths(legFL.depth);
legRL.swapDepths(legRL.depth + 10);
legRR.swapDepths(legRR.depth + 10);
}
mcSegB.clear();
mcSegB.beginFill(bodyColor);
var _local11 = (rearBodyPt.xpos + frontBodyPt.xpos) * 0.5;
var _local10 = (rearBodyPt.ypos + frontBodyPt.ypos) * 0.5;
var _local8 = rearBodyPt.xpos - frontBodyPt.xpos;
var _local7 = rearBodyPt.ypos - frontBodyPt.ypos;
var _local9 = Math.sqrt((_local8 * _local8) + (_local7 * _local7)) / 2;
var _local13 = Math.atan2(_local7, _local8);
com.abowman.graphics.Draw.drawOval2(mcSegB, _local11, _local10, _local9 + radiusA, radiusB, _local13);
mcSegB.endFill();
mcBody.clear();
mcBody.lineStyle(2);
tailPos.xpos = (mcBody._x + (_local3 * tailPos.x)) + (_local5 * tailPos.z);
tailPos.ypos = mcBody._y + tailPos.y;
mcTail.clear();
mcTail.lineStyle(1);
_local8 = rearBodyPt.xpos - tailPos.xpos;
_local7 = rearBodyPt.ypos - tailPos.ypos;
var _local14 = Math.atan2(_local7, _local8);
drawTail(mcTail, tailPos.xpos, tailPos.ypos, 4, 7, _local14, tailColor);
com.abowman.graphics.Draw.drawOval2(mcLines, _local11, _local10, _local9 + radiusA, radiusB, _local13);
var _local17 = app.waterX;
var _local16 = app.waterY;
legFL.render2(mcLines);
legFR.render2(mcLines);
legRR.render2(mcLines);
legRL.render2(mcLines);
}
function updateHead() {
var _local2 = ang + headAng;
mcBody.lineStyle(2);
var _local3 = Math.cos(_local2);
var _local4 = Math.sin(_local2);
mcEye1._x = (_local3 * eyePt.x) + (eyeGap * _local4);
mcEye1._y = eyePt.y;
mcEye2._x = (_local3 * eyePt.x) - (eyeGap * _local4);
mcEye2._y = eyePt.y;
mcEye2.ang = _local2;
mcEye2.update();
mcEye1.ang = _local2;
mcEye1.update();
mcHeadZ.ang = _local2;
mcHeadZ.update(mcLines, mcHead._x, mcHead._y);
mcHeadX.ang = _local2;
mcHeadX.update(mcLines, mcHead._x, mcHead._y);
if ((_local3 > 0) && (topEye == 1)) {
mcEye1.swapDepths(mcEye2);
mcMouthR.swapDepths(mcMouthL);
mcFaceUpperR.swapDepths(mcFaceUpperL);
topEye = 2;
} else if ((_local3 < 0) && (topEye == 2)) {
mcEye1.swapDepths(mcEye2);
mcMouthR.swapDepths(mcMouthL);
mcFaceUpperR.swapDepths(mcFaceUpperL);
topEye = 1;
}
if ((headAngZ < -0.4) && (!mouthOnTop)) {
if (topEye == 2) {
mcHeadHiDepth1.swapDepths(mcMouthL);
mcHeadHiDepth2.swapDepths(mcMouthR);
} else {
mcHeadHiDepth2.swapDepths(mcMouthL);
mcHeadHiDepth1.swapDepths(mcMouthR);
}
mouthOnTop = true;
} else if ((headAngZ > -0.4) && (mouthOnTop)) {
if (topEye == 2) {
mcHeadHiDepth1.swapDepths(mcMouthL);
mcHeadHiDepth2.swapDepths(mcMouthR);
} else {
mcHeadHiDepth2.swapDepths(mcMouthL);
mcHeadHiDepth1.swapDepths(mcMouthR);
}
mouthOnTop = false;
}
mcMouthL._x = (mcMouthR._x = _local3 * snoutPt.x);
mcMouthL._y = (mcMouthR._y = snoutPt.y);
mcMouthL.ang = (mcMouthR.ang = _local2);
mcMouthR.update(mcLines, mcHead._x + mcMouthR._x, mcHead._y + mcMouthR._y);
mcMouthL.update(mcLines, mcHead._x + mcMouthL._x, mcHead._y + mcMouthL._y);
mcFaceUpperR._x = _local3 * snoutPt.x;
mcFaceUpperR._y = snoutPt.y;
mcFaceUpperR.ang = _local2;
mcFaceUpperR.update(mcLines, mcHead._x + mcFaceUpperR._x, mcHead._y + mcFaceUpperR._y);
mcFaceUpperL._x = _local3 * snoutPt.x;
mcFaceUpperL._y = snoutPt.y;
mcFaceUpperL.ang = _local2;
mcFaceUpperL.update(mcLines, mcHead._x + mcFaceUpperL._x, mcHead._y + mcFaceUpperL._y);
mcEar1.ang = _local2;
mcEar1._x = ((_local3 * earPt.x) + (earGap * _local4)) + mcHead._x;
mcEar1._y = earPt.y + mcHead._y;
mcEar1.update();
mcEar2.ang = _local2;
mcEar2._x = ((_local3 * earPt.x) - (earGap * _local4)) + mcHead._x;
mcEar2._y = earPt.y + mcHead._y;
mcEar2.update();
mcHeadCrown._x = (neckLen * 0.5) * _local3;
mcHeadCrown._y = neckLen * Math.sin(headAngZ);
com.abowman.graphics.Draw.drawOval(mcLines, mcHead._x + mcHeadCrown._x, mcHead._y + mcHeadCrown._y, 15, 15);
if (eyesClosed) {
eyesCloseFrac = eyesCloseFrac - 0.3;
eyesCloseFrac = Math.max(0, eyesCloseFrac);
} else if ((!sleeping) && (eyesCloseFrac < 1)) {
eyesCloseFrac = eyesCloseFrac + 0.3;
}
if (eyesCloseFrac < 1) {
if (eyesCloseFrac == 0) {
mcEye1.clear();
mcEye1.lineStyle(1, mcEye1.lineColor);
mcEye1.moveTo(mcEye1.opoints[0].cx, mcEye1.opoints[0].cy);
mcEye1.lineTo(mcEye1.opoints[2].cx, mcEye1.opoints[2].cy);
mcEye2.clear();
mcEye2.lineStyle(1, mcEye2.lineColor);
mcEye2.moveTo(mcEye2.opoints[0].cx, mcEye2.opoints[0].cy);
mcEye2.lineTo(mcEye2.opoints[2].cx, mcEye2.opoints[2].cy);
eyesClosed = false;
} else {
var _local6 = mcEye1.opoints[1].cx;
var _local5 = mcEye1.opoints[1].cy * eyesCloseFrac;
var _local8 = mcEye1.opoints[3].cx;
var _local7 = mcEye1.opoints[3].cy * eyesCloseFrac;
mcEye1.clear();
mcEye1.beginFill(mcEye1.fillColor);
mcEye1.lineStyle(1, mcEye1.lineColor);
mcEye1.moveTo(mcEye1.opoints[0].cx, mcEye1.opoints[0].cy);
mcEye1.curveTo(_local6, _local5, mcEye1.opoints[2].cx, mcEye1.opoints[2].cy);
mcEye1.curveTo(_local8, _local7, mcEye1.opoints[0].cx, mcEye1.opoints[0].cy);
mcEye1.endFill();
_local6 = mcEye2.opoints[1].cx;
_local5 = mcEye2.opoints[1].cy * eyesCloseFrac;
_local8 = mcEye2.opoints[3].cx;
_local7 = mcEye2.opoints[3].cy * eyesCloseFrac;
mcEye2.clear();
mcEye2.beginFill(mcEye1.fillColor);
mcEye2.lineStyle(1, mcEye2.lineColor);
mcEye2.moveTo(mcEye2.opoints[0].cx, mcEye2.opoints[0].cy);
mcEye2.curveTo(_local6, _local5, mcEye2.opoints[2].cx, mcEye2.opoints[2].cy);
mcEye2.curveTo(_local8, _local7, mcEye2.opoints[0].cx, mcEye2.opoints[0].cy);
mcEye2.endFill();
}
}
}
function standTo2(a, frac) {
if (a == walkAng) {
isStanding = false;
} else {
isStanding = true;
}
if (frac == undefined) {
frac = 0.2;
}
var _local3 = standToAng + ((a - standToAng) * frac);
stand(_local3);
}
function easeInOutSin(t, b, c, d) {
return((((-c) / 2) * (Math.cos((Math.PI * t) / d) - 1)) + b);
}
function stand(a) {
if (standToAng != a) {
var _local8 = Math.cos(a);
var _local7 = a;
a = a - standToAng;
standToAng = _local7;
} else {
return(undefined);
}
var _local5 = Math.cos(a);
var _local4 = Math.sin(a);
var _local3 = -33;
var _local2 = 10;
headPos.x = headPos.x - (headPos.ox + _local3);
headPos.y = headPos.y - (headPos.oy + _local2);
rotateZ(headPos, _local5, _local4);
headPos.x = headPos.x + (headPos.ox + _local3);
headPos.y = headPos.y + (headPos.oy + _local2);
_local3 = -25;
_local2 = 10;
frontRightPt.x = frontRightPt.x - (frontRightPt.ox + _local3);
frontRightPt.y = frontRightPt.y - (frontRightPt.oy + _local2);
rotateZ(frontRightPt, _local5, _local4);
frontRightPt.x = frontRightPt.x + (frontRightPt.ox + _local3);
frontRightPt.y = frontRightPt.y + (frontRightPt.oy + _local2);
frontLeftPt.x = frontLeftPt.x - (frontLeftPt.ox + _local3);
frontLeftPt.y = frontLeftPt.y - (frontLeftPt.oy + _local2);
rotateZ(frontLeftPt, _local5, _local4);
frontLeftPt.x = frontLeftPt.x + (frontLeftPt.ox + _local3);
frontLeftPt.y = frontLeftPt.y + (frontLeftPt.oy + _local2);
_local3 = -20;
_local2 = -13;
legBaseFR.x = legBaseFR.x - (legBaseFR.ox + _local3);
legBaseFR.y = legBaseFR.y - (legBaseFR.oy + _local2);
rotateZ(legBaseFR, _local5, _local4);
legBaseFR.x = legBaseFR.x + (legBaseFR.ox + _local3);
legBaseFR.y = legBaseFR.y + (legBaseFR.oy + _local2);
legBaseFL.x = legBaseFL.x - (legBaseFR.ox + _local3);
legBaseFL.y = legBaseFL.y - (legBaseFR.oy + _local2);
rotateZ(legBaseFL, _local5, _local4);
legBaseFL.x = legBaseFL.x + (legBaseFR.ox + _local3);
legBaseFL.y = legBaseFL.y + (legBaseFR.oy + _local2);
_local3 = -20;
_local2 = 6;
frontInRightPt.x = frontInRightPt.x - (frontInRightPt.ox + _local3);
frontInRightPt.y = frontInRightPt.y - (frontInRightPt.oy + _local2);
rotateZ(frontInRightPt, _local5, _local4);
frontInRightPt.x = frontInRightPt.x + (frontInRightPt.ox + _local3);
frontInRightPt.y = frontInRightPt.y + (frontInRightPt.oy + _local2);
frontInLeftPt.x = frontInLeftPt.x - (frontInLeftPt.ox + _local3);
frontInLeftPt.y = frontInLeftPt.y - (frontInLeftPt.oy + _local2);
rotateZ(frontInLeftPt, _local5, _local4);
frontInLeftPt.x = frontInLeftPt.x + (frontInLeftPt.ox + _local3);
frontInLeftPt.y = frontInLeftPt.y + (frontInLeftPt.oy + _local2);
_local3 = -10;
_local2 = -2;
midChestPt.x = midChestPt.x - (midChestPt.ox + _local3);
midChestPt.y = midChestPt.y - (midChestPt.oy + _local2);
rotateZ(midChestPt, _local5, _local4);
midChestPt.x = midChestPt.x + (midChestPt.ox + _local3);
midChestPt.y = midChestPt.y + (midChestPt.oy + _local2);
_local3 = -2;
_local2 = 5;
legInnerR.x = legInnerR.x - (legInnerR.ox + _local3);
legInnerR.y = legInnerR.y - (legInnerR.oy + _local2);
rotateZ(legInnerR, _local5, _local4);
legInnerR.x = legInnerR.x + (legInnerR.ox + _local3);
legInnerR.y = legInnerR.y + (legInnerR.oy + _local2);
_local3 = 10;
_local2 = 8;
rearPt.x = rearPt.x - (rearPt.ox + _local3);
rearPt.y = rearPt.y - (rearPt.oy + _local2);
rotateZ(rearPt, _local5, _local4);
rearPt.x = rearPt.x + (rearPt.ox + _local3);
rearPt.y = rearPt.y + (rearPt.oy + _local2);
_local3 = -25;
_local2 = 12;
frontBodyPt.x = frontBodyPt.x - (frontBodyPt.ox + _local3);
frontBodyPt.y = frontBodyPt.y - (frontBodyPt.oy + _local2);
rotateZ(frontBodyPt, _local5, _local4);
frontBodyPt.x = frontBodyPt.x + (frontBodyPt.ox + _local3);
frontBodyPt.y = frontBodyPt.y + (frontBodyPt.oy + _local2);
_local3 = -1;
_local2 = 4;
rearBodyPt.x = rearBodyPt.x - (rearBodyPt.ox + _local3);
rearBodyPt.y = rearBodyPt.y - (rearBodyPt.oy + _local2);
rotateZ(rearBodyPt, _local5, _local4);
rearBodyPt.x = rearBodyPt.x + (rearBodyPt.ox + _local3);
rearBodyPt.y = rearBodyPt.y + (rearBodyPt.oy + _local2);
_local3 = 10;
_local2 = 3;
tailPos.x = tailPos.x - (tailPos.ox + _local3);
tailPos.y = tailPos.y - (tailPos.oy + _local2);
rotateZ(tailPos, _local5, _local4);
tailPos.x = tailPos.x + (tailPos.ox + _local3);
tailPos.y = tailPos.y + (tailPos.oy + _local2);
}
function updateLegs(cos, sin) {
frontBodyPt.xpos = (mcBody._x + (cos * frontBodyPt.x)) + (sin * frontBodyPt.z);
frontBodyPt.ypos = (mcBody._y + frontBodyPt.y) - frontBounce;
rearBodyPt.xpos = (mcBody._x + (cos * rearBodyPt.x)) + (sin * rearBodyPt.z);
rearBodyPt.ypos = (mcBody._y + rearBodyPt.y) - rearBounce;
frontInRightPt.xpos = (mcBody._x + (cos * frontInRightPt.x)) + (sin * frontInRightPt.z);
frontInRightPt.ypos = mcBody._y + frontInRightPt.y;
frontInLeftPt.xpos = (mcBody._x + (cos * frontInLeftPt.x)) + (sin * frontInLeftPt.z);
frontInLeftPt.ypos = mcBody._y + frontInLeftPt.y;
frontRightPt.xpos = (mcBody._x + (cos * frontRightPt.x)) + (sin * frontRightPt.z);
frontRightPt.ypos = mcBody._y + frontRightPt.y;
frontLeftPt.xpos = (mcBody._x + (cos * frontLeftPt.x)) + (sin * frontLeftPt.z);
frontLeftPt.ypos = mcBody._y + frontLeftPt.y;
rearRightPt.xpos = (mcBody._x + (cos * rearRightPt.x)) + (sin * rearRightPt.z);
rearRightPt.ypos = mcBody._y + rearRightPt.y;
rearLeftPt.xpos = (mcBody._x + (cos * rearLeftPt.x)) + (sin * rearLeftPt.z);
rearLeftPt.ypos = mcBody._y + rearLeftPt.y;
rearPt.xpos = (mcBody._x + (cos * rearPt.x)) + (sin * rearPt.z);
rearPt.ypos = mcBody._y + rearPt.y;
legInnerR.xpos = (mcBody._x + (cos * legInnerR.x)) + (sin * legInnerR.z);
legInnerR.ypos = mcBody._y + legInnerR.y;
midChestPt.xpos = (mcBody._x + (cos * midChestPt.x)) + (sin * midChestPt.z);
midChestPt.ypos = mcBody._y + midChestPt.y;
legBaseFR.xpos = (mcBody._x + (cos * legBaseFR.x)) + (sin * legBaseFR.z);
legBaseFR.ypos = mcBody._y + legBaseFR.y;
legBaseFL.xpos = (mcBody._x + (cos * legBaseFL.x)) + (sin * legBaseFL.z);
legBaseFL.ypos = mcBody._y + legBaseFL.y;
legBaseRR.xpos = (mcBody._x + (cos * legBaseRR.x)) + (sin * legBaseRR.z);
legBaseRR.ypos = mcBody._y + legBaseRR.y;
legBaseRL.xpos = (mcBody._x + (cos * legBaseRL.x)) + (sin * legBaseRL.z);
legBaseRL.ypos = mcBody._y + legBaseRL.y;
}
function tiltHead(a) {
tiltEars(a);
mcHeadX.rotateZ(a, true);
mcHeadZ.rotateZ(a, true);
mcMouthL.rotateZ(a, true);
mcMouthR.rotateZ(a, true);
mcFaceUpperR.rotateZ(a, true);
mcFaceUpperL.rotateZ(a, true);
if (a == headAngZ) {
return(undefined);
}
if (headAngZ != a) {
var _local5 = a;
a = a - headAngZ;
headAngZ = _local5;
}
var _local4 = Math.cos(a);
var _local3 = Math.sin(a);
rotateZ(eyePt, _local4, _local3);
rotateZ(earPt, _local4, _local3);
rotateZ(snoutPt, _local4, _local3);
}
function rotateZ(op, cosAng, sinAng) {
var _local3 = op.x;
var _local2 = op.y;
op.x = (cosAng * _local3) - (sinAng * _local2);
op.y = (cosAng * _local2) + (sinAng * _local3);
}
function tiltEars(ang) {
mcEar1.rotateZ(ang, true);
mcEar2.rotateZ(ang, true);
mcEye1.rotateZ(ang, true);
mcEye2.rotateZ(ang, true);
}
function createBodyXY(mc, depth, fillColor) {
var _local3 = new Array();
_local3.push({x:38, y:-5, z:0});
_local3.push({x:34, y:5, z:0});
_local3.push({x:25, y:13, z:0});
_local3.push({x:12, y:14, z:0});
_local3.push({x:-4, y:14, z:0});
_local3.push({x:-23, y:14, z:0});
_local3.push({x:-35, y:11, z:0});
_local3.push({x:-44, y:3, z:0, curve:true});
_local3.push({x:-38, y:-12, z:0});
_local3.push({x:-26, y:-27, z:0, curve:true});
_local3.push({x:-5, y:-26, z:0});
_local3.push({x:14, y:-26, z:0, curve:true});
_local3.push({x:29, y:-17, z:0});
return(HamsterPart.create(mc, depth, {points:_local3, fillColor:fillColor}));
}
function run(cos, sin) {
var _local2 = legVel / maxLegVel;
var _local7 = (maxStepDist * 0.2) + ((maxStepDist * 0.8) * _local2);
var _local6 = (maxStepDist * 0.4) + ((maxStepDist * 0.8) * _local2);
stepHt = _local2 * maxStepHt;
var _local8 = -8;
var _local9 = -15;
legBaseRL.x = (legBaseRR.x = _local9 + (_local2 * _local8));
angVel = angVel + legVel;
if (legVel > 0.7) {
}
var _local3;
if (isOnWheel) {
_local3 = wheelAng;
}
var _local10 = legVel / maxLegVel;
legFR.update(angVel, cos, sin, _local7, stepHt, -_local3);
legFL.update(angVel, cos, sin, _local7, stepHt, -_local3);
legRR.update(angVel, cos, sin, _local6, stepHt, _local3);
legRL.update(angVel, cos, sin, _local6, stepHt, _local3);
}
function walk(cosAng, sinAng) {
var _local7;
var _local10 = 2;
var _local13 = 15;
if ((goingTo == FOOD) || (goingTo == MOUSE)) {
stepTime = 6;
walkWait = 3;
} else {
stepTime = 6;
walkWait = 3;
}
var _local11;
if ((goingTo == FOOD) || (goingTo == WATER)) {
_local11 = mouthPt.x;
_local13 = 5;
} else if (isStanding) {
_local11 = (cosAng * 40) + _x;
} else {
_local11 = (cosAng * 50) + _x;
}
_local7 = dest.x - _local11;
if ((frameNum % walkWait) == 0) {
var _local21 = dest.x;
var _local20 = dest.y;
legNum++;
if (legNum == numLegs) {
legNum = 0;
}
var _local18 = legs[legNum];
var _local19;
var _local14 = 0;
var _local12 = 0;
var _local15 = dest.x - _x;
if (_local15 < 0) {
_local12 = Math.PI;
}
if (Math.abs(_local15) < 50) {
_local12 = com.abowman.math.Trig.angleTo(_x, ht, dest.x, ht + 40);
}
var _local16 = _local12 - ang;
var _local4 = (Math.PI/2);
var _local9 = Math.max(Math.min(_local16 * 0.5, _local4), -_local4);
var _local2 = 30;
if (Math.abs(_local7) < 40) {
_local2 = _local2 * 0.5;
} else if (Math.abs(_local7) < 80) {
_local2 = _local2 * 0.7;
} else if (Math.abs(_local7) < 120) {
_local2 = _local2 * 0.9;
}
if (Math.abs(_local16) < 0.8) {
if ((ang > 1.88495559215388) || (ang < 1.25663706143592)) {
_local2 = Math.min(_local2, Math.max(_local7 * 0.3, -_local2));
if (ang > (Math.PI/2)) {
_local2 = _local2 * -1;
}
}
} else if (Math.abs(_local7) < 120) {
_local9 = Math.max(Math.min(_local16 * 0.25, _local4), -_local4);
}
if ((Math.abs(_local7) < _local13) || (eating)) {
_local10 = 1;
_local2 = 0;
num0Strides++;
} else {
num0Strides = 0;
}
if (num0Strides > 4) {
return(false);
}
if (isStanding) {
_local2 = Math.max(Math.min(10, _local2), -10);
_local10 = 1;
} else if ((legNum == 0) || (legNum == 2)) {
_local4 = 0.942477796076938;
_local9 = Math.max(Math.min(_local9, _local4), -_local4);
}
_local14 = _local14 - _local9;
if (Math.abs(_local9) > 0.628318530717959) {
_local2 = _local2 * 0.5;
}
_local19 = getPos(_local2, _local14);
_local18.stepTo(_local19, stepTime, _local10);
}
var _local5 = {x:(((legFR.ftPos.x + legFL.ftPos.x) + legRR.ftPos.x) + legRL.ftPos.x) / 4, z:(((legFR.ftPos.z + legFL.ftPos.z) + legRR.ftPos.z) + legRL.ftPos.z) / 4};
var _local8 = {x:(legRR.ftPos.x + legRL.ftPos.x) / 2, z:(legRR.ftPos.z + legRL.ftPos.z) / 2};
if (!isStanding) {
legFR.update4(_local5, cosAng, sinAng);
legFL.update4(_local5, cosAng, sinAng);
legRR.update4(_local5, cosAng, sinAng);
legRL.update4(_local5, cosAng, sinAng);
_x = _x + ((cosAng * _local5.x) + (sinAng * _local5.z));
var _local17 = 40;
var _local16 = Math.atan2(_local5.z * 1, _local17);
ang = ang - _local16;
ang = Math.min(3.1101767270539, Math.max(ang, 0));
} else {
_local8 = {x:(legRR.ftPos.x + legRL.ftPos.x) / 2, z:(legRR.ftPos.z + legRL.ftPos.z) / 2};
_x = _x + ((cosAng * _local8.x) + (sinAng * _local8.z));
var _local17 = 40;
var _local16 = Math.atan2(_local8.z * 1, _local17);
ang = ang - _local16;
ang = Math.min(3.1101767270539, Math.max(ang, 0));
legRR.update4(_local8, cosAng, sinAng);
legRL.update4(_local8, cosAng, sinAng);
}
rearBounce = (legRR.currStepHt + legRL.currStepHt) / 2;
frontBounce = (legFR.currStepHt + legFL.currStepHt) / 2;
headBounce = (legFR.currStepHt + legFL.currStepHt) / 4;
return(true);
}
function getPos(stride, ang) {
var _local1 = {x:0, z:0};
_local1.x = Math.cos(ang) * stride;
_local1.z = Math.sin(ang) * stride;
return(_local1);
}
static var NOTHING = 0;
static var WHEEL = 1;
static var FOOD = 2;
static var RANDOM = 3;
static var MOUSE = 4;
static var WATER = 5;
static var symbolName = "__Packages.Hamster";
static var symbolLinked = Object.registerClass(symbolName, Hamster);
var wheelAng = 0.15707963267949;
var ang = 0;
var angVel = 0;
var legVel = 0;
var headAng = 0;
var radiusA = 20;
var radiusB = 20;
var headAngZ = 0;
var eyePt = {x:20, y:-4};
var earPt = {x:10, y:-15};
var snoutPt = {x:33, y:6};
var tailPos = {x:-38, y:8, z:0, ox:-38, oy:8};
var headPos = {x:19, y:-3, z:0, ox:19, oy:-3};
var legBaseFR = {x:15, y:12, z:-20, ox:15, oy:25};
var legBaseFL = {x:15, y:12, z:20, ox:15, oy:25};
var legBaseRR = {x:-25, y:12, z:-20, ox:-25};
var legBaseRL = {x:-25, y:12, z:20, ox:-25};
var legInnerR = {x:-10, y:18, z:0, ox:-10, oy:18};
var midChestPt = {x:0, y:17, z:0, ox:0, oy:17};
var rearPt = {x:-39, y:-3, z:0, ox:-39, oy:-3};
var frontInRightPt = {x:20, y:10, z:-5, ox:20, oy:10};
var frontInLeftPt = {x:20, y:10, z:5, ox:20, oy:10};
var frontRightPt = {x:15, y:6, z:-18, ox:15, oy:5};
var frontLeftPt = {x:15, y:6, z:18, ox:15, oy:5};
var rearRightPt = {x:-20, y:0, z:-20};
var rearLeftPt = {x:-20, y:0, z:20};
var frontBodyPt = {x:12, y:-2, z:0, ox:12, oy:-2};
var rearBodyPt = {x:-20, y:1, z:0, ox:-20, oy:1};
var eyeGap = 9;
var earGap = 10;
var cheekGap = 8;
var ear1Top = true;
var ear2Top = true;
var topEye = 2;
var mouthOnTop = false;
var fillColor = 15658734;
var bodyColor = 14540253;
var standToAng = (Math.PI*2);
var walkAng = (Math.PI*2);
var stepHt = 0;
var maxStepDist = 20;
var maxStepHt = 4;
var maxLegVel = 0.9;
var vy = 0;
var vx = 0;
var ht = 28;
var legNum = 0;
var numLegs = 4;
var frameNum = 0;
var stepTime = 6;
var walkWait = 3;
var num0Strides = 0;
var grav = 1;
var eatStandAng = 5.1;
var maxChewAng = 0.02;
var chewAng = 0;
var chewVel = 0;
var chewAcc = 0.04;
var startSniffAt = 0;
var stopSniffAt = 0;
var maxSniff = 100;
var waterLevel = 10;
var isStanding = false;
var isOnWheel = false;
var handZ = 20;
var minEatTime = 1000;
var maxEatTime = 3000;
var lookRandomAt = 0;
var maxLookRandom = 100;
var minLookRandom = 30;
var maxGotoRandom = 500;
var minGotoRandom = 100;
var foodInMouth = false;
var neckLen = 5;
var outlineWidth = 3;
var maxDrink = 200;
var minDrink = 60;
var maxRun = 600;
var minRun = 300;
var maxRest = 100;
var minRest = 30;
var hamAcc = 0.03;
var maxHamVel = 0.8;
var angAcc = 0;
var maxAngAcc = 0.01;
var angChance = 4;
var dir = 1;
var hamVelToForce = 15;
var minClean = 30;
var maxClean = 90;
var minWait = 300;
var maxWait = 900;
var legCleanAng = 0;
var legCleanVel = 0;
var rearBounce = 0;
var frontBounce = 0;
var headBounce = 0;
var eyesCloseFrac = 0;
var sleepInterval = 300000;
}
Symbol 6 MovieClip [__Packages.LegV2] Frame 0
class LegV2 extends MovieClip
{
var footColor, ease, ctrFtPos, ftPos, jtPos, legLen, ftLen, base, frontPt, rearPt, sidePt, mcFill, createEmptyMovieClip, getNextHighestDepth, col, debug, fillColor, clear, beginFill, moveTo, lineTo, endFill, lineStyle, tX, tY;
function LegV2 () {
super();
}
static function create(parentMC, depth, args) {
var _local1 = parentMC.attachMovie(symbolName, "LegV2" + depth, depth);
_local1.depth = depth;
_local1.init(args);
return(_local1);
}
function init(args) {
footColor = args.footColor;
ease = easeInOutQuad;
ctrFtPos = {};
ftPos = {x:0, y:0};
jtPos = {x:0, y:0};
if (args.angOffset != undefined) {
angOffset = args.angOffset;
}
legLen = args.legLen;
ftLen = args.footLen;
base = args.base;
frontPt = args.frontPt;
rearPt = args.rearPt;
sidePt = args.sidePt;
mcFill = createEmptyMovieClip("mcFill", getNextHighestDepth());
col = args.col;
debug = args.debug;
fillColor = args.fillColor;
ctrFtPos.xpos = base.xpos + (legLen * Math.cos(legAng));
ctrFtPos.ypos = base.ypos + (legLen * Math.sin(legAng));
ftPos.x = 0;
ftPos.y = ctrFtPos.ypos;
ftPos.z = 0;
update4({x:0, y:0, z:0}, 0, 0);
render2();
}
function update(ang, cosAngDir, sinAngDir, stepDist, stepHt, groundAng) {
currStepHt = 0;
ang = ang + angOffset;
var _local5 = Math.cos(ang);
var _local4 = Math.sin(ang);
xDist = cosAngDir * stepDist;
yDist = sinAngDir * stepDist;
ftPos.xpos = _local5 * xDist;
ctrFtPos.xpos = base.xpos + ((cosAngDir * legLen) * Math.cos(legAng));
ctrFtPos.ypos = base.ypos + (legLen * Math.sin(legAng));
ftPos.xpos = ftPos.xpos + ctrFtPos.xpos;
ftPos.ypos = Math.min(0, _local4 * stepHt);
ftPos.ypos = ftPos.ypos + ctrFtPos.ypos;
var _local12 = stepDist / maxStepDist;
var _local8 = -3.14159265358979 - ((maxFtAng * Math.min(0, _local5)) * _local12);
var _local10 = (ftLen * Math.cos(_local8)) * cosAngDir;
var _local9 = ftLen * Math.sin(_local8);
jtPos.xpos = (_local10 + (_local5 * xDist)) + ctrFtPos.xpos;
jtPos.ypos = _local9 + ftPos.ypos;
if (groundAng) {
groundAng = Math.atan(cosAngDir * Math.tan(groundAng));
_local5 = Math.cos(groundAng);
_local4 = Math.sin(groundAng);
var _local3 = ftPos.xpos;
var _local2 = ftPos.ypos;
ftPos.xpos = (_local5 * _local3) - (_local4 * _local2);
ftPos.ypos = (_local5 * _local2) + (_local4 * _local3);
_local3 = jtPos.xpos;
_local2 = jtPos.ypos;
jtPos.xpos = (_local5 * _local3) - (_local4 * _local2);
jtPos.ypos = (_local5 * _local2) + (_local4 * _local3);
}
}
function render2(mcBG) {
var _local2 = jtPos.ypos - currStepHt;
var _local3 = ftPos.ypos - currStepHt;
clear();
beginFill(fillColor);
moveTo(frontPt.xpos, frontPt.ypos);
lineTo(jtPos.xpos, _local2);
lineTo(rearPt.xpos, rearPt.ypos);
lineTo(sidePt.xpos, sidePt.ypos);
lineTo(frontPt.xpos, frontPt.ypos);
endFill();
lineTo(jtPos.xpos, _local2);
lineStyle(1, col);
moveTo(frontPt.xpos, frontPt.ypos);
lineTo(jtPos.xpos, _local2);
mcFill.clear();
mcFill.beginFill(fillColor);
mcFill.moveTo(frontPt.xpos, frontPt.ypos);
mcFill.lineTo(jtPos.xpos, _local2);
mcFill.lineTo(sidePt.xpos, sidePt.ypos);
mcFill.lineTo(frontPt.xpos, frontPt.ypos);
mcFill.endFill();
lineStyle(5, col);
moveTo(jtPos.xpos, _local2);
if (_local2 == _local3) {
lineTo(ftPos.xpos, _local3 + 0.5);
} else {
lineTo(ftPos.xpos, _local3);
}
lineStyle(2, footColor);
moveTo(jtPos.xpos, _local2);
if (_local2 == _local3) {
lineTo(ftPos.xpos, _local3 + 0.5);
} else {
lineTo(ftPos.xpos, _local3);
}
mcBG.moveTo(frontPt.xpos, frontPt.ypos);
mcBG.lineTo(jtPos.xpos, _local2);
mcBG.lineTo(rearPt.xpos, rearPt.ypos);
mcBG.lineTo(jtPos.xpos, _local2);
mcBG.lineTo(sidePt.xpos, sidePt.ypos);
}
function stepTo(pt, d, stepHt) {
tX = pt.x;
tY = pt.z;
totTime = d;
beginX = ftPos.x;
chX = tX - beginX;
beginY = ftPos.z;
chY = tY - beginY;
time = 0;
maxStepHt = stepHt;
}
function update4(bodyVel, cosAngDir, sinAngDir) {
ctrFtPos.xpos = base.xpos + ((cosAngDir * legLen) * Math.cos(legAng));
ctrFtPos.ypos = base.ypos + (legLen * Math.sin(legAng));
if (time < totTime) {
ftPos.x = ease(time++, beginX, chX, totTime);
ftPos.z = ease(time, beginY, chY, totTime);
currStepHt = maxStepHt * Math.sin((time / totTime) * Math.PI);
} else {
ftPos.x = ftPos.x - bodyVel.x;
ftPos.z = ftPos.z - bodyVel.z;
}
ftPos.xpos = (ctrFtPos.xpos + (cosAngDir * ftPos.x)) + (sinAngDir * ftPos.z);
ftPos.ypos = ctrFtPos.ypos - currStepHt;
var _local6 = Math.min(ftPos.x, 0) / maxStepDist;
var _local2 = -3.14159265358979 - (maxFtAng * _local6);
var _local5 = (ftLen * Math.cos(_local2)) * cosAngDir;
var _local4 = ftLen * Math.sin(_local2);
jtPos.xpos = _local5 + ftPos.xpos;
jtPos.ypos = _local4 + ftPos.ypos;
}
function updateLeg(cosAngDir, sinAngDir, ftAng) {
ctrFtPos.xpos = base.xpos + ((cosAngDir * legLen) * Math.cos(legAng));
ctrFtPos.ypos = base.ypos + (legLen * Math.sin(legAng));
ftPos.xpos = (ctrFtPos.xpos + (cosAngDir * ftPos.x)) + (sinAngDir * ftPos.z);
ftPos.ypos = ctrFtPos.ypos - currStepHt;
var _local4 = (ftLen * Math.cos(ftAng)) * cosAngDir;
var _local3 = ftLen * Math.sin(ftAng);
jtPos.xpos = _local4 + ftPos.xpos;
jtPos.ypos = _local3 + ftPos.ypos;
ftPos.x = ftPos.x + ((-ftPos.x) * 0.3);
ftPos.z = ftPos.z + ((-ftPos.z) * 0.3);
currStepHt = currStepHt + ((-currStepHt) * 0.3);
}
function moveOval(ang, cosAngDir, sinAngDir, radiusW, radiusH, ftAng) {
ctrFtPos.xpos = base.xpos + ((cosAngDir * legLen) * Math.cos(legAng));
ctrFtPos.ypos = base.ypos + (legLen * Math.sin(legAng));
ftPos.x = Math.cos(ang) * radiusW;
ftPos.y = Math.sin(ang) * radiusW;
ftPos.xpos = (ctrFtPos.xpos + (cosAngDir * ftPos.x)) + (sinAngDir * ftPos.z);
ftPos.ypos = ctrFtPos.ypos + ftPos.y;
var _local4 = (ftLen * Math.cos(ftAng)) * cosAngDir;
var _local3 = ftLen * Math.sin(ftAng);
jtPos.xpos = _local4 + ftPos.xpos;
jtPos.ypos = _local3 + ftPos.ypos;
}
function easeInOutQuad(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
function easer(t, b, c, d) {
t = t / d;
return(b + (c * t));
}
static var symbolName = "__Packages.LegV2";
static var symbolLinked = Object.registerClass(symbolName, LegV2);
var angDir = 0;
var xDist = 0;
var yDist = 0;
var angOffset = 0;
var maxStepDist = 20;
var maxStepHt = 2;
var legAng = (Math.PI/2);
var maxFtAng = 0.942477796076938;
var angAcc = 0.01;
var angVel = 0;
var beginX = 0;
var beginY = 0;
var time = 0;
var chX = 0;
var chY = 0;
var totTime = 0;
var currStepHt = 0;
}
Symbol 7 MovieClip [__Packages.HamsterPart] Frame 0
class HamsterPart extends MovieClip
{
var opoints, closeShape, _name, clear, lineStyle, beginFill, moveTo, curveTo, lineTo, endFill;
function HamsterPart () {
super();
}
static function create(parentMC, depth, args) {
var _local1 = parentMC.attachMovie(symbolName, "HamsterPart" + depth, depth);
_local1.init(args);
return(_local1);
}
function init(args) {
if (args.lineColor != undefined) {
lineColor = args.lineColor;
}
if (args.fillColor != undefined) {
fillColor = args.fillColor;
}
opoints = args.points;
if (args.closeShape != undefined) {
closeShape = args.closeShape;
}
trace(_name);
}
function rotateZ(ang, absAng) {
if (absAng != undefined) {
if (ang == angZ) {
return(undefined);
}
if (angZ != ang) {
var _local10 = ang;
ang = ang - angZ;
angZ = _local10;
}
}
var _local8 = opoints.length;
var _local2;
var _local7 = Math.cos(ang);
var _local6 = Math.sin(ang);
var _local5;
var _local4;
var _local3 = 0;
while (_local3 < _local8) {
_local2 = opoints[_local3];
_local5 = _local2.x;
_local4 = _local2.y;
_local2.x = (_local7 * _local5) - (_local6 * _local4);
_local2.y = (_local7 * _local4) + (_local6 * _local5);
_local3++;
}
}
function rotateY(ang, absAng) {
if (absAng != undefined) {
if (ang == angY) {
return(undefined);
}
if (angY != ang) {
var _local10 = ang;
ang = ang - angY;
angY = _local10;
}
}
var _local8 = opoints.length;
var _local2;
var _local7 = Math.cos(ang);
var _local6 = Math.sin(ang);
var _local5;
var _local4;
var _local3 = 0;
while (_local3 < _local8) {
_local2 = opoints[_local3];
_local5 = _local2.x;
_local4 = _local2.z;
_local2.x = (_local7 * _local5) - (_local6 * _local4);
_local2.z = (_local7 * _local4) + (_local6 * _local5);
_local3++;
}
}
function rotateX(ang, absAng) {
if (absAng != undefined) {
if (ang == angX) {
return(undefined);
}
if (angX != ang) {
var _local10 = ang;
ang = ang - angX;
angX = _local10;
}
}
var _local8 = opoints.length;
var _local2;
var _local7 = Math.cos(ang);
var _local6 = Math.sin(ang);
var _local5;
var _local4;
var _local3 = 0;
while (_local3 < _local8) {
_local2 = opoints[_local3];
_local5 = _local2.y;
_local4 = _local2.z;
_local2.y = (_local7 * _local5) + (_local6 * _local4);
_local2.z = (_local7 * _local4) - (_local6 * _local5);
_local3++;
}
}
function update(mc, ox, oy) {
var _local10 = Math.cos(ang);
var _local9 = Math.sin(ang);
var _local8 = opoints.length;
var _local2;
var _local3;
clear();
if (mc == undefined) {
lineStyle(lineWidth, lineColor);
}
beginFill(fillColor);
_local2 = opoints[0];
if (_local2.curve) {
_local2 = opoints[_local8 - 1];
}
_local2.cx = _local2.x * _local10;
_local2.cy = _local2.y;
if (_local2.z != undefined) {
_local2.cx = _local2.cx + (_local2.z * _local9);
}
moveTo(_local2.cx, _local2.cy);
if (mc != undefined) {
mc.moveTo(ox + _local2.cx, oy + _local2.cy);
}
var _local4 = 0;
while (_local4 < _local8) {
_local2 = opoints[_local4];
if (_local2.lineColor != undefined) {
lineColor = _local2.lineColor;
lineStyle(1, lineColor);
}
_local2.cx = _local2.x * _local10;
_local2.cy = _local2.y;
if (_local2.z != undefined) {
_local2.cx = _local2.cx + (_local2.z * _local9);
}
if (_local2.curve) {
_local4++;
if (_local4 == _local8) {
_local3 = opoints[0];
} else {
_local3 = opoints[_local4];
}
_local3.cx = _local3.x * _local10;
_local3.cy = _local3.y;
if (_local3.z != undefined) {
_local3.cx = _local3.cx + (_local3.z * _local9);
}
curveTo(_local2.cx, _local2.cy, _local3.cx, _local3.cy);
if (mc != undefined) {
mc.curveTo(ox + _local2.cx, oy + _local2.cy, ox + _local3.cx, oy + _local3.cy);
}
} else {
lineTo(_local2.cx, _local2.cy);
if (mc != undefined) {
mc.lineTo(ox + _local2.cx, oy + _local2.cy);
}
}
_local4++;
}
lineStyle(1, fillColor);
endFill(15658734);
}
function trans(vec) {
var _local5 = opoints.length;
var _local2;
var _local3 = 0;
while (_local3 < _local5) {
_local2 = opoints[_local3];
_local2.x = _local2.x + vec.x;
_local2.y = _local2.y + vec.y;
if (_local2.z != undefined) {
_local2.z = _local2.z + vec.z;
}
_local3++;
}
}
function scale(v) {
var _local5 = opoints.length;
var _local2;
var _local3 = 0;
while (_local3 < _local5) {
_local2 = opoints[_local3];
_local2.x = _local2.x * v;
_local2.y = _local2.y * v;
if (_local2.z != undefined) {
_local2.z = _local2.z * v;
}
_local3++;
}
}
function scale3(v) {
if (((v.x == scaX) && (v.y == scaY)) && (v.z == scaZ)) {
return(undefined);
}
var _local8 = v.x - scaX;
var _local7 = v.y - scaY;
var _local6 = v.z - scaZ;
scaX = v.x;
scaY = v.y;
scaZ = v.z;
var _local5 = opoints.length;
var _local2;
var _local3 = 0;
while (_local3 < _local5) {
_local2 = opoints[_local3];
_local2.x = _local2.x + (_local2.x * _local8);
_local2.y = _local2.y + (_local2.y * _local7);
if (_local2.z != undefined) {
_local2.z = _local2.z + (_local2.z * _local6);
}
_local3++;
}
}
function scale2(vec) {
var _local5 = opoints.length;
var _local2;
var _local3 = 0;
while (_local3 < _local5) {
_local2 = opoints[_local3];
_local2.x = _local2.x * vec.x;
_local2.y = _local2.y * vec.y;
if (_local2.z != undefined) {
_local2.z = _local2.z * vec.z;
}
_local3++;
}
}
function toString() {
var _local4 = opoints.length;
var _local2;
var _local3 = 0;
while (_local3 < _local4) {
_local2 = opoints[_local3];
trace(((((((("points.push({x:" + _local2.x) + ",y:") + _local2.y) + ",z:") + _local2.z) + ",curve:") + _local2.curve) + "});");
_local3++;
}
}
static var symbolName = "__Packages.HamsterPart";
static var symbolLinked = Object.registerClass(symbolName, HamsterPart);
var ang = 0;
var angZ = 0;
var angY = 0;
var angX = 0;
var fillColor = 15658734;
var lineColor = 0;
var lineWidth = 1;
var scaX = 1;
var scaY = 1;
var scaZ = 1;
}
Symbol 8 MovieClip [__Packages.com.abowman.math.Trig] Frame 0
class com.abowman.math.Trig
{
function Trig () {
}
static function angleTo(x, y, toX, toY) {
var _local2 = toX - x;
var _local1 = toY - y;
return(Math.atan2(_local1, _local2));
}
static function distTo(x, y, toX, toY) {
var _local2 = toX - x;
var _local1 = toY - y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
static function fixAngle(angle) {
angle = angle % (Math.PI*2);
return(((angle < 0) ? (angle + (Math.PI*2)) : (angle)));
}
static function fixAngleDeg(angle) {
angle = angle % 360;
return(((angle < 0) ? (angle + 360) : (angle)));
}
static function angleToDeg(x1, y1, x2, y2) {
var _local1 = y2 - y1;
var _local2 = x2 - x1;
return(Math.atan2(_local1, _local2) / (Math.PI/180));
}
static var piBy180 = (Math.PI/180);
}