STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
228073
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2560 · P5120

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/77039335?noj=FRM77039335-29DC" width="1" height="1"></div>

kookinkidz.swf

This is the info page for
Flash #21803

(Click the ID number above for more basic data on this flash file.)


Text
0.0

0

ver 1.02

Kookin' Kidz

New Game

Instructions

www.adamtoons.de

Continue

by

Main Menu

   
Accelerate

Ctrl : Catch

Ctrl : Drop

Spacebar : Pause

Game Over

0

ActionScript [AS1/AS2]

Frame 1
function Box(x1, y1, x2, y2) { this.v1 = new Vec(x1, y1); this.v2 = new Vec(x2, y2); } Box.prototype.includes = function (v) { return((((this.v1.x <= v.x) && (this.v2.x >= v.x)) && (this.v1.y <= v.y)) && (this.v2.y >= v.y)); }; Box.prototype.contains = function (v) { return((((this.v1.x <= v.x) && (this.v2.x >= v.x)) && (this.v1.y <= v.y)) && (this.v2.y >= v.y)); }; function Vec(x, y) { this.x = x; this.y = y; } Vec.prototype.set = function (x, y) { this.x = x; this.y = y; }; Vec.prototype.vset = function (v) { this.x = v.x; this.y = v.y; }; Vec.prototype.vmul = function (v, f) { this.x = v.x * f; this.y = v.y * f; }; Vec.prototype.vadd = function (v1, v2) { this.x = v1.x + v2.x; this.y = v1.y + v2.y; }; Vec.prototype.vsub = function (v1, v2) { this.x = v1.x - v2.x; this.y = v1.y - v2.y; }; Vec.prototype.vinc = function (v) { this.x = this.x + v.x; this.y = this.y + v.y; }; Vec.prototype.vdec = function (v) { this.x = this.x - v.x; this.y = this.y - v.y; }; Vec.prototype.inc = function (x, y) { this.x = this.x + x; this.y = this.y + y; }; Vec.prototype.dec = function (x, y) { this.x = this.x - x; this.y = this.y - y; }; Vec.prototype.clone = function () { return(new Vec(this.x, this.y)); }; Vec.prototype.scale = function (f) { this.x = this.x * f; this.y = this.y * f; }; Vec.prototype.clamp = function (vMin, vMax) { this.x = Math.min(Math.max(this.x, vMin.x), vMax.x); this.y = Math.min(Math.max(this.y, vMin.y), vMax.y); }; Vec.prototype.floor = function () { this.x = Math.floor(this.x); this.y = Math.floor(this.y); }; Vec.prototype.abs = function () { return(Math.sqrt((this.x * this.x) + (this.y * this.y))); }; Vec.prototype.abs2 = function () { return((this.x * this.x) + (this.y * this.y)); }; Vec.prototype.dot = function (v) { return((this.x * v.x) + (this.y * v.y)); }; Vec.prototype.normalize = function () { this.scale(1 / this.abs()); }; Vec.prototype.setabs = function (abs) { this.normalize(); this.scale(abs); }; Vec.prototype.removeComponent = function (v) { v.normalize(); var proj = this.dot(v); if (proj < 0) { return(undefined); } v.scale(proj); this.vdec(v); }; Vec.prototype.interpolate = function (v1, v2, f) { f = Math.clamp(f, 0, 1); var iv = new Vec(); iv.vsub(v2, v1); iv.mul(f); this.vadd(v1, iv); }; Vec.prototype.ortho = function (v) { this.x = v.y; this.y = -v.x; }; Vec.prototype.randomize = function (xrange, yrange) { if (yrange == null) { yrange = xrange; } this.x = this.x + (((Math.random() * 2) - 1) * xrange); this.y = this.y + (((Math.random() * 2) - 1) * yrange); }; gGetColVel = function (o1, o2) { var dp = new Vec(); dp.vsub(o2.p, o1.p); dp.normalize(); var dv = new Vec(); dv.vsub(o1.v, o2.v); return(dp.dot(dv)); }; clamp = function (val, min, max) { return(Math.max(Math.min(val, max), min)); }; MovieClip.prototype.stopAll = function () { for (p in this) { var o = eval ("this." + p); if (o.stop != null) { o.stopAll(); } } this.stop(); }; MovieClip.prototype.playAll = function () { for (p in this) { var o = eval ("this." + p); if (o.play != null) { o.playAll(); } } this.play(); }; Array.prototype.removeMultiple = function (e) { var i = 0; while (i < this.length) { if (e == this[i]) { this.splice(i, 1); i--; } i++; } }; Array.prototype.removeRev = function (e) { var i = (this.length - 1); while (i >= 0) { if (e == this[i]) { this.splice(i, 1); return(i); } i--; } return(-1); }; Array.prototype.remove = function (e) { var i = 0; while (i < this.length) { if (e == this[i]) { this.splice(i, 1); return(i); } i++; } return(-1); }; Array.prototype.findRev = function (e) { var i = (this.length - 1); while (i >= 0) { if (e == this[i]) { return(i); } i--; } return(-1); }; Array.prototype.find = function (e) { var i = 0; while (i < this.length) { if (e == this[i]) { return(i); } i++; } return(-1); }; function gCreateObj(id, x, y) { var o = null; if (id == "Player") { o = new Actor("witch", x, y, 5); o.class = "witch"; o.colDetect = true; o.addState(new StatePlayerControl()); o.addState(new StateWitchFall()); o.addState(new StateWitchStun()); o.defaultState = "PlayerControl"; o.addShadow(); } else if (id == "Kid") { if (gLastKidType == null) { gLastKidType = 0; } gLastKidType++; gLastKidType = gLastKidType % 2; var link = ("kid" + gLastKidType.toString()); o = new Kid(link, x, y, 3); o.class = "kid"; o.colDetect = true; o.addState(new StateAvoidOnGround()); o.addState(new StateKidFall()); o.addState(new StateKidBoil()); o.addState(new StateKidStun()); o.addState(new StateKidHang()); o.addState(new StateKidIdle()); o.addState(new StateKidDuck()); o.addState(new StateKidStumble()); o.defaultState = "KidIdle"; o.addShadow(); } else if (id == "Pot") { o = new Actor("pot", x, y, 4); o.class = "pot"; o.colDetect = true; o.addState(new StatePotIdle()); o.defaultState = "PotIdle"; o.addShadow(); } else if (id == "Tree0") { o = new GameObj("tree0", x, y, 1); } else if (id == "Tree1") { o = new GameObj("tree1", x, y, 1); } else if (id == "Tree2") { o = new GameObj("tree2", x, y, 1); } else if (id == "Tree3") { o = new GameObj("tree3", x, y, 1); } else if (id == "Cloud") { o = new GameObj("cloud3", x, y, 1); } else if (id == "Shadow") { o = new Shadow("shadow", x, y, 2); } else if (id == "Donk") { o = new Fader("donk", x, y, 6); } else if (id == "Puff") { o = new Fader("puff", x, y, 6); } else { return(null); } o.createSprite(); o.r = o.mc._width / 2; gSectors[o.s.x][o.s.y].objs.push(o); o.setVis(gSectors[o.s.x][o.s.y].vis); gAllObjs.push(o); return(o); } function GameObj(link, x, y, layer) { if ((((x < 0) || (x > gWorldSize.x)) || (y < 0)) || (y > gWorldSize.y)) { return(undefined); } this.p = new Vec(x, y); this.s = new Vec(x / gSectorSize.x, y / gSectorSize.y); this.s.floor(); this.layer = layer; this.link = link; this.onHide = 0; this.colDetect = false; this.anim = ""; } GameObj.prototype.setVis = function (val) { if (val) { if (!this.mc) { this.createSprite(); } if (!this.mc._visible) { this.mc._x = this.p.x - gTrans.x; this.mc._y = this.p.y - gTrans.y; this.mc._visible = true; gVisObjs.push(this); if (this.colDetect) { gColObjs.push(this); } if (!this.mc) { } } } else if (this.mc && (this.mc._visible)) { switch (this.onHide) { case 0 : var r = gVisObjs.removeRev(this); gColObjs.removeRev(this); if (r < 0) { } this.mc._visible = false; return; case 1 : this.kill(); } } }; GameObj.prototype.kill = function () { if (this.mc) { if (this.mc._visible) { gVisObjs.removeRev(this); gColObjs.removeRev(this); } this.mc.removeMovieClip(); } if (this.shadow) { this.shadow.kill(); } var r = gAllObjs.removeRev(this); var rr = gSectors[this.s.x][this.s.y].objs.removeRev(this); delete this; }; GameObj.prototype.makeSound = function (id, loop, vol) { return(gPlayLocalSound(id, this.p.x, loop, vol)); }; GameObj.prototype.setAnim = function (label) { if (label != this.anim) { this.mc.gotoAndPlay(label); this.anim = label; var g = eval ("this.mc.ground_" + label); if (g != null) { this.ground = g; } else { this.ground = this.mc.ground; } } }; GameObj.prototype.createSprite = function () { var name = (this.link + gLyrCnts[this.layer]); attachMovie(this.link, name, gLyrCnts[this.layer]); gLyrCnts[this.layer]++; this.mc = eval (name); if (!this.mc) { return(undefined); } this.mc._visible = false; this.mc._x = this.p.x - gTrans.x; this.mc._y = this.p.y - gTrans.y; this.mc.obj = this; }; GameObj.prototype.tickPos = function () { if (!this.mc) { return(undefined); } this.mc._x = this.p.x - gTrans.x; this.mc._y = this.p.y - gTrans.y; }; function MovingObj(link, x, y, layer) { super(link, x, y, layer); this.v = new Vec(0, 0); this.rv = 0; this.onClip = 0; this.killTime = -1; } MovingObj.prototype = new GameObj(); MovingObj.prototype.tickPos = function () { if ((this.killTime > 0) && (this.killTime < gNow)) { this.kill(); return(undefined); } if (this.v == null) { this.v = new Vec(0, 0); } this.p.x = this.p.x + (this.v.x * gdt); this.p.y = this.p.y + (this.v.y * gdt); this.mc._rotation = this.mc._rotation + (this.rv * gdt); this.clip(); this.updateSector(); super.tickPos(); if (this.shadow.mc && (!this.shadow.mc._visible)) { this.shadow.tickPos(); } }; MovingObj.prototype.clip = function () { switch (this.onClip) { case 0 : if (this.p.x < 0) { this.p.x = 0; this.v.x = 0; } else if (this.p.x > gWorldSize.x) { this.p.x = gWorldSize.x; this.v.x = 0; } if (this.p.y < 0) { this.p.y = 0; this.v.y = 0; } else if (this.p.y > gWorldSize.y) { this.p.y = gWorldSize.y; this.v.y = 0; } return; case 1 : if ((((this.p.x < 0) || (this.p.x > gWorldSize.x)) || (this.p.y < 0)) || (this.p.y > gWorldSize.y)) { this.kill(); } return; case 2 : this.p.x = this.p.x % gWorldSize.x; this.p.y = this.p.y % gWorldSize.y; if (this.p.x < 0) { this.p.x = this.p.x + gWorldSize.x; } if (this.p.y >= 0) { break; } this.p.y = this.p.y + gWorldSize.y; } }; MovingObj.prototype.updateSector = function () { var ns = new Vec(this.p.x / gSectorSize.x, this.p.y / gSectorSize.y); ns.floor(); if ((ns.x != this.s.x) || (ns.y != this.s.y)) { var rr = gSectors[this.s.x][this.s.y].objs.remove(this); if (!this.mc) { } if ((((ns.x < 0) || (ns.y < 0)) || (ns.x >= gNumSectors.x)) || (ns.y >= gNumSectors.y)) { this.s.x = -1; this.s.y = -1; return(undefined); } gSectors[ns.x][ns.y].objs.push(this); this.s.vset(ns); this.setVis(gSectors[ns.x][ns.y].vis); } }; MovingObj.prototype.addShadow = function () { this.shadow = gCreateObj("Shadow", this.p.x, gGrnd0); this.shadow.parent = this; }; MovingObj.prototype.putOnGround = function () { this.p.y = gGrnd0 - this.ground; this.v.y = 0; this.rv = 0; }; function Fader(link, x, y, layer) { this.alphaStart = 100; this.alphaEnd = 0; this.scaleStart = 100; this.scaleEnd = 200; this.creationTime = gNow; this.killTime = gNow + 1; super(link, x, y, layer); } Fader.prototype = new MovingObj(); Fader.prototype.tickPos = function () { var frac = ((gNow - this.creationTime) / (this.killTime - this.creationTime)); this.mc._alpha = this.alphaStart + (frac * (this.alphaEnd - this.alphaStart)); this.mc._xscale = this.scaleStart + (frac * (this.scaleEnd - this.scaleStart)); this.mc._yscale = this.scaleStart + (frac * (this.scaleEnd - this.scaleStart)); super.tickPos(); }; function Shadow(link, x, y, layer) { this.parent = null; this.w = 0; this.ratio = 0.2; this.minY = gGrnd0 - 300; super(link, x, y, layer); } Shadow.prototype = new MovingObj(); Shadow.prototype.tickPos = function () { if (this.parent == null) { return(undefined); } if (this.w == 0) { this.w = this.parent.r * 2; this.mc._width = this.w; this.mc._height = this.mc._width * this.ratio; } this.p.x = this.parent.p.x; var alpha = ((100 * (this.parent.p.y - this.minY)) / (gGrnd0 - this.minY)); this.mc._alpha = alpha; this.updateSector(); this.mc._x = this.p.x - gTrans.x; this.mc._y = this.p.y - gTrans.y; }; function Actor(link, x, y, layer) { this.state = null; this.defaultState = "none"; this.allStates = new Array(); super(link, x, y, layer); } Actor.prototype = new MovingObj(); Actor.prototype.tickPos = function () { if (this.state) { if ((this.state.tickShift == -1) || ((gFrameCnt % gTickSkip) == this.state.tickShift)) { this.state.tick(); } if (this.p.y > (gGrnd0 - this.ground)) { if (this.state.onGround != null) { this.state.onGround(); } } } else { this.changeState(this.defaultState); } super.tickPos(); }; Actor.prototype.addState = function (state) { state.obj = this; this.allStates.push(state); }; Actor.prototype.changeState = function (name) { if (this.state.name == name) { return(undefined); } var i = 0; while (i < this.allStates.length) { if (this.allStates[i].name == name) { this.state.shut(); this.state = this.allStates[i]; this.state.init(arguments); return(undefined); } i++; } }; Actor.prototype.makePuffs = function (num, xSpread) { var o = this; var puff; if (xSpread == null) { xSpread = 5; } var xInc = (xSpread / num); var i = 0; while (i < num) { puff = gCreateObj("Puff", o.p.x - (xInc * (i + 1)), gGrnd0); puff.v.x = -(Math.random() * 20); puff.v.y = -(Math.random() * 20); puff.killTime = gNow + 1; puff.alphaStart = 50; puff.scaleStart = 220; puff.scaleEnd = 270; puff.rv = 180; puff = gCreateObj("Puff", o.p.x + (xInc * (i + 1)), gGrnd0); puff.v.x = Math.random() * 20; puff.v.y = -(Math.random() * 20); puff.killTime = gNow + 1; puff.alphaStart = 50; puff.scaleStart = 200; puff.scaleEnd = 330; puff.rv = 180; i++; } }; function Kid(link, x, y, layer) { super(link, x, y, layer); } Kid.prototype = new Actor(); Kid.prototype.setVis = function (val) { if (val) { if (!this.mc._visible) { gVisKids.push(this); } } else if (this.mc && (this.mc._visible)) { gVisKids.removeRev(this); } super.setVis(val); }; Kid.prototype.kill = function () { if (this.mc && (this.mc._visible)) { gVisKids.removeRev(this); } super.kill(); }; function Ground(link, y, layer) { this.y = y; this.layer = layer; this.link = link; this.init(); } Ground.prototype.tickPos = function () { if (!this.mc) { return(undefined); } if ((gScroll.y + gScreenSize.y) > this.y) { this.mc._visible = true; } else { this.mc._visible = false; return(undefined); } this.mc._x = gOrgScreenSize.x / 2; this.mc._y = this.y - gTrans.y; this.mc._height = gWorldSize.y - this.y; this.mc._width = gScreenSize.x; }; Ground.prototype.init = function () { var name = (this.link + gLyrCnts[this.layer]); attachMovie(this.link, name, gLyrCnts[this.layer]); gLyrCnts[this.layer]++; this.mc = eval (name); if (!this.mc) { return(undefined); } this.tickPos(); }; function Panel(link) { this.link = link; if (link == null) { return(undefined); } this.init(); Stage.addListener(this); } Panel.prototype.onResize = function () { this.mc.fadeScreen._width = Stage.width + 10; this.mc.fadeScreen._height = Stage.height + 10; }; Panel.prototype.init = function () { var name = this.link; attachMovie(this.link, name, 9000); this.mc = eval (name); if (!this.mc) { return(undefined); } this.mc._x = gOrgScreenSize.x / 2; this.mc._y = gOrgScreenSize.y / 2; this.mc._visible = false; this.onResize(); }; Panel.prototype.setVis = function (val) { if (val) { if (!this.mc) { this.init(); } if (!this.mc._visible) { this.mc._visible = true; } } else if (this.mc && (this.mc._visible)) { this.mc._visible = false; } }; function ScreenObj(link, layer, corner, x, y) { this.link = link; this.layer = layer; this.corner = corner; this.p = new Vec(x, y); if (link == null) { return(undefined); } this.init(); gResizeTckObjs.push(this); } ScreenObj.prototype.tickResize = function () { switch (this.corner) { case 0 : this.mc._x = (-gOrigin.x) + this.p.x; this.mc._y = (-gOrigin.y) + this.p.y; return; case 1 : this.mc._x = (gOrigin.x + gOrgScreenSize.x) - this.p.x; this.mc._y = (-gOrigin.y) + this.p.y; return; case 2 : this.mc._x = (-gOrigin.x) + this.p.x; this.mc._y = (gOrigin.y + gOrgScreenSize.y) - this.p.y; return; case 3 : this.mc._x = (gOrigin.x + gOrgScreenSize.x) - this.p.x; this.mc._y = (gOrigin.y + gOrgScreenSize.y) - this.p.y; } }; ScreenObj.prototype.init = function () { var name = (this.link + gLyrCnts[this.layer]); attachMovie(this.link, name, gLyrCnts[this.layer]); gLyrCnts[this.layer]++; this.mc = eval (name); if (!this.mc) { return(undefined); } this.tickResize(); }; function BarDisplay(link, layer, corner, x, y) { this.maskPos0 = new Vec(0, 155); this.maskPos1 = new Vec(0, 56); this.value = 1; this.warnValue = 0.2; super(link, layer, corner, x, y); } BarDisplay.prototype = new ScreenObj(); BarDisplay.prototype.setValue = function (f) { this.value = clamp(f, 0, 1); var y = this.mask._y; this.mask._x = this.maskPos0.x + ((this.maskPos1.x - this.maskPos0.x) * this.value); this.mask._y = this.maskPos0.y + ((this.maskPos1.y - this.maskPos0.y) * this.value); this.badMask._visible = this.value < this.warnValue; }; BarDisplay.prototype.init = function () { super.init(); this.mc._width = this.mc._width * 0.5; this.mc._height = this.mc._height * 0.5; this.mask = this.mc.mask; this.badMask = this.mc.bad; }; BarDisplay.prototype.tick = function () { }; function Countdown(link, layer, corner, x, y) { this.endTime = gNow + 15; this.currentTime = 0; super(link, layer, corner, x, y); } Countdown.prototype = new ScreenObj(); Countdown.prototype.update = function (t) { var d = Math.floor(this.endTime - t); if (d < 0) { this.mc.text = "0:0"; return(undefined); } if (this.currentTime != d) { this.currentTime = d; var mins = Math.floor(d / 60); var secs = (d % 60); this.mc.text = (mins.toString() + ":") + secs.toString(); } }; function Sky(link, layer) { this.layer = layer; this.link = link; this.init(); gResizeTckObjs.push(this); } Sky.prototype.tickResize = function () { this.mc._x = -gOrigin.x; this.mc._y = -gOrigin.y; this.mc._height = Stage.height + 6; this.mc._width = Stage.width + 6; }; Sky.prototype.init = function () { var name = (this.link + gLyrCnts[this.layer]); attachMovie(this.link, name, gLyrCnts[this.layer]); gLyrCnts[this.layer]++; this.mc = eval (name); if (!this.mc) { return(undefined); } this.mc._x = -gOrigin.x; this.mc._y = -gOrigin.y; this.mc._height = Stage.height; this.mc._width = Stage.width; }; function BackGround(link, layer, ratio) { this.layer = layer; this.link = link; this.init(); gResizeTckObjs.push(this); this.mc._width = ratio * gWorldSize.x; this.xFac = (gWorldSize.x - this.mc._width) / gScrollMax.x; this.yFac = this.xFac; } BackGround.prototype.tickPos = function () { if (!this.mc) { return(undefined); } this.mc._x = (gScroll.x * this.xFac) - gTrans.x; this.mc._y = (gWorldSize.y - ((gScrollMax.y - gScroll.y) * this.yFac)) - gTrans.y; var x = this.mc._x; var y = this.mc._y; var bla = 2; }; BackGround.prototype.tickResize = function () { this.xFac = (gWorldSize.x - this.mc._width) / gScrollMax.x; }; BackGround.prototype.init = function () { var name = (this.link + gLyrCnts[this.layer]); attachMovie(this.link, name, gLyrCnts[this.layer]); gLyrCnts[this.layer]++; this.mc = eval (name); if (!this.mc) { return(undefined); } this.tickPos(); }; function State() { this.name = null; this.obj = null; this.tickShift = Math.floor(gTickSkip * Math.random()); } State.prototype.init = function () { }; State.prototype.shut = function () { }; State.prototype.tick = function () { }; State.prototype.onColide = function (o2, v1, v2) { }; State.prototype.onGround = function () { }; function StatePotIdle() { this.name = "PotIdle"; this.begin = 0; this.fixed = true; } StatePotIdle.prototype = new State(); StatePotIdle.prototype.init = function () { var o = this.obj; o.mc._rotation = 0; o.setAnim("idle"); o.v.set(0, 0); o.putOnGround(); var br = 20; o.box = new Box(o.p.x - br, (o.p.y - 30) - br, o.p.x + br, (o.p.y - 30) + br); }; StatePotIdle.prototype.tick = function () { }; function StateWitchStun() { this.name = "WitchStun"; this.begin = 0; this.fixed = true; this.fixedY = true; this.playedDeathSound = false; } StateWitchStun.prototype = new State(); StateWitchStun.prototype.init = function () { var o = this.obj; o.setAnim("stun"); o.mc._rotation = 0; o.v.x = 0; o.v.y = 0; o.p.y = gGrnd0 - o.ground; this.begin = gNow; this.playedDeathSound = false; }; StateWitchStun.prototype.tick = function () { this.obj.p.y = gGrnd0 - this.obj.ground; if ((!this.playedDeathSound) && ((gNow - this.begin) > 0.5)) { this.playedDeathSound = true; } if ((gNow - this.begin) > 2) { gGameOver(); } }; function StateKidStun() { this.name = "KidStun"; this.begin = 0; this.fixed = true; this.fixedY = true; } StateKidStun.prototype = new State(); StateKidStun.prototype.init = function () { var o = this.obj; o.setAnim("stun"); o.mc._rotation = 0; o.v.x = 0; o.v.y = 0; o.p.y = gGrnd0 - o.ground; this.begin = gNow; }; StateKidStun.prototype.tick = function () { this.obj.p.y = gGrnd0 - this.obj.ground; if ((gNow - this.begin) > 4) { this.obj.changeState("AvoidOnGround"); } }; function StateKidBoil() { this.name = "KidBoil"; } StateKidBoil.prototype = new State(); StateKidBoil.prototype.init = function () { var o = this.obj; gPot.state.cargo = o; o.killTime = gNow + 0.25; o.v.vsub(gPot.p, o.p); o.v.scale(4); gPot.makeSound("splash"); gOnBoilKid(this); }; StateKidBoil.prototype.tick = function () { var o = this.obj; if (o.p.y > gPot.p.y) { o.p.y = gPot.p.y; } }; function StateKidHang() { this.name = "KidHang"; this.tickShift = -1; this.crySnd = null; } StateKidHang.prototype = new State(); StateKidHang.prototype.init = function () { var o = this.obj; o.setAnim("hang"); }; StateKidHang.prototype.shut = function () { this.crySnd.stopSave(); }; StateKidHang.prototype.tick = function () { var o = this.obj; o.p.x = gPlayer.p.x - (gPlayer.v.x * 0.05); o.p.y = gPlayer.p.y + 40; o.mc._rotation = 180 + (gPlayer.v.x * 0.2); }; StateKidHang.prototype.onColide = function (other) { var o = this.obj; o.changeState("KidFall"); o.v.vset(gPlayer.v); o.rv = gPlayer.v.x; gPlayer.state.cargo = null; super.onColide(other); }; StateKidHang.prototype.onGround = function (other) { var o = this.obj; o.changeState("KidFall"); o.v.vset(gPlayer.v); o.rv = gPlayer.v.x; gPlayer.state.cargo = null; super.onGround(); }; function StateOrientX() { this.name = "OrientX"; this.ornt = 1; } StateOrientX.prototype = new State(); StateOrientX.prototype.tick = function () { if (this.obj.v.x < 0) { this.ornt = -1; } else { this.ornt = 1; } this.obj.mc._xscale = this.ornt * 100; super.tick(); }; StateOrientX.prototype.setOrnt = function (ornt) { if (ornt < 0) { this.ornt = -1; } else { this.ornt = 1; } this.obj.mc._xscale = this.ornt * 100; }; function StatePlayerControl() { this.name = "PlayerControl"; this.isAccel = false; this.accel = 100; this.dragFac = 6E-6; this.cargo = null; this.tickShift = -1; this.flySnd = null; this.accelSnd = null; this.lastPuff = 0; } StatePlayerControl.prototype = new StateOrientX(); StatePlayerControl.prototype.init = function () { Key.addListener(this); this.obj.setAnim("fly"); this.flySnd = gPlayLocalSound("fly", o.p.x, true, 0); }; StatePlayerControl.prototype.shut = function () { Key.removeListener(this); this.flySnd.stopSave(); this.accelSnd.stopSave(); }; StatePlayerControl.prototype.tick = function () { var o = this.obj; var vabs = o.v.abs(); var drag = (1 - (((this.dragFac * vabs) * vabs) * gdt)); var accel = (this.accel * gdt); o.v.scale(drag); if (Math.abs(o.v.y) < 20) { o.v.y = o.v.y + ((((gNow % 3) - 1.5) * 30) * gdt); } var b = false; var a = false; if (Key.isDown(37)) { o.v.x = o.v.x - accel; b = o.v.x > 0; a = o.v.x <= 0; } if (Key.isDown(38)) { o.v.y = o.v.y - (accel * 0.5); a = true; } if (Key.isDown(39)) { o.v.x = o.v.x + accel; b = o.v.x <= 0; a = o.v.x > 0; } if (Key.isDown(40)) { o.v.y = o.v.y + (accel * 1.5); } if (a && (!this.isAccel)) { this.onStartAccel(); } else if ((!a) && (this.isAccel)) { this.onStopAccel(); } if (o.anim != "catch") { if (b) { o.setAnim("break"); } else if (a) { o.setAnim("accel"); } else { o.setAnim("fly"); } } if (a) { gAddMana(-0.03 * gdt); } var ground = (o.ground + ((this.cargo != null) ? (this.cargo.ground) : 0)); var avoidY = (gGrnd0 - (3 * ground)); var maxY = (gGrnd0 - (1.2 * ground)); if (o.p.y > avoidY) { if (o.v.y > 0) { var fac = ((o.p.y - avoidY) / (maxY - avoidY)); o.v.y = o.v.y - (((fac * 6) * gdt) * o.v.y); } if (o.p.y > maxY) { o.p.y = maxY; } } super.tick(); var maxAngle = (Math.abs(o.v.y) / 5); var angle = ((Math.atan2(o.v.y, Math.abs(o.v.x)) * 180) / Math.PI); angle = Math.max(-maxAngle, Math.min(angle, maxAngle)); angle = angle * this.ornt; o.mc._rotation = angle; this.flySnd.setVolume(Math.abs(o.v.x + o.v.y) / 7); this.flySnd.setPos(o.p.x); }; StatePlayerControl.prototype.onKeyDown = function () { var o = this.obj; var key = Key.getCode(); if (key == 17) { if (this.cargo == null) { o.setAnim("catch"); var pickCenter = new Vec(o.p.x, o.p.y + 30); var po = gPickKid(pickCenter, 30); o.makeSound("catch", false, 10); if (po != null) { po.changeState("KidHang"); this.cargo = po; } } else { this.cargo.changeState("KidFall"); this.cargo.v.vset(o.v); this.cargo.rv = o.v.x; this.cargo = null; } } }; StatePlayerControl.prototype.onColide = function (o2, v1, v2) { var o = this.obj; var dv = new Vec(0, 0); dv.vsub(v1, v2); var dvl = dv.abs(); var dp = new Vec(0, 0); dp.vsub(o2.p, o.p); dp.normalize(); var colv = dp.dot(dv); if (colv < 70) { return(undefined); } var bounceFac = 1.8; var bv = new Vec(0, 0); bv.vmul(dp, -bounceFac); o.v.vinc(bv); if (colv > 150) { if (this.cargo != null) { this.cargo.changeState("KidFall"); this.cargo.v.vset(o.v); this.cargo.rv = o.v.x; this.cargo = null; } o.rv = (((dp.x * dp.y) > 0) ? 360 : -360); o.changeState("WitchFall"); } }; StatePlayerControl.prototype.onStartAccel = function () { this.accelSnd.setVolume(100); this.isAccel = true; }; StatePlayerControl.prototype.onStopAccel = function () { this.accelSnd.setVolume(0); this.isAccel = false; }; function StateKidIdle() { this.name = "KidIdle"; this.speed = 40; this.lastTurn = 0; this.fixedY = true; } StateKidIdle.prototype = new StateOrientX(); StateKidIdle.prototype.init = function () { var o = this.obj; o.setAnim("idle"); o.putOnGround(); o.mc._rotation = 0; this.lastTurn = gNow; }; StateKidIdle.prototype.tick = function () { var o = this.obj; o.p.y = gGrnd0 - o.ground; o.v.set(0, 0); if ((gNow - this.lastTurn) > 3) { this.setOrnt(-this.ornt); this.lastTurn = gNow; } var lookAtPlayer = (((o.p.x > gPlayer.p.x) && (this.ornt == -1)) || ((o.p.x < gPlayer.p.x) && (this.ornt == 1))); var spottingRange = (lookAtPlayer ? 200 : 50); if (Math.abs(o.p.x - gPlayer.p.x) < spottingRange) { o.changeState("AvoidOnGround"); } }; StateKidIdle.prototype.onColide = function (o2, v1, v2) { var o = this.obj; var adv = Math.abs(v2.x - v1.x); if (adv > 100) { o.v.x = ((o2.p.x > o.p.x) ? (-adv) : (adv)); o.changeState("KidStumble"); return(undefined); } super.onColide(other); }; function StateKidDuck() { this.name = "KidDuck"; this.fixedY = true; } StateKidDuck.prototype = new StateOrientX(); StateKidDuck.prototype.init = function () { var o = this.obj; o.setAnim("duck"); o.mc._rotation = 0; o.v.set(0, 0); o.p.y = gGrnd0 - o.ground; }; StateKidDuck.prototype.tick = function () { var o = this.obj; o.p.y = gGrnd0 - o.ground; var dxPlayer = Math.abs(gPlayer.p.x - o.p.x); var dyPlayer = Math.abs(gPlayer.p.y - o.p.y); if ((dxPlayer > 100) || (dyPlayer > 200)) { o.changeState("AvoidOnGround"); } super.tick(); }; function StateAvoidOnGround() { this.name = "AvoidOnGround"; this.speed = 40; this.fixedY = true; this.lastPuff = 0; this.puffTime = 0.5; } StateAvoidOnGround.prototype = new StateOrientX(); StateAvoidOnGround.prototype.init = function () { var o = this.obj; o.setAnim("run"); o.putOnGround(); o.mc._rotation = 0; o.p.y = gGrnd0 - o.ground; }; StateAvoidOnGround.prototype.tick = function () { var o = this.obj; o.p.y = gGrnd0 - o.ground; o.v.y = 0; var dPot = Math.abs(gPot.p.x - o.p.x); var dPlayer = Math.abs(gPlayer.p.x - o.p.x); if (dPlayer > 400) { o.changeState("KidIdle"); } if ((dPlayer < 70) && (Math.random() > 0.9)) { o.changeState("KidDuck"); return(undefined); } if (dPot > dPlayer) { if (gPlayer.p.x > o.p.x) { o.v.x = -this.speed; } else { o.v.x = this.speed; } } else if (gPot.p.x > o.p.x) { o.v.x = -this.speed; } else { o.v.x = this.speed; } if ((gNow - this.lastPuff) > this.puffTime) { var puff = gCreateObj("Puff", o.p.x + ((o.v.x > 0) ? -10 : 10), gGrnd0 - 5); puff.v.y = -10; puff.alphaStart = 50; puff.scaleStart = 100; puff.scaleEnd = 400; puff.rv = -180; puff.killTime = gNow + 1.5; this.lastPuff = gNow; } super.tick(); }; StateAvoidOnGround.prototype.onColide = function (o2, v1, v2) { var o = this.obj; var adv = Math.abs(v2.x - v1.x); if (adv > 100) { o.v.x = ((o2.p.x > o.p.x) ? (-adv) : (adv)); o.changeState("KidStumble"); return(undefined); } if (o2.class == "kid") { o2.changeState("AvoidOnGround"); } super.onColide(other); }; function StateFall() { super(); this.name = "Fall"; this.dragFac = 5E-7; } StateFall.prototype = new State(); StateFall.prototype.tick = function () { var o = this.obj; var drag = (1 - (this.dragFac * o.v.abs2())); o.v.scale(drag); o.v.y = o.v.y + (gGrav * gdt); }; function StateKidStumble() { this.name = "KidStumble"; } StateKidStumble.prototype = new StateFall(); StateKidStumble.prototype.init = function () { var o = this.obj; o.makeSound("aua", false, 30); o.setAnim("stumble"); o.putOnGround(); o.v.y = -(Math.abs(o.v.x) * 0.3); }; StateKidStumble.prototype.onColide = function (other) { super.onColide(other); }; StateKidStumble.prototype.onGround = function () { var o = this.obj; if (o.p.y > 946) { var bla = 1; } o.makePuffs(1); o.putOnGround(); o.changeState("KidIdle"); }; function StateWitchFall() { super(); this.name = "WitchFall"; this.begin = 0; this.dur = 1; } StateWitchFall.prototype = new StateFall(); StateWitchFall.prototype.shut = function () { var o = this.obj; o.mc._rotation = 0; o.rv = 0; }; StateWitchFall.prototype.init = function (args) { var o = this.obj; o.setAnim("fall"); o.makeSound("fall"); this.begin = gNow; if (args.length > 1) { this.dur = args[1]; } }; StateWitchFall.prototype.tick = function () { var o = this.obj; if ((gNow - this.begin) > this.dur) { o.changeState("PlayerControl"); return(undefined); } super.tick(); }; StateWitchFall.prototype.onGround = function () { var o = this.obj; o.makePuffs(2, 10); o.makeSound("soft_impact"); o.changeState("WitchStun"); }; function StateKidFall() { super(); this.name = "KidFall"; } StateKidFall.prototype = new StateFall(); StateKidFall.prototype.init = function () { var o = this.obj; o.setAnim("fall"); if (Math.abs(gGrnd0 - o.p.y) > 100) { o.makeSound("fall"); } }; StateKidFall.prototype.onGround = function () { var o = this.obj; if ((Math.abs(o.v.x / o.v.y) > 0.7) && (o.v.y > 30)) { o.makeSound("soft_impact"); o.putOnGround(); o.v.x = o.v.x * 0.5; o.v.y = o.v.y * -0.7; o.rv = 3 * o.v.x; o.makePuffs(1); } else { if (o.v.y > 200) { o.rv = 0; o.makeSound("soft_impact"); o.changeState("KidStun"); o.makePuffs(2); return(undefined); } o.rv = 0; o.changeState("KidIdle"); o.makePuffs(1); return(undefined); } }; StateKidFall.prototype.onColide = function (other) { if (other == gPot) { if (Math.abs(gPot.p.x - this.obj.p.x) < 30) { this.obj.changeState("KidBoil"); } } }; function gCacheSound(id, n) { if (n == null) { n = 1; } var s = null; var i = 0; while (i < n) { var name = ((("soundmc_" + id) + "_") + i.toString()); var layer = 7; attachMovie("dummy", name, gLyrCnts[layer]); gLyrCnts[layer]++; var mc = eval (name); mc._visible = false; s = new Sound(mc); s.attachSound(id); s.id = id; s.mc = mc; s.playing = false; gAllSnds.push(s); i++; } return(s); } function gGetFreeSound(id) { var foundPlaying = false; var i = (gAllSnds.length - 1); while (i >= 0) { if (gAllSnds[i].id == id) { if (!gAllSnds[i].playing) { return(gAllSnds[i]); } foundPlaying = true; } i--; } if (foundPlaying) { return(null); } return(gCacheSound(id)); } function gCacheAllSounds() { gCacheSound("aua"); gCacheSound("catch"); gCacheSound("cry"); gCacheSound("down"); gCacheSound("fly"); gCacheSound("splash"); gCacheSound("soft_landing", 2); gCacheSound("soft_impact"); } function gKillAllSounds() { var i = (gAllSnds.length - 1); while (i >= 0) { gAllSnds[i].kill(); i--; } gAllSnds.length = 0; } function gPlayLocalSound(id, x, loop, vol) { if (vol == null) { vol = 100; } if (loop == null) { loop = false; } var s = gGetFreeSound(id); if (s == null) { return(undefined); } s.setPos(x); s.setVolume(vol); s.play(loop); return(s); } function gPlayGlobalSound(id, loop, vol) { if (vol == null) { vol = 100; } if (loop == null) { loop = false; } var s = gGetFreeSound(id); if (s == null) { return(undefined); } s.setPan(0); s.setVolume(vol); s.play(loop); return(s); } Sound.prototype.setPos = function (x) { this.setPan(((((x - gTrans.x) + gOrigin.x) / Stage.width) - 0.5) * 200); }; Sound.prototype.onSoundComplete = function () { this.playing = false; }; Sound.prototype.play = function (loop) { if ((loop == null) || (loop == false)) { this.start(); } else { this.start(0, 100000000); } this.playing = true; }; Sound.prototype.stopSave = function () { this.playing = false; this.stop(); }; Sound.prototype.kill = function () { this.stop(); this.mc.removeMovieClip(); gAllSnds.removeRev(this); delete this; }; function Sector(x, y) { this.objs = new Array(); this.vis = false; this.p = new Vec(x, y); } Sector.prototype.setVis = function (val) { if (this.vis == val) { return(undefined); } var numObjs = this.objs.length; var i = 0; while (i < numObjs) { this.objs[i].setVis(val); i++; } this.vis = val; }; gMouseListener = new Object(); Mouse.addListener(gMouseListener); gMouseListener.onMouseUp = function () { }; gMouseListener.onMouseDown = function () { gShowMenu(!gPaused); }; gMouseListener.onMouseMove = function () { }; gKeyListener = new Object(); Key.addListener(gKeyListener); gKeyListener.onKeyDown = function () { var key = Key.getCode(); if ((key == 32) || (key == 80)) { gShowMenu(!gPaused); } else if (key == 68) { } else if (key == 82) { } else if (key == 83) { } else if (key == 84) { } else if (key == 73) { gShowPerformance(!gShowingPerformance); } }; gStageListener = new Object(); Stage.addListener(gStageListener); gStageListener.onResize = function () { var n = gResizeObjs.length; gUpdateScreenSize(); var o = 0; while (o < gResizeTckObjs.length) { gResizeTckObjs[o].tickResize(); o++; } }; function gShowMenu(val, frame) { if ((!val) && (gIsGameOver)) { return(undefined); } if (frame == null) { frame = "main"; } if (gMenu == null) { gMenu = new Panel("main_menu"); } if (val) { _quality = "HIGH"; } gMenu.setVis(val); gMenu.mc.gotoAndPlay(frame); gSound.setVolume((val ? 0 : 100)); gSetPaused(val); } function gShowPerformance(val) { if (gShowingPerformance == val) { return(undefined); } if (val) { gDisplay.mc._visible = true; } else { gDisplay.mc._visible = false; } gShowingPerformance = val; } function gStartGame() { gResetCore(); gInitWorld(); gCenterScroll(); gIsGameStarted = true; } function gTick() { var sysTime = (getTimer() / 1000); gdt = sysTime - gLastTickTime; gNow = gNow + gdt; gLastTickTime = sysTime; gFPSTime = gFPSTime + gdt; if ((gFrameCnt % gFPSFrames) == 0) { var fps = (gFPSFrames / gFPSTime); if (gShowingPerformance) { var text = ("Q:" + _quality); text = text + (" FPS:" + fps.toString().substring(0, 4)); text = text + (" total:" + gAllObjs.length); text = text + (" vis:" + gVisObjs.length); gDisplay.mc.text = text; } gFPSTime = 0; if (fps < 25) { gDecQty(); } if (fps > 30) { gIncQty(); } } gUpdateObjs(); gDetectColisions(); if ((gFrameCnt % gCheckSectorsSkip) == 0) { gCheckSectors(); } gGameTick(); gFrameCnt++; updateAfterEvent(); } function gUpdateObjs() { gFrameScroll(); var i = 0; while (i < gVisObjs.length) { gVisObjs[i].tickPos(); i++; } } function gUpdateScreenSize() { gScreenSize.set(Stage.width, Stage.height); gOrigin.set((Stage.width - gOrgScreenSize.x) / 2, (Stage.height - gOrgScreenSize.y) / 2); gScrollMin.set(0, 0); gScrollMax.set(gWorldSize.x - gScreenSize.x, gWorldSize.y - gScreenSize.y); gdt = 0; gUpdateObjs(); } function gFrameScroll() { gScrollTarget.vadd(gPlayer.p, gPlayer.v); gScrollTarget.dec(Stage.width / 2, Stage.height / 2); gScrollSpeed.vsub(gScrollTarget, gScroll); gScrollSpeed.scale(0.1); gScroll.vinc(gScrollSpeed); gScroll.clamp(gScrollMin, gScrollMax); gScroll.x = clamp(gScroll.x, gPlayer.p.x - Stage.width, gPlayer.p.x); gScroll.y = clamp(gScroll.y, gPlayer.p.y - Stage.height, gPlayer.p.y); gTrans.set(gOrigin.x + gScroll.x, gOrigin.y + gScroll.y); } function gCenterScroll() { gSetScroll(gPlayer.p.x - (Stage.width / 2), gPlayer.p.y - (Stage.height / 2)); } function gSetScroll(x, y) { gScroll.set(x, y); gScroll.clamp(gScrollMin, gScrollMax); gTrans.set(gOrigin.x + gScroll.x, gOrigin.y + gScroll.y); } function gCheckSectors() { var n1 = new Vec((gScroll.x - gScreenMargin) / gSectorSize.x, (gScroll.y - gScreenMargin) / gSectorSize.y); var n2 = new Vec(((gScroll.x + gScreenSize.x) + gScreenMargin) / gSectorSize.x, ((gScroll.y + gScreenSize.y) + gScreenMargin) / gSectorSize.y); n1.floor(); n2.floor(); if ((((n1.x == gScreenSector1.x) && (n1.y == gScreenSector1.y)) && (n2.x == gScreenSector2.x)) && (n2.y == gScreenSector2.y)) { return(undefined); } var i = gScreenSector1.x; while (i <= gScreenSector2.x) { var j = gScreenSector1.y; while (j <= gScreenSector2.y) { if (!((((i >= n1.x) && (i <= n2.x)) && (j >= n1.y)) && (j <= n2.y))) { gSectors[i][j].setVis(false); } j++; } i++; } var i = n1.x; while (i <= n2.x) { var j = n1.y; while (j <= n2.y) { gSectors[i][j].setVis(true); j++; } i++; } gScreenSector1.vset(n1); gScreenSector2.vset(n2); } function gDetectColisions() { var i = 0; while (i < (gColObjs.length - 1)) { var j = (i + 1); while (j < gColObjs.length) { var o1 = gColObjs[i]; var o2 = gColObjs[j]; if ((o1.state.cargo != o2) && (o2.state.cargo != o1)) { var dp = new Vec(0, 0); dp.vsub(o2.p, o1.p); var d2 = dp.abs2(); var rs = (o1.r + o2.r); var rs2 = (rs * rs); if (d2 < rs2) { gOnColide(o1, o2); var d = Math.sqrt(d2); var move = ((rs - d) / 2); var dm = new Vec(0, 0); dm.vmul(dp, move / d); var v1 = new Vec(o1.v.x, o1.v.y); var v2 = new Vec(o2.v.x, o2.v.y); var dpn = new Vec(0, 0); dpn.vmul(dp, -1); if (o1.state.fixed) { dm.scale(2); o2.p.vinc(dm); o2.v.removeComponent(dpn); } else if (o2.state.fixed) { dm.scale(-2); o1.p.vinc(dm); o1.v.removeComponent(dp); } else if (o1.state.fixedY) { o1.p.inc(-dm.x, 0); o2.p.inc(dm.x, 2 * dm.y); o2.v.removeComponent(dpn); } else if (o2.state.fixedY) { o1.p.inc(-dm.x, -2 * dm.y); o2.p.inc(dm.x, 0); o1.v.removeComponent(dp); } else { o1.p.vdec(dm); o2.p.vinc(dm); o2.v.removeComponent(dpn); o1.v.removeComponent(dp); } if (o1.state) { o1.state.onColide(o2, v1, v2); } if (o2.state) { o2.state.onColide(o1, v2, v1); } } } j++; } i++; } } function gOnColide(o1, o2) { var colVel = gGetColVel(o1, o2); if (colVel > 100) { gPlayLocalSound("soft_landing", o1.p.x); var colPos = new Vec(0, 0); colPos.vsub(o2.p, o1.p); colPos.setabs(o1.r); colPos.vinc(o1.p); var donk1 = gCreateObj("Donk", colPos.x, colPos.y); donk1.killTime = gNow + 0.6; donk1.v.vadd(o1.v, o2.v); donk1.v.scale(0.2); donk1.v.randomize(0, 30); donk1.scaleEnd = 400; } } function gIncQty() { if (_quality == "LOW") { _quality = "MEDIUM"; } else if (_quality == "MEDIUM") { _quality = "HIGH"; } else if (_quality == "HIGH") { _quality = "BEST"; } } function gDecQty() { if (_quality == "BEST") { _quality = "HIGH"; } else if (_quality == "HIGH") { _quality = "MEDIUM"; } else if (_quality == "MEDIUM") { _quality = "LOW"; } } function gSetPaused(val) { if (!val) { clearInterval(gTimer); gTimer = setInterval(gTick, 5); gLastTickTime = getTimer() / 1000; Mouse.addListener(gMouseListener); Key.addListener(gKeyListener); gStartAllAnims(); gPaused = false; } else { clearInterval(gTimer); Mouse.removeListener(gMouseListener); Key.removeListener(gKeyListener); gStopAllAnims(); gPaused = true; } } function gStopAllAnims() { var i = 0; while (i < gVisObjs.length) { gVisObjs[i].mc.stopAll(); i++; } gManaDisplay.mc.stopAll(); } function gStartAllAnims() { var i = 0; while (i < gVisObjs.length) { gVisObjs[i].mc.playAll(); i++; } gManaDisplay.mc.playAll(); } function gGetInvisibleXPos(x) { if (x == null) { x = Math.random() * gWorldSize.x; } var tries = 0; var maxTries = 10; var visible = ((x >= (gScroll.x - gScreenMargin)) && (x <= ((gScroll.x + Stage.width) + gScreenMargin))); while (visible && (tries < maxTries)) { x = Math.random() * gWorldSize.x; visible = (x >= (gScroll.x - gScreenMargin)) && (x <= ((gScroll.x + Stage.width) + gScreenMargin)); tries++; } return(x); } function gGetInvisiblePos(p) { var tries = 0; var maxTries = 10; do { p.x = Math.random() * gWorldSize.x; tries++; } while (((p.x >= (gScroll.x - gScreenMargin)) && (p.x <= ((gScroll.x + Stage.width) + gScreenMargin))) && (tries < maxTries)); do { p.y = Math.random() * gWorldSize.y; tries++; } while (((p.y >= (gScroll.y - gScreenMargin)) && (p.y <= ((gScroll.y + Stage.height) + gScreenMargin))) && (tries < maxTries)); } function gRandom() { var r = Math.random(); r = r * 10000; return(r - Math.floor(r)); } _root.onKillFocus = function (newFocus) { }; function gResetCore() { gFrameCnt = 0; clearInterval(gTimer); gTimer = null; gPaused = true; gIsGameOver = false; gShowingPerformance = false; gPauseStartTime = 0; gdt = 0; gLastTickTime = 0; gTickSkip = 6; gGameStartTime = getTimer() / 1000; gNow = 0; gCheckSectorsSkip = 10; gGrav = 1000; gFPSFrames = 11; gFPSTime = 0; var i = (gAllObjs.length - 1); while (i >= 0) { gAllObjs[i].kill(); i--; } gAllObjs.length = 0; gVisObjs.length = 0; gColObjs.length = 0; gVisKids.length = 0; gResizeTckObjs.length = 0; gKillAllSounds(); gLyrCnts = [0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000]; gUpdateScreenSize(); var x = 0; while (x < gNumSectors.x) { var y = 0; while (y < gNumSectors.y) { gSectors[x][y].objs.length = 0; gSectors[x][y].vis = false; y++; } x++; } gScreenSector1.set(gScroll.x / gSectorSize.x, gScroll.y / gSectorSize.y); gScreenSector1.floor(); gScreenSector2.set((gScroll.x + gScreenSize.x) / gSectorSize.x, (gScroll.y + gScreenSize.y) / gSectorSize.y); gScreenSector2.floor(); } function gShutCore() { gPaused = true; clearInterval(gTimer); var i = (gAllObjs.length - 1); while (i >= 0) { gAllObjs[i].kill(); i--; } gAllObjs.length = 0; gVisObjs.length = 0; gColObjs.length = 0; gVisKids.length = 0; gResizeTckObjs.length = 0; gAllSnds.length = 0; gLyrCnts.length = 0; delete gWorldSize; delete gGrnd0; delete gWorldBox; delete gOrgScreenSize; delete gScreenSize; delete gOrigin; delete gScrollMin; delete gScrollMax; delete gTrans; delete gScroll; delete gScrollTarget; delete gScrollSpeed; delete gNumSectors; delete gSectorSize; var x = 0; while (x < gNumSectors.x) { gSectors[x].length = 0; x++; } gSectors.length = 0; delete gScreenSector1; delete gScreenSector2; delete gSound; } gFrameCnt = 0; gTimer = null; gPaused = true; gIsGameOver = false; gIsGameStarted = false; gPauseStartTime = 0; gdt = 0; gLastTickTime = 0; gTickSkip = 6; gGameStartTime = getTimer() / 1000; gNow = 0; gCheckSectorsSkip = 10; gGrav = 500; gFPSFrames = 11; gFPSTime = 0; gAllObjs = new Array(); gVisObjs = new Array(); gColObjs = new Array(); gVisKids = new Array(); gResizeTckObjs = new Array(); gAllSnds = new Array(); gLyrCnts = new Array(0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000); gWorldSize = new Vec(4000, 1000); gGrnd0 = gWorldSize.y - 30; gWorldBox = new Array(0, 0, gWorldSize.x, gWorldSize.y); gOrgScreenSize = new Vec(500, 400); gScreenSize = new Vec(0, 0); gOrigin = new Vec(0, 0); gScrollMin = new Vec(0, 0); gScrollMax = new Vec(0, 0); gTrans = new Vec(0, 0); gUpdateScreenSize(); gScreenMargin = 100; gScroll = new Vec(100, 100); gScrollTarget = new Vec(0, 0); gScrollSpeed = new Vec(0, 0); var worldRatio = (gWorldSize.x / gWorldSize.y); gNumSectors = new Vec(gWorldSize.x / gScreenSize.x, gWorldSize.y / gScreenSize.y); gNumSectors.x = gWorldSize.x / 200; gNumSectors.y = gNumSectors.x / worldRatio; gNumSectors.floor(); gSectorSize = new Vec(gWorldSize.x / gNumSectors.x, gWorldSize.y / gNumSectors.y); gSectors = new Array(gNumSectors.x); var x = 0; while (x < gNumSectors.x) { gSectors[x] = new Array(gNumSectors.y); var y = 0; while (y < gNumSectors.y) { gSectors[x][y] = new Sector(x, y); y++; } x++; } gScreenSector1 = new Vec(gScroll.x / gSectorSize.x, gScroll.y / gSectorSize.y); gScreenSector1.floor(); gScreenSector2 = new Vec((gScroll.x + gScreenSize.x) / gSectorSize.x, (gScroll.y + gScreenSize.y) / gSectorSize.y); gScreenSector2.floor(); gSound = new Sound(); function gOnBoilKid(kid) { gKidCount++; gKidCountDisplay.mc.count = gKidCount.toString(); gAddMana(0.1); gKid = gCreateObj("Kid", gGetInvisibleXPos(), gGrnd0); gPlayer.makeSound("witch_laugh"); gPlayer.mc.head.gotoAndPlay("laugh"); gPot.setAnim("splash"); } function gPickKid(v, r) { var box = new Box(v.x - r, v.y - r, v.x + r, v.y + r); var i = 0; while (i < gVisKids.length) { if (box.includes(gVisKids[i].p)) { return(gVisKids[i]); } i++; } return(null); } function gGameTick() { } function gAddMana(inc) { gMana = gMana + inc; if (gMana < 0) { gPlayer.rv = -90; gPlayer.changeState("WitchFall", 9999); gPlayer.makeSound("down", false, 50); } gMana = clamp(gMana, 0, 1); gManaDisplay.setValue(gMana); } function gGameOver() { gIsGameOver = true; gMenu.mc.kidCount.text = gKidCount.toString(); gShowMenu(true, "gameover"); } function gInitWorld() { gSky = new Sky("sky", 1); gBackgrnd = new BackGround("hills", 1, 0.5); gVisObjs.push(gBackgrnd); gGrnd = new Ground("ground", gWorldSize.y - 100, 1); gVisObjs.push(gGrnd); gPlayer = gCreateObj("Player", (gWorldSize.x / 2) - 20, 800); var numKids = 4; var j = 0; while (j < numKids) { var x = gGetInvisibleXPos((gWorldSize.x / (numKids + 1)) * (j + 1)); gKid = gCreateObj("Kid", x, gGrnd0); j++; } gPot = gCreateObj("Pot", gWorldSize.x / 2, gGrnd0 - 50); var j = 1; while (j < (gWorldSize.x / 350)) { o2 = gCreateObj("Cloud", j * 350, 100 + (Math.random() * (gWorldSize.y - 400))); j++; } var numTypes = 4; var minGap = 100; var maxGap = 200; var j = 1; while (j < gNumSectors.x) { var link = ("Tree" + Math.round(3 * Math.random()).toString()); if (((j * gSectorSize.x) + (Math.random() * 150)) < 0) { var bla = 2; } var x = ((j * gSectorSize.x) + (Math.random() * 150)); var y = ((gWorldSize.y - 80) - (Math.random() * 5)); gCreateObj(link, (j * gSectorSize.x) + (Math.random() * 150), (gWorldSize.y - 80) - (Math.random() * 5)); j = j + 2; } var j = 1; while (j < gNumSectors.x) { var link = ("Tree" + Math.round(3 * Math.random()).toString()); if (((j * gSectorSize.x) + (Math.random() * 150)) < 0) { var bla = 2; } var x = ((j * gSectorSize.x) + (Math.random() * 150)); var y = ((gWorldSize.y - 80) - (Math.random() * 5)); gCreateObj(link, (j * gSectorSize.x) - (Math.random() * 150), (gWorldSize.y - 70) - (Math.random() * 5)); j = j + 2; } gDisplay = new ScreenObj("display", 8, 2, 10, 30); gDisplay.mc._visible = gShowingPerformance; gKidCountDisplay = new ScreenObj("kid_count", 8, 0, 10, 10); gKidCountDisplay.mc._width = gKidCountDisplay.mc._width * 1.2; gKidCountDisplay.mc._height = gKidCountDisplay.mc._height * 1.2; gKidCountDisplay.mc._alpha = 60; gManaDisplay = new BarDisplay("mana_display", 8, 1, 30, 8); gManaDisplay.setValue(1); gKidCount = 0; gMana = 1; gCacheAllSounds(); } stop(); Stage.scaleMode = "noScale"; gShowMenu(true, "new");
Symbol 34 MovieClip Frame 1
gotoAndPlay (1);
Symbol 34 MovieClip Frame 20
gotoAndPlay (1);
Symbol 34 MovieClip Frame 71
gotoAndPlay (1);
Symbol 37 MovieClip [witch] Frame 1
ground = 35; ground_stun = 15;
Symbol 37 MovieClip [witch] Frame 60
gotoAndPlay (1);
Symbol 37 MovieClip [witch] Frame 90
gotoAndPlay (61);
Symbol 37 MovieClip [witch] Frame 100
obj.setAnim("fly");
Symbol 37 MovieClip [witch] Frame 160
gotoAndPlay (121);
Symbol 37 MovieClip [witch] Frame 190
gotoAndPlay (161);
Symbol 37 MovieClip [witch] Frame 201
gotoAndPlay (191);
Symbol 37 MovieClip [witch] Frame 202
stop();
Symbol 37 MovieClip [witch] Frame 203
stop();
Symbol 37 MovieClip [witch] Frame 204
stop();
Symbol 50 MovieClip [pot] Frame 1
ground = 30;
Symbol 50 MovieClip [pot] Frame 60
gotoAndPlay (1);
Symbol 50 MovieClip [pot] Frame 61
Symbol 50 MovieClip [pot] Frame 78
this.obj.setAnim("idle");
Symbol 60 MovieClip [kid1] Frame 1
ground = 25; ground_duck = 10; ground_stumble = 30; ground_stun = 15;
Symbol 60 MovieClip [kid1] Frame 59
gotoAndPlay (1);
Symbol 60 MovieClip [kid1] Frame 80
gotoAndPlay (60);
Symbol 60 MovieClip [kid1] Frame 140
gotoAndPlay (81);
Symbol 60 MovieClip [kid1] Frame 150
this.obj.makeSound("cry", false, 30);
Symbol 60 MovieClip [kid1] Frame 180
gotoAndPlay (141);
Symbol 60 MovieClip [kid1] Frame 199
gotoAndPlay (181);
Symbol 60 MovieClip [kid1] Frame 260
gotoAndPlay (200);
Symbol 60 MovieClip [kid1] Frame 290
gotoAndPlay (279);
Symbol 65 MovieClip [kid0] Frame 1
ground = 25; ground_duck = 10; ground_stumble = 30; ground_stun = 15;
Symbol 65 MovieClip [kid0] Frame 59
gotoAndPlay (1);
Symbol 65 MovieClip [kid0] Frame 80
gotoAndPlay (60);
Symbol 65 MovieClip [kid0] Frame 140
gotoAndPlay (81);
Symbol 65 MovieClip [kid0] Frame 145
this.obj.makeSound("cry", false, 30);
Symbol 65 MovieClip [kid0] Frame 180
gotoAndPlay (141);
Symbol 65 MovieClip [kid0] Frame 199
gotoAndPlay (181);
Symbol 65 MovieClip [kid0] Frame 260
gotoAndPlay (200);
Symbol 65 MovieClip [kid0] Frame 290
gotoAndPlay (279);
Symbol 79 Button
on (release) { _level0.gStartGame(); _level0.gShowMenu(false); }
Symbol 81 Button
on (release) { gotoAndStop (3); }
Symbol 83 Button
on (release) { getURL ("http://www.adamtoons.de", "_blank"); }
Symbol 85 Button
on (release) { if (_level0.gIsGameOver) { gotoAndStop (4); } else { _level0.gShowMenu(false); } }
Symbol 88 Button
on (release) { gotoAndStop (1); }
Symbol 99 MovieClip [main_menu] Frame 1
if (_level0.gIsGameStarted) { stop(); } else { gotoAndStop (2); }
Symbol 99 MovieClip [main_menu] Frame 2
if (_level0.gIsGameStarted) { gotoAndStop (1); } else { stop(); }
Symbol 99 MovieClip [main_menu] Frame 3
stop();
Symbol 99 MovieClip [main_menu] Frame 4
kidCount.text = _level0.gKidCount.toString(); stop();

Library Items

Symbol 1 Sound [witch_laugh]
Symbol 2 Sound [splash]
Symbol 3 Sound [soft_landing]
Symbol 4 Sound [soft_impact]
Symbol 5 Sound [fly]
Symbol 6 Sound [fall]
Symbol 7 Sound [down]
Symbol 8 Sound [cry]
Symbol 9 Sound [catch]
Symbol 10 Sound [aua]
Symbol 11 GraphicUsed by:12
Symbol 12 MovieClip [tree2]Uses:11
Symbol 13 GraphicUsed by:14
Symbol 14 MovieClip [tree1]Uses:13
Symbol 15 GraphicUsed by:16
Symbol 16 MovieClip [tree3]Uses:15
Symbol 17 GraphicUsed by:18
Symbol 18 MovieClip [tree0]Uses:17
Symbol 19 Graphic [ground]Used by:20
Symbol 20 MovieClip [ground]Uses:19
Symbol 21 Graphic [hills]Used by:23
Symbol 22 Graphic [cloud3]Used by:23 40
Symbol 23 MovieClip [hills]Uses:21 22
Symbol 24 Graphic [sky]Used by:25
Symbol 25 MovieClip [sky]Uses:24
Symbol 26 GraphicUsed by:37 99
Symbol 27 GraphicUsed by:37 99
Symbol 28 GraphicUsed by:37 99
Symbol 29 GraphicUsed by:34 37 99
Symbol 30 GraphicUsed by:34 37 99
Symbol 31 GraphicUsed by:34 37 99
Symbol 32 GraphicUsed by:34 37 99
Symbol 33 GraphicUsed by:34 37 99
Symbol 34 MovieClipUses:29 30 31 32 33Used by:37
Symbol 35 GraphicUsed by:37 99
Symbol 36 GraphicUsed by:37 60 65 72 99
Symbol 37 MovieClip [witch]Uses:26 27 28 34 35 36 29 30 31 32 33
Symbol 38 Graphic [shadow]Used by:39
Symbol 39 MovieClip [shadow]Uses:38
Symbol 40 MovieClip [cloud3]Uses:22
Symbol 41 GraphicUsed by:50 99
Symbol 42 GraphicUsed by:50 73 99
Symbol 43 GraphicUsed by:50 99
Symbol 44 GraphicUsed by:50 99
Symbol 45 GraphicUsed by:50 99
Symbol 46 GraphicUsed by:50 99
Symbol 47 GraphicUsed by:50 99
Symbol 48 GraphicUsed by:50
Symbol 49 GraphicUsed by:50 60 65
Symbol 50 MovieClip [pot]Uses:41 42 43 44 45 46 47 48 49
Symbol 51 GraphicUsed by:60
Symbol 52 GraphicUsed by:60
Symbol 53 GraphicUsed by:60
Symbol 54 GraphicUsed by:60 65 71 99
Symbol 55 GraphicUsed by:60 65 71 99
Symbol 56 GraphicUsed by:60
Symbol 57 GraphicUsed by:60 65
Symbol 58 GraphicUsed by:60 65 99
Symbol 59 GraphicUsed by:60 65
Symbol 60 MovieClip [kid1]Uses:51 52 53 54 55 56 57 36 58 59 49
Symbol 61 GraphicUsed by:65 99
Symbol 62 GraphicUsed by:65 99
Symbol 63 GraphicUsed by:65 71 99
Symbol 64 GraphicUsed by:65 99
Symbol 65 MovieClip [kid0]Uses:61 62 63 54 55 64 57 36 58 59 49
Symbol 66 FontUsed by:67
Symbol 67 EditableTextUses:66Used by:68
Symbol 68 MovieClip [display]Uses:67
Symbol 69 FontUsed by:70 76 77 78 80 82 84 86 87 92 93 94 95 96 97
Symbol 70 EditableTextUses:69Used by:71
Symbol 71 MovieClip [kid_count]Uses:63 54 55 70
Symbol 72 MovieClip [donk]Uses:36
Symbol 73 MovieClip [puff]Uses:42
Symbol 74 GraphicUsed by:75 79 81 83 85 88 99 100
Symbol 75 MovieClipUses:74Used by:99
Symbol 76 TextUses:69Used by:99
Symbol 77 TextUses:69Used by:99
Symbol 78 TextUses:69Used by:79
Symbol 79 ButtonUses:78 74Used by:99
Symbol 80 TextUses:69Used by:81
Symbol 81 ButtonUses:80 74Used by:99
Symbol 82 TextUses:69Used by:83
Symbol 83 ButtonUses:82 74Used by:99
Symbol 84 TextUses:69Used by:85 99
Symbol 85 ButtonUses:84 74Used by:99
Symbol 86 TextUses:69Used by:99
Symbol 87 TextUses:69Used by:88
Symbol 88 ButtonUses:87 74Used by:99
Symbol 89 GraphicUsed by:99
Symbol 90 FontUsed by:92
Symbol 91 FontUsed by:92 93 94 95
Symbol 92 TextUses:90 91 69Used by:99
Symbol 93 TextUses:91 69Used by:99
Symbol 94 TextUses:91 69Used by:99
Symbol 95 TextUses:91 69Used by:99
Symbol 96 TextUses:69Used by:99
Symbol 97 EditableTextUses:69Used by:98
Symbol 98 MovieClipUses:97Used by:99
Symbol 99 MovieClip [main_menu]Uses:75 76 77 79 81 83 85 86 26 27 28 29 30 31 32 33 35 74 84 88 89 36 61 64 62 63 55 58 41 42 43 44 45 46 47 92 93 94 95 96 54 98
Symbol 100 MovieClipUses:74Used by:104
Symbol 101 GraphicUsed by:104
Symbol 102 GraphicUsed by:103 104
Symbol 103 MovieClipUses:102Used by:104
Symbol 104 MovieClip [mana_display]Uses:100 101 102 103
Symbol 105 MovieClip [dummy]
Symbol 106 GraphicUsed by:Timeline

Instance Names

"head"Symbol 37 MovieClip [witch] Frame 1Symbol 34 MovieClip
"text"Symbol 98 MovieClip Frame 1Symbol 97 EditableText
"fadeScreen"Symbol 99 MovieClip [main_menu] Frame 1Symbol 75 MovieClip
"kidCount"Symbol 99 MovieClip [main_menu] Frame 4Symbol 98 MovieClip
"mask"Symbol 104 MovieClip [mana_display] Frame 1Symbol 100 MovieClip
"bad"Symbol 104 MovieClip [mana_display] Frame 1Symbol 103 MovieClip

Special Tags

Protect (24)Timeline Frame 10 bytes ""
ExportAssets (56)Timeline Frame 1Symbol 1 as "witch_laugh"
ExportAssets (56)Timeline Frame 1Symbol 2 as "splash"
ExportAssets (56)Timeline Frame 1Symbol 3 as "soft_landing"
ExportAssets (56)Timeline Frame 1Symbol 4 as "soft_impact"
ExportAssets (56)Timeline Frame 1Symbol 5 as "fly"
ExportAssets (56)Timeline Frame 1Symbol 6 as "fall"
ExportAssets (56)Timeline Frame 1Symbol 7 as "down"
ExportAssets (56)Timeline Frame 1Symbol 8 as "cry"
ExportAssets (56)Timeline Frame 1Symbol 9 as "catch"
ExportAssets (56)Timeline Frame 1Symbol 10 as "aua"
ExportAssets (56)Timeline Frame 1Symbol 12 as "tree2"
ExportAssets (56)Timeline Frame 1Symbol 14 as "tree1"
ExportAssets (56)Timeline Frame 1Symbol 16 as "tree3"
ExportAssets (56)Timeline Frame 1Symbol 18 as "tree0"
ExportAssets (56)Timeline Frame 1Symbol 19 as "ground"
ExportAssets (56)Timeline Frame 1Symbol 19 as "ground"
ExportAssets (56)Timeline Frame 1Symbol 20 as "ground"
ExportAssets (56)Timeline Frame 1Symbol 21 as "hills"
ExportAssets (56)Timeline Frame 1Symbol 21 as "hills"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 23 as "hills"
ExportAssets (56)Timeline Frame 1Symbol 24 as "sky"
ExportAssets (56)Timeline Frame 1Symbol 24 as "sky"
ExportAssets (56)Timeline Frame 1Symbol 25 as "sky"
ExportAssets (56)Timeline Frame 1Symbol 37 as "witch"
ExportAssets (56)Timeline Frame 1Symbol 38 as "shadow"
ExportAssets (56)Timeline Frame 1Symbol 38 as "shadow"
ExportAssets (56)Timeline Frame 1Symbol 39 as "shadow"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 22 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 40 as "cloud3"
ExportAssets (56)Timeline Frame 1Symbol 50 as "pot"
ExportAssets (56)Timeline Frame 1Symbol 60 as "kid1"
ExportAssets (56)Timeline Frame 1Symbol 65 as "kid0"
ExportAssets (56)Timeline Frame 1Symbol 68 as "display"
ExportAssets (56)Timeline Frame 1Symbol 71 as "kid_count"
ExportAssets (56)Timeline Frame 1Symbol 72 as "donk"
ExportAssets (56)Timeline Frame 1Symbol 73 as "puff"
ExportAssets (56)Timeline Frame 1Symbol 99 as "main_menu"
ExportAssets (56)Timeline Frame 1Symbol 104 as "mana_display"
ExportAssets (56)Timeline Frame 1Symbol 105 as "dummy"

Labels

"base"Symbol 34 MovieClip Frame 1
"laugh"Symbol 34 MovieClip Frame 21
"fly"Symbol 37 MovieClip [witch] Frame 1
"break"Symbol 37 MovieClip [witch] Frame 61
"catch"Symbol 37 MovieClip [witch] Frame 91
"accel"Symbol 37 MovieClip [witch] Frame 101
"accel0"Symbol 37 MovieClip [witch] Frame 121
"fall"Symbol 37 MovieClip [witch] Frame 161
"stun"Symbol 37 MovieClip [witch] Frame 191
"accel_pose"Symbol 37 MovieClip [witch] Frame 202
"catch_pose"Symbol 37 MovieClip [witch] Frame 203
"catch2_pose"Symbol 37 MovieClip [witch] Frame 204
"idle"Symbol 50 MovieClip [pot] Frame 1
"splash"Symbol 50 MovieClip [pot] Frame 61
"idle"Symbol 60 MovieClip [kid1] Frame 1
"run"Symbol 60 MovieClip [kid1] Frame 60
"stun"Symbol 60 MovieClip [kid1] Frame 81
"hang"Symbol 60 MovieClip [kid1] Frame 141
"fall"Symbol 60 MovieClip [kid1] Frame 181
"duck"Symbol 60 MovieClip [kid1] Frame 200
"stumble"Symbol 60 MovieClip [kid1] Frame 261
"stumble0"Symbol 60 MovieClip [kid1] Frame 279
"idle"Symbol 65 MovieClip [kid0] Frame 1
"run"Symbol 65 MovieClip [kid0] Frame 60
"stun"Symbol 65 MovieClip [kid0] Frame 81
"hang"Symbol 65 MovieClip [kid0] Frame 141
"fall"Symbol 65 MovieClip [kid0] Frame 181
"duck"Symbol 65 MovieClip [kid0] Frame 200
"stumble"Symbol 65 MovieClip [kid0] Frame 261
"stumble0"Symbol 65 MovieClip [kid0] Frame 279
"main"Symbol 99 MovieClip [main_menu] Frame 1
"new"Symbol 99 MovieClip [main_menu] Frame 2
"instructions"Symbol 99 MovieClip [main_menu] Frame 3
"gameover"Symbol 99 MovieClip [main_menu] Frame 4

Dynamic Text Variables

textSymbol 67 EditableText"0.0"
countSymbol 70 EditableText"0"
textSymbol 97 EditableText"0"




http://swfchan.com/5/21803/info.shtml
Created: 27/5 -2019 14:44:29 Last modified: 27/5 -2019 14:44:29 Server time: 29/04 -2024 16:45:17