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

<div style="position:absolute;top:-99px;left:-99px;"><img src="https://tools.swfchan.com/stathit.asp?noj=FRM15517486-22DC&rnd=15517486" width="1" height="1"></div>

Dwarf Planet One.swf

This is the info page for
Flash #262824

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


ActionScript [AS1/AS2]
Combined Code
movieClip 198 TimestopFX { frame 37 { this.removeMovieClip(); } } movieClip 200 { } movieClip 201 { frame 65 { stop(); _parent.removeMovieClip(); } } movieClip 202 TetherBreakFX { } movieClip 207 { } movieClip 208 Sporeworm2Piece { frame 16 { this.removeMovieClip(); } } movieClip 214 { } movieClip 215 Sporeworm1Piece { frame 16 { this.removeMovieClip(); } } movieClip 217 soundEmpty { } movieClip 222 { } movieClip 228 safety { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } var animating = true; var timeStopped = false; } frame 177 { stop(); animating = false; this.swapDepths(0); this.removeMovieClip(); } } movieClip 234 { } movieClip 297 { } movieClip 300 { } movieClip 319 { } movieClip 325 { } movieClip 357 { } movieClip 358 ns7 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); meta1.stop(); meta2.stop(); } } else { if (animating && !timeStopped) { play(); meta1.play(); meta2.play(); } if (timeStopped) { meta1.stop(); meta2.stop(); } } } } frame 1 { var animating = true; var seedType = 7; var nega = true; } frame 67 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 68 { animating = true; } frame 119 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 361 { } movieClip 363 { } movieClip 364 { } movieClip 365 ns5 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 5; var nega = true; } frame 68 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 69 { animating = true; } frame 106 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 392 { frame 1 { stop(); } } movieClip 395 gs8 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 8; var nega = false; letterMC.gotoAndStop(_root.selectedLetter); } frame 180 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 181 { animating = true; } frame 218 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 400 { } movieClip 401 { } movieClip 406 { } movieClip 410 gs6 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 6; var nega = false; } frame 99 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 100 { var animating = true; } frame 152 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 421 gs4 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 4; var nega = false; } frame 107 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 108 { var animating = true; } frame 125 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 434 { frame 1 { function onEnterFrame() { if (!_parent.animating) { stop(); } else { play(); } if (_currentframe != _parent._currentframe) { gotoAndPlay(_parent._currentframe); } } } } movieClip 447 { } movieClip 462 gs3 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 3; var nega = false; } frame 74 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 75 { var animating = true; } frame 118 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 498 { frame 1 { function onEnterFrame() { if (!_parent.animating) { stop(); } else { play(); } if (_currentframe != _parent._currentframe) { gotoAndPlay(_parent._currentframe); } } } } movieClip 532 { } movieClip 536 gs2 { frame 1 { function onEnterFrame() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } } frame 1 { var animating = true; var seedType = 2; var nega = false; } frame 118 { stop(); animating = false; if (destroyImmediately) { gotoAndPlay('destroy'); } } frame 119 { animating = true; } frame 156 { stop(); animating = false; if (!_root.Inventory.hasInfiniseed && _root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeed(seedType); } else { if (!_root.Inventory.hasInfiniseed) { var reSeedMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'respawnedSeed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.guy._x, '_y': _root.guy._y, '_rotation': _rotation}); reSeedMC.active = true; reSeedMC.staleSeed = true; reSeedMC.gotoAndStop(seedType); } } this.swapDepths(0); this.removeMovieClip(); } } movieClip 538 { } movieClip 543 { frame 1 { gotoAndPlay(_root.randomInt(2, 9)); } } movieClip 544 Scramblant Particle { frame 1 { animating = true; fallSpeed = 0; fallAccel = Math.random() * 0.2 - 0.1; gravDirection = _root.rotatePointAroundOrigin(0, 1, _rotation); forwardDirection = _root.rotatePointAroundOrigin(1, 0, _rotation); onEnterFrame = function () { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } prevX = _x; prevY = _y; fallSpeed += fallAccel; _x = _x + (gravDirection.x * fallSpeed + forwardDirection.x * forwardSpeed); _y = _y + (gravDirection.y * fallSpeed + forwardDirection.y * forwardSpeed); } }; } frame 20 { this.swapDepths(0); this.removeMovieClip(); } } movieClip 547 { frame 1 { stop(); } } movieClip 550 { } movieClip 551 Retriever { frame 1 { var liveTimer = 0; var speed = 8; var maxLiveTime = 400; var forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; var activeBugs = _parent.stageManager.activeBugs; var sleepables = _parent.stageManager.sleepables; this.onEnterFrame = function () { if (!_root.gamePaused) { _x = _x + forwardNormal.x * speed; _y = _y + forwardNormal.y * speed; ++liveTimer; if (liveTimer >= maxLiveTime) { removeMovieClip(this); } if (_root.terrain.hitTest(_x, _y, true)) { if (_root.guy.DestroyCheck(_x, _y)) { gotoAndPlay('grab'); } else { gotoAndPlay('fail'); } } var v3 = 0; while (v3 < sleepables.length) { if (!sleepables[v3].active) { var v4 = {'x': _x - sleepables[v3]._x, 'y': _y - sleepables[v3]._y}; var v5 = Math.sqrt(v4.x * v4.x + v4.y * v4.y); if (v5 < sleepables[v3].distanceToActivate) { sleepables[v3].activateThis(); } } ++v3; } } }; } frame 10 { stop(); } frame 11 { this.onEnterFrame = function () {}; } frame 11 { play(); } frame 27 { stop(); this.swapDepths(0); this.removeMovieClip(); } frame 28 { this.onEnterFrame = function () { play(); }; } frame 38 { stop(); this.swapDepths(0); this.removeMovieClip(); } } movieClip 558 { frame 1 { function onEnterFrame() { if (_currentframe % 2 == 0) { gotoAndPlay(_root.randomInt(2, _totalframes - 3)); } } } } movieClip 559 SuperTwinkleFX { frame 38 { _root.audioManager.triggerSound('get Special sound', new Array('getSpecial'), 70); } frame 335 { this.removeMovieClip(); } } movieClip 562 { } movieClip 563 { } movieClip 564 { frame 50 { stop(); } } movieClip 569 { frame 1 { stop(); } } movieClip 570 powerup { frame 1 { function pauseCheck() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } function rotatellCorIntoPosition() { var v2 = 0; for (;;) { if (!(!terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v2 < 360 / slopeCheckStep)) break; llCor = _root.rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v2; } v2 = 0; for (;;) { if (!(terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v2 < 360 / slopeCheckStep)) break; llCor = _root.rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v2; } } function rotatelrCorIntoPosition() { i = 0; for (;;) { if (!(!terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = _root.rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++i; } i = 0; for (;;) { if (!(terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = _root.rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++i; } } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = _root.rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = _root.rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); } function resetToLastGrounded() { if (groundedSinceLastReset) { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); glerpRotation = lastGroundedRotation; } else { if (_root.mainLevel) { _x = _root.powerupslots._x + _root.stageManager.pslots[power - 2]._x; _y = _root.powerupslots._y + _root.stageManager.pslots[power - 2]._y; rotateGuy(_root.stageManager.pslots[power - 2]._rotation); glerpRotation = _root.stageManager.pslots[power - 2]._rotation; } else { _x = guy._x + guy.gravityNormal.x * 30; _y = guy._y + guy.gravityNormal.y * 30; rotateGuy(guy._rotation); glerpRotation = guy._rotation; fallSpeed = -hitJumpStrength; hitPushActive = false; } } offScreenTimer = 0; forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); grounded = terrain.hitTest2(_x + gravityNormal.x * groundCheckDistance, _y + gravityNormal.y * groundCheckDistance, true); i = 0; for (;;) { if (!(terrain.hitTest2(_x, _y, true) && i < 10000)) break; _x = _x + gravityNormal.x; _y = _y + gravityNormal.y; ++i; } if (grounded) { activeTimer = 20; } else { activeTimer = 5; } gotoAndPlay(2); if (fallSpeed > 0) { fallSpeed = 0; } groundedSinceLastReset = grounded; } function getHit(colX, colY) { grounded = false; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _root.guy._rotation); fallSpeed = -hitJumpStrength; _x = _x + gravityNormal.x * (groundCheckDistance + 2); _y = _y + gravityNormal.y * (groundCheckDistance + 2); var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { hitPushDirection = -1; } else { hitPushDirection = 1; } } else { if (facingLeft) { hitPushDirection = 1; } else { hitPushDirection = -1; } } hitPushActive = true; beams.gotoAndStop(1); } play(); var powerups = _root.stageManager.powerups; powerups.push(this); animating = true; var guy = _root.guy; var activeTimer = 30; var hitJumpStrength = 9; var hitPush = 1.5; var hitPushDirection = -1; var hitPushActive = true; if (_root.gamePaused) { hitPushActive = false; } var terrain = _root.terrain; var grounded = false; var groundCheckDistance = 5; var slopeCheckDistance = 15; var slopeCheckStep = 5; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance; var llCor = _root.rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); var lrCor = _root.rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var groundedSinceLastReset = false; var gravityNormal = {'x': 0, 'y': -1}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); var inverter = 1; if (!_root.guy.facingLeft) { inverter = -1; } var forwardNormal = _root.rotatePointAroundOrigin(inverter, 0, _rotation); var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 2; var glerpNormal = {'x': 0, 'y': -1}; var fallSpeed = -hitJumpStrength; var fallAccel = 0.4; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var offScreenTimer = 0; var possibleStuckInWorldFlag = 0; var timeStopped = false; if (!_root.powerupsGotten[power - 2]) { _root.powerupsGotten[power - 2] = true; _root.saveGame(); } this.onEnterFrame = function () { pauseCheck(); if (!_root.gamePaused) { shouldUpdate = false; if (this._parent.hitTest(_root.actionWindow)) { shouldUpdate = true; } if (!grounded) { shouldUpdate = true; } if (shouldUpdate) { if (!timeStopped) { if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; } if (activeTimer > 0) { --activeTimer; } else { if (_root.distanceBetweenObjects(this, _root.guy) < 30) { if (!_root.powerupsGotten[0] && !_root.powerupsGotten[1] && !_root.powerupsGotten[2] && !_root.powerupsGotten[3]) { _root.tutorialText.gotoAndPlay('usetools'); } if (_root.guy.weapon != 1) { _root.guy.discardWeapon(); } _root.guy.weapon = power; _root.heldWeapon = power; _root.updateWeaponInventory(power); _root.guy.gotoAndStop(1); _root.flagIndicator.endTrackingPowerup(); this.removeMovieClip(); } } if (!terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) && !terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { grounded = false; } else {} if (grounded) { lastGroundedPosition = {'x': _x, 'y': _y}; lastGroundedRotation = _rotation; if (gravityLerping) { lastGroundedRotation = glerpRotation; } fallSpeed = 0; } else { fallSpeed += fallAccel; if (gravityLerping) { glerpNormal = _root.rotatePointAroundOrigin(0, -1, glerpRotation); _x = _x - glerpNormal.x * fallSpeed; _y = _y - glerpNormal.y * fallSpeed; } else { _x = _x - gravityNormal.x * fallSpeed; _y = _y - gravityNormal.y * fallSpeed; } if (hitPushActive) { _x = _x + forwardNormal.x * hitPush * hitPushDirection; _y = _y + forwardNormal.y * hitPush * hitPushDirection; } if (terrain.hitTest2(_x + gravityNormal.x * hitHeight, _y + gravityNormal.y * hitHeight, true)) { rotateGuy(_rotation + 180); grounded = true; hitPushActive = false; groundedSinceLastReset = true; } if (terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) || terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { grounded = true; hitPushActive = false; groundedSinceLastReset = true; } if (grounded) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var v3 = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(v3); beams.play(); } } if (_root.guy.usingBoundary) { if (_root.checkOutOfBounds(_x, _y)) { resetToLastGrounded(); } } else { if (!terrain.hitTest(this)) { ++offScreenTimer; if (offScreenTimer > 200) { resetToLastGrounded(); } } else { offScreenTimer = 0; } } if (terrain.hitTest2(_x, _y, true) && terrain.hitTest2(_x + gravityNormal.x * 10, _y + gravityNormal.y * 10, true) && terrain.hitTest2(_x - gravityNormal.x * 10, _y - gravityNormal.y * 10, true)) { if (possibleStuckInWorldFlag < 3) { ++possibleStuckInWorldFlag; } else { resetToLastGrounded(); trace('stuckpowerup'); } } else { possibleStuckInWorldFlag = 0; } if (terrain.hitTestHazard(_x, _y, true)) { resetToLastGrounded(); } } } } }; } frame 2 { play(); } frame 9 { animating = false; stop(); } } movieClip 579 { frame 1 { gotoAndPlay(_root.randomInt(2, 32)); } frame 33 { gotoAndPlay(2); } } movieClip 580 { frame 1 { gotoAndPlay(_root.randomInt(2, 190)); } frame 216 { gotoAndPlay(2); } } movieClip 581 particleZ { frame 194 { this.removeMovieClip(); } } movieClip 602 particleSweat { frame 1 { var rando = _root.randomInt(1, 4); if (rando == 1) { gotoAndPlay('v1'); } else { if (rando == 2) { gotoAndPlay('v2'); } else { if (rando == 3) { gotoAndPlay('v3'); } else { gotoAndPlay('v4'); } } } } frame 12 { this.removeMovieClip(); } frame 23 { this.removeMovieClip(); } frame 34 { this.removeMovieClip(); } frame 45 { this.removeMovieClip(); } } movieClip 611 { frame 1 { gotoAndPlay(_root.randomInt(2, 47)); } frame 49 { gotoAndPlay(2); } } movieClip 612 particleHeart { frame 34 { this.removeMovieClip(); } } movieClip 615 DespawnFX { frame 57 { this.removeMovieClip(); } } movieClip 617 { } movieClip 620 bullet { frame 1 { var liveTimer = 0; var speed = 8; var maxLiveTime = 400; var forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; var activeBugs = _parent.stageManager.activeBugs; this.onEnterFrame = function () { if (!_root.gamePaused) { _x = _x + forwardNormal.x * speed; _y = _y + forwardNormal.y * speed; ++liveTimer; if (liveTimer >= maxLiveTime) { removeMovieClip(this); } if (_parent.terrain.hitTest2(_x, _y, true)) { gotoAndPlay('explode'); } var v4 = 0; while (v4 < activeBugs.length) { if (activeBugs[v4].hitTest(_x, _y, true)) { gotoAndPlay('explode'); activeBugs[v4].gotoAndPlay('die'); } ++v4; } } }; } frame 10 { stop(); } frame 11 { this.onEnterFrame = function () {}; } frame 11 { play(); } frame 27 { stop(); this.swapDepths(0); this.removeMovieClip(); } } movieClip 623 { } movieClip 626 { } movieClip 628 { } movieClip 633 { frame 1 { gotoAndStop(_root.randomInt(2, 5)); } } movieClip 634 { } movieClip 636 bouncerHazard { frame 1 { function onEnterFrame() { _root.pauseCheck(); if (!_root.gamePaused) { _root.checkGuyHit(_x, _y, collider._width - 20, 'BOTTOM'); _root.checkGuyHit(_x, _y, collider._width - 20, 'CENTER'); } } } frame 1 { isAnimating = true; } frame 25 { stop(); isAnimating = false; } frame 26 { isAnimating = true; } frame 35 { stop(); animating = false; this.removeMovieClip(); } } movieClip 641 { } movieClip 643 { } movieClip 646 bouncerBullet { frame 1 { function onEnterFrame() { _root.pauseCheck(); if (!_root.gamePaused) { _x = _x + forwardNormal.x * speed; _y = _y + forwardNormal.y * speed; ++liveTimer; if (liveTimer >= maxLiveTime) { gotoAndPlay('despawn'); } if (liveTimer > 10) { if (_root.terrain.hitTest2(_x, _y, true)) { gotoAndPlay('despawn'); } } _root.checkGuyHit(_x, _y, collider._width, 'CORNERS'); _root.checkGuyHit(_x, _y, collider._width, 'CENTER'); } } var liveTimer = 0; var speed = 2; var maxLiveTime = 400; var forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; } frame 1 { isAnimating = true; } frame 9 { stop(); isAnimating = false; } frame 10 { function onEnterFrame() { _root.pauseCheck(); } isAnimating = true; var dead = true; } frame 19 { function onEnterFrame() { if (clearedForDespawn) { this.removeMovieClip(); } } stop(); animating = false; } } movieClip 647 twinkleFX { frame 290 { this.removeMovieClip(); } } movieClip 650 { } movieClip 651 { frame 800 { gotoAndPlay('loopPoint'); } } movieClip 653 { } movieClip 662 { frame 1 { stop(); } frame 52 { stop(); } } movieClip 664 { } movieClip 666 { } movieClip 671 { } movieClip 673 { } movieClip 678 { } movieClip 705 { } movieClip 714 AllSeed { frame 1 { stop(); var seeds = _root.stageManager.seeds; seeds.push(this); if (!infiniseed) { var mySeedID = seeds.length - 1; var i = 0; while (i < _root.collectedSeeds.length) { if (_root.collectedSeeds[i] == mySeedID) { active = true; _root.stageManager.addSeedToStart(this); } ++i; } } } frame 1 { function setActive() { if (!active) { active = true; bubble.play(); scaleTimer = 200; _root.itemsAttachPoint.attachMovie('twinkleFX', 'FX', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x, '_y': _y, '_rotation': _rotation}); } } function onEnterFrame() { if (!_root.gamePaused) { if (active) { if (!target) { var target = _root.guy; } var v7 = _x - target._x; var v8 = _y - target._y; if (Math.abs(v7) < attractRange) { if (Math.abs(v8) < attractRange) { if (Math.abs(v7) < collectRange && Math.abs(v8) < collectRange) { if (infiniseed) { _root.Inventory.gotoAndStop(seedType + 10); _root.Inventory.hasInfiniseed = true; _root.Inventory.inventory = new Array(seedType - 10, seedType - 10); gotoAndPlay('gotten'); } else { if (_root.Inventory.inventory.length < _root.Inventory.inventoryMax) { _root.Inventory.addSeedToEnd(seedType); gotoAndPlay('gotten'); } else { if (_root.tutorialText._currentframe == 1) { _root.tutorialText.gotoAndPlay('maxseeds'); } } } } if (_root.Inventory.inventory.length < _root.Inventory.inventoryMax) { var v3 = (1 - (Math.abs(v7) + Math.abs(v8)) / attractRange * 2) * attractSpeed; _x = _x - v7 * v3; _y = _y - v8 * v3; if (terrain.hitTest2(_x, _y, true)) { var v5 = terrain.hitTest2(_x, _y + v8 * v3, true); var v6 = terrain.hitTest2(_x + v7 * v3, _y, true); if (v5 && !v6) { _x = _x + v7 * v3; } else { if (!v5 && v6) { _y = _y + v8 * v3; } else { if (!terrain.hitTest2(_x + v7 * v3, _y + v8 * v3, true)) { _x = _x + v7 * v3; _y = _y + v8 * v3; } } } } } } } } else { var v4 = {'x': target._x, 'y': target._y}; target._parent.localToGlobal(v4); _parent.globalToLocal(v4); var v7 = _x - v4.x; var v8 = _y - v4.y; _x = _x - v7 * attachPointLerpAmount; _y = _y - v8 * attachPointLerpAmount; } doScaleStuff(); } else { if (scaleTimer > scaleTime) { doScaleStuff(); } } } function doScaleStuff() { if (rising) { ++scaleTimer; if (scaleTimer >= scaleTime) { rising = false; } } else { --scaleTimer; if (scaleTimer <= 0) { rising = true; } } _xscale = 100 + (scale2 - 100) * (scaleTimer / scaleTime); _yscale = _xscale; } var collectRange = 30; var attractRange = 70; var attractSpeed = 0.1; var guy = _root.guy; var terrain = _root.terrain; var scale2 = 125; var rising = true; var scaleTimer = 0; var scaleTime = 50; var attachPointLerpAmount = 0.2; } frame 2 { seedType = 2; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 1) { gotoAndStop(_root.hardcoreSeed + 1); } } } instance bubble of movieClip 662 { onClipEvent (load) { if (_parent.active) { gotoAndStop('endFrame'); } } } frame 3 { seedType = 3; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 1) { gotoAndStop(_root.hardcoreSeed + 1); } } } frame 4 { seedType = 4; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 1) { gotoAndStop(_root.hardcoreSeed + 1); } } } frame 5 { seedType = 5; } frame 6 { seedType = 6; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 1) { gotoAndStop(_root.hardcoreSeed + 1); } } } frame 7 { seedType = 7; } frame 8 { seedType = 8; } instance of movieClip 705 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedLetter); } } frame 12 { seedType = 12; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 11) { gotoAndStop(_root.hardcoreSeed + 11); } } } frame 13 { seedType = 13; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 11) { gotoAndStop(_root.hardcoreSeed + 11); } } } frame 14 { seedType = 14; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 11) { gotoAndStop(_root.hardcoreSeed + 11); } } } frame 15 { seedType = 15; } frame 16 { seedType = 16; if (_root.hardcoreGame) { if (_currentframe != _root.hardcoreSeed + 11) { gotoAndStop(_root.hardcoreSeed + 11); } } } frame 17 { seedType = 17; } frame 18 { seedType = 18; } instance of movieClip 705 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedLetter); } } frame 21 { function onEnterFrame() {} if (!infiniseed && !staleSeed) { var addNewSeed = true; var i = 0; while (i < _root.collectedSeeds.length) { if (_root.collectedSeeds[i] == mySeedID) { addNewSeed = false; } ++i; } if (!_root.mainLevel) { addNewSeed = false; } if (addNewSeed) { _root.collectedSeeds.push(mySeedID); trace('new seed'); _root.saveGame(); if (seedType == 4) { com.newgrounds.API.unlockMedal('Cyan'); } else { if (seedType == 5) { com.newgrounds.API.unlockMedal('Nega One'); } else { if (seedType == 6) { com.newgrounds.API.unlockMedal('Green'); } else { if (seedType == 7) { com.newgrounds.API.unlockMedal('Nega Two'); } else { if (seedType == 8) { _root.tutorialText.gotoAndPlay('letters'); com.newgrounds.API.unlockMedal('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); } } } } } if (_root.collectedSeeds.length == 3) { _root.tutorialText.gotoAndPlay('rearrangeseeds'); } if (_root.collectedSeeds.length == 5) { _root.tutorialText.gotoAndPlay('maxseeds'); } } } if (specialGetFunction != undefined) { specialGetFunction(); } _root.audioManager.triggerSound('get Seed sound', new Array('getSeed'), 18); } frame 33 { stop(); } } movieClip 716 debugPoint { } movieClip 719 { } movieClip 720 { } movieClip 722 { } movieClip 724 { frame 1 { stop(); } } movieClip 727 { } movieClip 728 { } movieClip 731 { } movieClip 734 { frame 1 { stop(); } } movieClip 735 Preloader { frame 1 { function enterFrameHandler() { var v2 = 0; v2 = _root.getBytesLoaded() / _root.getBytesTotal(); if (loadingBar) { loadingBar.gotoAndStop(int(v2 * (loadingBar._totalframes - 1)) + 1); } if (v2 >= 1) { onEnterFrame = null; gotoAndStop('loaded'); } } stop(); var autoPlay; var className; onEnterFrame = enterFrameHandler; } frame 10 { function _onPlayClick() { _root.nextFrame(); _root.play(); _parent._onLoaded(); } if (playButton) { playButton.onRelease = _onPlayClick; playButton.stop(); } if (autoPlay) { _onPlayClick(null); } } } movieClip 737 Newgrounds API Classes { #initclip Object.registerClass('Newgrounds API Classes', com.newgrounds.shims.APIShim); #endinitclip } movieClip 777 { } movieClip 780 { } movieClip 785 { } movieClip 789 { } movieClip 790 { } movieClip 791 { } movieClip 792 FlashAd { #initclip Object.registerClass('FlashAd', com.newgrounds.components.FlashAdBase); #endinitclip frame 1 { stop(); } frame 30 { function onPlayClick() { removeAd(); _visible = false; } if (this.playButton) { this.playButton.onRelease = onPlayClick; } } } movieClip 793 APIConnector { frame 1 { function _onLoaded() { gotoAndStop('invisible'); if (_redirect) { com.newgrounds.API.loadOfficialVersion(); return undefined; } } function _apiConnect() { var v2 = com.newgrounds.API; if (v2 && !v2.connected) { if (!apiId) { com.newgrounds.Logger.logError('No API ID entered in the API Connector component.', 'You can create an API ID for this submission at http://newgrounds.com/account/flashapi', 'Enter your API ID into the API Connector using the Component Inspector (Window -> Component Inspector).'); return undefined; } switch (debugMode) { case 'Off': default: v2.debugMode = v2.RELEASE_MODE; goto 1299; case 'Simulate Logged-in User': //Invalid switch } v2.debugMode = v2.DEBUG_MODE_LOGGED_IN; goto 1299; case 'Off': v2.debugMode = v2.DEBUG_MODE_LOGGED_OUT; goto 1299; case 'Simulate Logged-in User': v2.debugMode = v2.DEBUG_MODE_NEW_VERSION; goto 1299; case 'Simulate Logged-out User': v2.debugMode = v2.DEBUG_MODE_HOST_BLOCKED; label 1299: v2.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, _onConnected); v2.connect(_root, apiId, encryptionKey, movieVersion); } } function _onConnected(event) { if (redirectOnNewVersion && event.__get__success() && (event.__get__data()).newVersion) { _redirect = true; } if (redirectOnHostBlocked && !event.__get__success() && event.__get__error() == com.newgrounds.APIEvent.ERROR_HOST_BLOCKED) { _redirect = true; } if (_redirect) { gotoAndStop('adPreloader'); forceAlwaysOnTop(); } } function forceAlwaysOnTop() { var v2 = getNextHighestDepth(); swapDepths(v2); if (Stage) { _x = (Stage.width - _width) / 2; _y = (Stage.height - _height) / 2; _visible = true; } if (_root && _root instanceof MovieClip) { (MovieClip(_root)).stop(); } } stop(); if (_root && _root instanceof MovieClip) { (MovieClip(_root)).stop(); } var apiId; var encryptionKey; var movieVersion; var debugMode; var connectorType; var redirectOnHostBlocked; var redirectOnNewVersion; var adType; var className; var _redirect; _x = int(_x); _y = int(_y); if (!debugMode) { debugMode = 'Simulate Logged-in User'; } if (!connectorType) { connectorType = 'Flash Ad + Preloader'; } if (!adType) { adType = 'Video'; } if (ad) { ad.adType = adType; } switch (connectorType) { case 'Flash Ad + Preloader': gotoAndStop('adPreloader'); break; case 'Flash Ad Only': gotoAndStop('ad'); break; case 'Invisible': gotoAndStop('invisible'); } _apiConnect(); } instance ad of movieClip 792 FlashAd { onClipEvent (construct) { apiId = ''; showBorder = true; adType = 'Video'; } } instance loader of movieClip 735 Preloader { onClipEvent (construct) { autoPlay = false; mainClass = ''; } } } instance of movieClip 793 APIConnector { onClipEvent (construct) { apiId = '58128:shTAyZ1x'; encryptionKey = 'fLCP6IL6naPbXwmXhRls0Do3teH1mqi0'; debugMode = 'Simulate Logged-out User'; movieVersion = ''; connectorType = 'Invisible'; redirectOnNewVersion = true; redirectOnHostBlocked = true; adType = 'Video'; } } movieClip 795 { frame 1 { stop(); _root.stop(); onEnterFrame = function () { gotoAndStop(Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100)); if (_root.getBytesLoaded() == _root.getBytesTotal()) { _root.play(); } }; } } movieClip 745 __Packages.com.newgrounds.APIConnection { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APIConnection) { var v1 = function () { this.reset(); }; com.newgrounds.APIConnection = v1; var v2 = v1.prototype; v2.__get__hostURL = function () { return this._hostURL; }; v2.__set__hostURL = function (value) { this._hostURL = value; this.hostDomain = null; if (this._hostURL) { var v2 = this._hostURL.split('/'); if (v2[0] != 'file:' && this._hostURL != 'localhost') { this.hostDomain = v2[2]; } } if (!this.hostDomain) { this.hostDomain = 'localhost'; } return this.__get__hostURL(); }; v2.__get__sandboxType = function () { return System.security.sandboxType; }; v2.__get__isNetworkHost = function () { switch (this.__get__sandboxType()) { return true; case 'localWithFile': case 'localWithNetwork': case 'localTrusted': case 'application': return false; case 'remote': } return true; }; v2.__get__hasUserSession = function () { return this.sessionId != null && this.sessionId != '' && this.publisherId != 0; }; v2.__get__connected = function () { return this.connectionState == com.newgrounds.APIConnection.CONNECTED; }; v2.reset = function () { this.connectionState = com.newgrounds.APIConnection.NOT_CONNECTED; this.encryptionKey = null; this.sessionId = null; this.userEmail = null; this.username = null; this.userId = 0; this.userpageFormat = 0; }; v2.assertInitialized = function () { if (!this.initialized) { com.newgrounds.Logger.logError('You must initialized the API using API.connect() before using this command.'); return false; } return true; }; v2.assertConnected = function () { if (!this.connectionState == com.newgrounds.APIConnection.CONNECTED) { com.newgrounds.Logger.logError('You must establish a connection using API.connect() before using this command.'); return false; } return true; }; v2.sendSimpleCommand = function (command, completeHandler, parameters, secureParameters) { if (parameters == undefined) { parameters = null; } if (secureParameters == undefined) { secureParameters = null; } var v2 = new com.newgrounds.APICommand(command); v2.__set__parameters(parameters); v2.__set__secureParameters(secureParameters); if (completeHandler != null) { v2.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, completeHandler); } v2.send(this); }; v2.sendCommand = function (command) { command.send(this); }; v2.loadInBrowser = function (command, newWindow, parameters) { if (newWindow == undefined) { newWindow = true; } if (parameters == undefined) { parameters = null; } var v2 = new com.newgrounds.APICommand(command); v2.__set__parameters(parameters); v2.loadInBrowser(this, newWindow); }; v1.NOT_CONNECTED = 'notConnected'; v1.CONNECTING = 'connecting'; v1.CONNECTED = 'connected'; v2.connectionState = com.newgrounds.APIConnection.NOT_CONNECTED; v2.apiURL = 'http://www.ngads.com/gateway_v2.php'; v2.addProperty('connected', v2.__get__connected, function () {}); v2.addProperty('hasUserSession', v2.__get__hasUserSession, function () {}); v2.addProperty('hostURL', v2.__get__hostURL, v2.__set__hostURL); v2.addProperty('isNetworkHost', v2.__get__isNetworkHost, function () {}); v2.addProperty('sandboxType', v2.__get__sandboxType, function () {}); ASSetPropFlags(com.newgrounds.APIConnection.prototype, null, 1); } #endinitclip } movieClip 739 __Packages.com.newgrounds.EventDispatcher { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.EventDispatcher) { var v1 = function () { this._listeners = {}; }; com.newgrounds.EventDispatcher = v1; var v2 = v1.prototype; v2.addEventListener = function (type, listener) { if (!this._listeners[type]) { this._listeners[type] = []; } if (typeof listener == 'function') { this._listeners[type].push({'target': null, 'func': listener}); } else { this._listeners[type].push(listener); } }; v2.removeEventListener = function (type, listener) { var v3 = this._listeners[type]; if (v3) { var v5 = v3.length; var v2 = 0; while (v2 < v5) { if (v3[v2].func == listener || v3[v2] == listener) { v3.splice(v2, 1); return undefined; } ++v2; } } }; v2.dispatchEvent = function (event) { var v4 = this._listeners[event.__get__type()]; if (v4) { var v5 = v4.length; var v2 = 0; while (v2 < v5) { var v3 = v4[v2]; v3.func.call(v3.target, event); ++v2; } } return true; }; ASSetPropFlags(com.newgrounds.EventDispatcher.prototype, null, 1); } #endinitclip } movieClip 738 __Packages.com.newgrounds.Event { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Event) { var v1 = function (type) { this._type = type; }; com.newgrounds.Event = v1; var v2 = v1.prototype; v2.__get__type = function () { return this._type; }; v2.addProperty('type', v2.__get__type, function () {}); ASSetPropFlags(com.newgrounds.Event.prototype, null, 1); } #endinitclip } movieClip 740 __Packages.com.newgrounds.APIEventDispatcher { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APIEventDispatcher) { var v1 = function () { super(); }; com.newgrounds.APIEventDispatcher = v1; com.newgrounds.APIEventDispatcher extends com.newgrounds.EventDispatcher; var v2 = v1.prototype; v1.__get__globalDispatcher = function () { return com.newgrounds.APIEventDispatcher._globalDispatcher; }; v1.__set__globalDispatcher = function (value) { com.newgrounds.APIEventDispatcher._globalDispatcher = value; return com.newgrounds.APIEventDispatcher.__get__globalDispatcher(); }; v1.initEventQueue = function () { setInterval(com.newgrounds.APIEventDispatcher.runEventQueue, 50); return []; }; v2.dispatchEvent = function (event) { com.newgrounds.APIEventDispatcher._eventQueue.push({'dispatcher': this, 'event': event}); return true; }; v2.actualDispatchEvent = function (event) { var v3 = super.dispatchEvent(event); if (com.newgrounds.APIEventDispatcher._globalDispatcher && this != com.newgrounds.APIEventDispatcher._globalDispatcher) { com.newgrounds.APIEventDispatcher._globalDispatcher.dispatchEvent(event); } }; v1.runEventQueue = function (event) { var v3 = com.newgrounds.APIEventDispatcher._eventQueue.length; if (v3) { var v4 = com.newgrounds.APIEventDispatcher._eventQueue; com.newgrounds.APIEventDispatcher._eventQueue = []; var v1 = 0; while (v1 < v3) { var v2 = v4[v1]; v2.dispatcher.actualDispatchEvent(v2.event); ++v1; } } }; v1._eventQueue = com.newgrounds.APIEventDispatcher.initEventQueue(); v1.addProperty('globalDispatcher', v1.__get__globalDispatcher, v1.__set__globalDispatcher); ASSetPropFlags(com.newgrounds.APIEventDispatcher.prototype, null, 1); } #endinitclip } movieClip 743 __Packages.com.newgrounds.encoders.BaseN { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.BaseN) { var v1 = function (hash) { if (hash) { this._hash = hash; } else { this._hash = com.newgrounds.encoders.BaseN.DEFAULT_HASH; } this._base = this._hash.length; this._reverseHash = new Object(); var v2 = 0; while (v2 < this._hash.length) { this._reverseHash[this._hash.charAt(v2)] = v2; ++v2; } }; com.newgrounds.encoders.BaseN = v1; var v2 = v1.prototype; v2.encodeUint = function (number, minimumChars) { if (minimumChars == undefined) { minimumChars = 1; } var v2 = ''; var v3 = number; while (v3 != 0) { v2 = this._hash.charAt(v3 % this._base) + v2; v3 /= this._base; v3 = int(v3); } while (v2.length < minimumChars) { v2 = this._hash.charAt(0) + v2; } return v2; }; v2.decodeUint = function (encodedNumber) { var v3 = 0; var v2 = 0; while (v2 < encodedNumber.length) { v3 *= this._base; v3 += this._reverseHash[encodedNumber.charAt(v2)]; ++v2; } return v3; }; v1.DEFAULT_HASH = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/'; ASSetPropFlags(com.newgrounds.encoders.BaseN.prototype, null, 1); } #endinitclip } movieClip 749 __Packages.com.newgrounds.APICommand { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APICommand) { var v1 = function (command) { super(); this._command = command; this._parameters = new Object(); this._secureParameters = new Object(); this._hasTimeout = true; }; com.newgrounds.APICommand = v1; com.newgrounds.APICommand extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v1.stopPendingCommands = function () { for (var v2 in com.newgrounds.APICommand._pendingCommands) { var v1 = com.newgrounds.APICommand._pendingCommands[v2]; v1.close(); } com.newgrounds.APICommand._pendingCommands = []; }; v1.onThrottleTimer = function (event) { if (getTimer() - com.newgrounds.APICommand._throttleTimestamp >= com.newgrounds.APICommand.THROTTLE_INTERVAL) { com.newgrounds.APICommand._throttleCount = 0; com.newgrounds.APICommand._throttleCount = 0; for (;;) { if (!(com.newgrounds.APICommand._commandQueue.length && com.newgrounds.APICommand._throttleCount < com.newgrounds.APICommand.THROTTLE_THRESHOLD)) break; var v1 = com.newgrounds.APICommand._commandQueue.shift(); v1.command.send(v1.connection); ++com.newgrounds.APICommand._throttleCount; } } }; v1.encryptHex = function (hexValue) { var v4 = hexValue.length % 6; var v3 = ''; var v1 = 0; while (v1 < hexValue.length) { v3 += com.newgrounds.APICommand._encryptor.encodeUint(int('0x' + hexValue.substr(v1, 6)), 4); v1 += 6; } return v4.toString() + v3; }; v2.__get__command = function () { return this._command; }; v2.__set__command = function (value) { this._command = value; return this.__get__command(); }; v2.__get__hasTimeout = function () { return this._hasTimeout; }; v2.__set__hasTimeout = function (val) { this._hasTimeout = val; return this.__get__hasTimeout(); }; v2.__get__parameters = function () { return this._parameters; }; v2.__set__parameters = function (object) { this._parameters = new Object(); if (object) { for (var v3 in object) { this._parameters[v3] = object[v3]; } } return this.__get__parameters(); }; v2.__get__preventCache = function () { return this._preventCache; }; v2.__set__preventCache = function (value) { this._preventCache = value; return this.__get__preventCache(); }; v2.__get__secureParameters = function () { return this._secureParameters; }; v2.__set__secureParameters = function (object) { this._secureParameters = new Object(); if (object) { for (var v3 in object) { this._secureParameters[v3] = object[v3]; } } return this.__get__secureParameters(); }; v2.__get__hasSecureParameters = function () { for (var v2 in this._secureParameters) { return true; } return false; }; v2.addFile = function (filename, data, dataField, contentType) { if (contentType == undefined) { contentType = 'application/octet-stream'; } if (!this._files) { this._files = new Object(); } var v3 = {'filename': filename, 'data': data, 'dataField': dataField, 'contentType': contentType}; this._files[filename] = v3; }; v2.removeFile = function (filename) { if (this._files) { delete this._files[filename]; } }; v2.clearFiles = function () { this._files = null; }; v2.close = function () { if (this._loader) { clearInterval(this._timeoutTimer); var v2 = 0; while (v2 < com.newgrounds.APICommand._pendingCommands.length) { if (com.newgrounds.APICommand._pendingCommands[v2] == this) { com.newgrounds.APICommand._pendingCommands.splice(v2, 1); break; } ++v2; } this._loader = null; } }; v2.loadInBrowser = function (connection, newWindow) { this._parameters.command_id = this._command; this._parameters.tracker_id = connection.apiId ? connection.apiId : 1; if (connection.debug) { this._parameters.debug = 1; } var v3 = connection.apiURL + '?host=' + escape(connection.hostDomain); for (var v4 in this._parameters) { v3 += '&' + escape(v4) + '=' + escape(this._parameters[v4]); } var v6; if (newWindow) { v6 = '_blank'; } else { v6 = '_top'; } _root.getURL(v3, v6); }; v2.send = function (connection) { if (com.newgrounds.APICommand._throttleCount >= com.newgrounds.APICommand.THROTTLE_THRESHOLD) { com.newgrounds.APICommand._commandQueue.push({'connection': connection, 'command': this}); } else { this.sendInternal(connection); } }; v2.sendInternal = function (connection) { var v4; v4 = new LoadVars(); v4.command_id = this._command; v4.tracker_id = connection.apiId; if (connection.debug) { v4.debug = 1; } if (this._preventCache) { v4.seed = Math.random(); } var v2; var v3; var v7; for (v2 in this._parameters) { v3 = this._parameters[v2]; if (v3 != null) { if (typeof v3 == 'boolean') { v4[v2] = int(v3); } else { v4[v2] = v3; } } } if (this.__get__hasSecureParameters()) { var v6 = new Object(); for (v2 in this._secureParameters) { v3 = this._secureParameters[v2]; if (v3 != null) { if (typeof v3 == 'boolean') { v6[v2] = int(v3); } else { v6[v2] = v3; } } } var v8 = ''; v7 = 0; while (v7 < 16) { v8 += com.newgrounds.APICommand.ENCRYPTOR_RADIX.charAt(int(Math.random() * com.newgrounds.APICommand.ENCRYPTOR_RADIX.length)); ++v7; } v4.command_id = 'securePacket'; v6.command_id = this._command; v6.as_version = 3; v6.session_id = connection.sessionId; v6.user_email = connection.userEmail; v6.publisher_id = connection.publisherId; v6.seed = v8; var v13 = com.newgrounds.crypto.MD5.hash(v8); var v11 = com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(v6), connection.encryptionKey); v4.secure = com.newgrounds.APICommand.encryptHex(v13 + v11); } com.newgrounds.Logger.logInternal('Sending packet:', v4); var v12; v12 = 'application/x-www-form-urlencoded'; for (v2 in v4) { if (typeof v4[v2] == 'object') { v4[v2] = com.newgrounds.encoders.json.JSON.encode(v4[v2]); } } if (this._files) { for (var v10 in this._files) { var v5 = this._files[v10]; if (typeof v5.data == 'string') { v4[v10] = v5.data; } else { v4[v10] = com.newgrounds.encoders.json.JSON.encode(v5.data); } } } com.newgrounds.APICommand._pendingCommands.push(this); ++com.newgrounds.APICommand._throttleCount; com.newgrounds.APICommand._throttleTimestamp = getTimer(); this.startLoader(connection.apiURL, v4, v12); }; v2.startLoader = function (url, data, contentType) { this._loader = LoadVars(data); this._loader.onData = this.as2CompleteHandler; this._loader.contentType = contentType; this._loader.sendAndLoad(url, this._loader, 'POST'); if (this._hasTimeout) { setInterval(this, this.onTimeout, com.newgrounds.APICommand.TIMEOUT_INTERVAL); } }; v2.as2CompleteHandler = function (data) { var v3; var v2 = 0; while (v2 < com.newgrounds.APICommand._pendingCommands.length) { if (com.newgrounds.APICommand._pendingCommands[v2]._loader == this) { v3 = com.newgrounds.APICommand._pendingCommands[v2]; break; } ++v2; } v3.onComplete(data); }; v2.onTimeout = function (event) { this.close(); com.newgrounds.Logger.logError('Command timed out.'); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_TIMED_OUT)); }; v2.onError = function (error) { com.newgrounds.Logger.logError('Error when sending command:', error); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_UNKNOWN)); this.close(); }; v2.onComplete = function (data) { try { if (!data || data == '') { throw new Error(); } com.newgrounds.Logger.logInternal('Received packet:', data); var v2 = com.newgrounds.encoders.json.JSON.decode(data); if (!v2) { throw new Error(); } if (com.newgrounds.APICommand.bridge) { com.newgrounds.APICommand.bridge.sendEvent(v2.command_id, v2); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, v2, (v2 && v2.success) ? com.newgrounds.APIEvent.ERROR_NONE : com.newgrounds.APIEvent.ERROR_COMMAND_FAILED)); } catch (e) { com.newgrounds.Logger.logError('Invalid response returned from server: ' + data); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.COMMAND_COMPLETE, null, com.newgrounds.APIEvent.ERROR_BAD_RESPONSE)); } this.close(); }; v1.TIMEOUT_INTERVAL = 10000; v1.THROTTLE_INTERVAL = 10050; v1.THROTTLE_TICK_INTERVAL = 1000; v1.THROTTLE_THRESHOLD = 24; v1._throttleCount = 0; v1._commandQueue = []; v1._throttleTimer = setInterval(com.newgrounds.APICommand.onThrottleTimer, com.newgrounds.APICommand.THROTTLE_TICK_INTERVAL); v1.ENCRYPTOR_RADIX = '/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X'; v1._encryptor = new com.newgrounds.encoders.BaseN(com.newgrounds.APICommand.ENCRYPTOR_RADIX); v1._pendingCommands = []; v1.CRLF = '\r\n'; v2.addProperty('command', v2.__get__command, v2.__set__command); v2.addProperty('hasSecureParameters', v2.__get__hasSecureParameters, function () {}); v2.addProperty('hasTimeout', v2.__get__hasTimeout, v2.__set__hasTimeout); v2.addProperty('parameters', v2.__get__parameters, v2.__set__parameters); v2.addProperty('preventCache', v2.__get__preventCache, v2.__set__preventCache); v2.addProperty('secureParameters', v2.__get__secureParameters, v2.__set__secureParameters); ASSetPropFlags(com.newgrounds.APICommand.prototype, null, 1); } #endinitclip } movieClip 744 __Packages.com.newgrounds.Bridge { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Bridge) { var v1 = function (id) { this._widgetId = id; this._inConnection = new LocalConnection(); this._outConnection = new LocalConnection(); this._inConnection.receiveEvent = this.receiveEvent; try { this._inConnection.connect('rec_' + this._widgetId); } com.newgrounds.Logger.addEventListener(com.newgrounds.APIEvent.LOG, {'target': this, 'func': this.onLogMessage}); }; com.newgrounds.Bridge = v1; var v2 = v1.prototype; v2.onLogMessage = function (event) { try { this._outConnection.send(this._widgetId, 'sendEvent', 'trace', String(event.__get__data())); } }; v2.sendEvent = function (command, parameters) { if (this._outConnection) { parameters = {'data': parameters}; this._outConnection.send(this._widgetId, 'sendEvent', command, parameters); } }; v2.receiveEvent = function (event, parameters) {}; v2.onStatus = function (event) {}; ASSetPropFlags(com.newgrounds.Bridge.prototype, null, 1); } #endinitclip } movieClip 741 __Packages.com.newgrounds.APIEvent { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APIEvent) { var v1 = function (type, data, error) { super(type); if (data == undefined) { data = null; } if (error == undefined) { error = null; } if (!error || error == '' || error == com.newgrounds.APIEvent.ERROR_NONE) { this._error = com.newgrounds.APIEvent.ERROR_NONE; this._success = true; } else { this._error = error; this._success = false; } if (data) { this._data = data; } else { this._data = {}; } }; com.newgrounds.APIEvent = v1; com.newgrounds.APIEvent extends com.newgrounds.Event; var v2 = v1.prototype; v2.clone = function () { return new com.newgrounds.APIEvent(this.__get__type(), this._data, this._error); }; v2.__get__success = function () { return this._success; }; v2.__get__data = function () { return this._data; }; v2.__get__error = function () { return this._error; }; v1.COMMAND_COMPLETE = 'commandComplete'; v1.MEDAL_UNLOCK_CONFIRMED = 'medalUnlockConfirmed'; v1.ICON_LOADED = 'iconLoaded'; v1.API_CONNECTED = 'movieConnected'; v1.LOG = 'log'; v1.MEDAL_UNLOCKED = 'medalUnlocked'; v1.SCORES_LOADED = 'scoresLoaded'; v1.SCORE_POSTED = 'scorePosted'; v1.QUERY_COMPLETE = 'queryComplete'; v1.FILE_LOADED = 'fileLoaded'; v1.FILE_SAVED = 'fileSaved'; v1.FILE_REQUESTED = 'fileRequested'; v1.VOTE_COMPLETE = 'voteComplete'; v1.ERROR_NONE = 'noError'; v1.ERROR_UNKNOWN = 'unknownError'; v1.ERROR_COMMAND_FAILED = 'commandFailed'; v1.ERROR_NOT_CONNECTED = 'notConnected'; v1.ERROR_INVALID_ARGUMENT = 'invalidArgument'; v1.ERROR_TIMED_OUT = 'timedOut'; v1.ERROR_BAD_FILE = 'badFile'; v1.ERROR_BAD_RESPONSE = 'badResponse'; v1.ERROR_SENDING_COMMAND = 'errorSendingCommand'; v1.ERROR_HOST_BLOCKED = 'hostBlocked'; v1.ERROR_ALREADY_VOTED = 'alreadyVoted'; v1.ERROR_NOT_LOGGED_IN = 'notLoggedIn'; v1.ERROR_WRONG_ENCRYPTION_KEY = 'wrongEncryptionKey'; v2.addProperty('data', v2.__get__data, function () {}); v2.addProperty('error', v2.__get__error, function () {}); v2.addProperty('success', v2.__get__success, function () {}); ASSetPropFlags(com.newgrounds.APIEvent.prototype, null, 1); } #endinitclip } movieClip 760 __Packages.com.newgrounds.API { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.API) { var v1 = function () {}; com.newgrounds.API = v1; var v2 = v1.prototype; v1.__get__connected = function () { return com.newgrounds.API._connection.__get__connected(); }; v1.__get__isNetworkHost = function () { return com.newgrounds.API._connection.__get__isNetworkHost(); }; v1.__get__apiId = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.apiId; }; v1.__get__debugMode = function () { return com.newgrounds.API._debugMode; }; v1.__set__debugMode = function (val) { com.newgrounds.API._debugMode = val; return com.newgrounds.API.__get__debugMode(); }; v1.__get__publisherId = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.publisherId; }; v1.__get__sessionId = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.sessionId; }; v1.__get__hostDomain = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.hostDomain; }; v1.__get__hostURL = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.__get__hostURL(); }; v1.__get__isNewgrounds = function () { return com.newgrounds.API._connection.publisherId == 1; }; v1.__get__hasUserSession = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.__get__hasUserSession(); }; v1.__get__username = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.username; }; v1.__get__userId = function () { com.newgrounds.API._connection.assertInitialized(); return com.newgrounds.API._connection.userId; }; v1.assertConnected = function (eventType) { if (eventType == undefined) { eventType = null; } if (com.newgrounds.API._connection.assertConnected()) { return true; } else { if (eventType) { com.newgrounds.API.dispatchEvent(eventType, null, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED); } return false; } }; v1.__get__adsApproved = function () { return com.newgrounds.API._adsApproved; }; v1.__get__adFeedURL = function () { return com.newgrounds.API._adFeedURL; }; v1.__get__medals = function () { return com.newgrounds.API._medalsArray; }; v1.__get__scoreBoards = function () { return com.newgrounds.API._scoreBoardsArray; }; v1.__get__saveGroups = function () { return com.newgrounds.API._saveGroupsArray; }; v1.connect = function (_root, apiId, encryptionKey, movieVersion) { if (encryptionKey == undefined) { encryptionKey = null; } if (movieVersion == undefined) { movieVersion = ''; } com.newgrounds.APIEventDispatcher.__set__globalDispatcher(com.newgrounds.API._dispatcher); System.security.loadPolicyFile('http://apifiles.ngfiles.com/crossdomain.xml'); if (com.newgrounds.API._connection.initialized) { com.newgrounds.Logger.logError('Connection already in progress. Please call API.disconnect() before attempting another connection.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_NOT_CONNECTED); return undefined; } apiId = com.newgrounds.API.trimWhitespace(apiId); if (encryptionKey) { encryptionKey = com.newgrounds.API.trimWhitespace(encryptionKey); } if (!apiId || apiId == '') { com.newgrounds.Logger.logError('No apiId given. Please use the API ID from your API settings page.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT); return undefined; } com.newgrounds.Logger.logMessage('====== Newgrounds API v' + com.newgrounds.API.VERSION + ' ======'); com.newgrounds.API._connection.connectionState = com.newgrounds.APIConnection.CONNECTING; _root = _root; com.newgrounds.API._movieVersion = movieVersion; com.newgrounds.API._connection.apiId = apiId; var v4; v4 = apiId.indexOf(':'); if (v4 != -1) { com.newgrounds.API._connection.trackerId = int(apiId.substring(0, v4)); } else { com.newgrounds.API._connection.trackerId = int(apiId); } if (!com.newgrounds.API._connection.trackerId) { com.newgrounds.Logger.logError('Invalid API ID: ' + apiId); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, false, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT); return undefined; } com.newgrounds.API._connection.encryptionKey = encryptionKey; com.newgrounds.API._connection.initialized = true; com.newgrounds.API._connection.__set__hostURL(_root._url); com.newgrounds.API.doConnect(_root); }; v1.doConnect = function (flashVars) { if (com.newgrounds.API.__get__isNetworkHost() && com.newgrounds.API._debugMode != com.newgrounds.API.RELEASE_MODE) { com.newgrounds.Logger.logMessage('Live file detected, turning off debug mode.'); com.newgrounds.API._debugMode = com.newgrounds.API.RELEASE_MODE; } if (flashVars && flashVars.NewgroundsAPI_SandboxID) { com.newgrounds.API._bridge = new com.newgrounds.Bridge(flashVars.NewgroundsAPI_SandboxID); com.newgrounds.APICommand.bridge = com.newgrounds.API._bridge; } if (com.newgrounds.API._debugMode == com.newgrounds.API.RELEASE_MODE) { if (flashVars) { if (flashVars.NewgroundsAPI_UserName) { com.newgrounds.API._connection.username = flashVars.NewgroundsAPI_UserName; } if (flashVars.NewgroundsAPI_UserID) { com.newgrounds.API._connection.userId = flashVars.NewgroundsAPI_UserID; } if (flashVars.NewgroundsAPI_PublisherID) { com.newgrounds.API._connection.publisherId = flashVars.NewgroundsAPI_PublisherID; } if (flashVars.NewgroundsAPI_UserpageFormat) { com.newgrounds.API._connection.userpageFormat = flashVars.NewgroundsAPI_UserpageFormat; } if (flashVars.NewgroundsAPI_SessionID) { com.newgrounds.API._connection.sessionId = flashVars.NewgroundsAPI_SessionID; } if (flashVars.NewgroundsAPI_SaveGroupID) { com.newgrounds.API._requestedSaveGroupId = flashVars.NewgroundsAPI_SaveGroupID; } if (flashVars.NewgroundsAPI_SaveFileID) { com.newgrounds.API._requestedSaveFileId = flashVars.NewgroundsAPI_SaveFileID; } } } else { com.newgrounds.API._connection.debug = true; if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_IN || com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_OUT) { com.newgrounds.API._connection.publisherId = 1; } if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_LOGGED_IN) { com.newgrounds.API._connection.sessionId = 'D3bu64p1U53R'; com.newgrounds.API._connection.userId = 10; com.newgrounds.API._connection.username = 'API-Debugger'; } } com.newgrounds.API._connection.sendSimpleCommand('connectMovie', com.newgrounds.API.onConnect, {'host': com.newgrounds.API._connection.hostDomain, 'movie_version': com.newgrounds.API._movieVersion, 'publisher_id': com.newgrounds.API._connection.publisherId}); }; v1.onConnect = function (event) { var v1 = event.__get__data(); if (!event.__get__success()) { com.newgrounds.Logger.logError('Unable to connect to the API.'); com.newgrounds.API._connection.reset(); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, event.__get__data(), event.__get__error()); return undefined; } if (com.newgrounds.API.__get__debugMode() != com.newgrounds.API.RELEASE_MODE) { com.newgrounds.API._adFeedURL = com.newgrounds.API.TEST_AD_FEED_URL; } else { if (v1.ad_url) { com.newgrounds.API._adFeedURL = unescape(v1.ad_url); } } switch (v1.ad_status) { case -1: com.newgrounds.Logger.logWarning('Your movie is not approved to run Flash Ads.'); break; case 0: com.newgrounds.Logger.logWarning('Your movie is still awaiting approval to run Flash Ads.'); break; case 1: com.newgrounds.Logger.logMessage('Your movie is approved to run Flash Ads!'); } com.newgrounds.API._adsApproved = v1.ad_status == 1; if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_HOST_BLOCKED || v1.deny_host) { com.newgrounds.Logger.logWarning(com.newgrounds.API._connection.hostDomain + ' does not have permission to host this movie!', 'Update your API configuration to allow this host.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {'officialURL': unescape(v1.movie_url)}, com.newgrounds.APIEvent.ERROR_HOST_BLOCKED); com.newgrounds.API._connection.reset(); return undefined; } com.newgrounds.API._movieName = v1.movieName ? v1.movieName : ''; com.newgrounds.Logger.logMessage('Connecting to the Newgrounds API Gateway...', '----- ' + v1.movie_name + ' -----'); if (com.newgrounds.API._debugMode == com.newgrounds.API.DEBUG_MODE_NEW_VERSION) { v1.movie_version = 'Debug Mode'; } if (v1.movie_version) { com.newgrounds.Logger.logMessage('A new version of this movie is available.', 'Current version:\t' + com.newgrounds.API._movieVersion, 'Newest version:\t' + v1.movie_version, 'Use API.loadOfficialVersion() to link to the latest version.'); com.newgrounds.API._newVersion = true; } else { com.newgrounds.API._newVersion = false; } if (v1.request_portal_url) { com.newgrounds.API._connection.sendSimpleCommand('setPortalID', null, {'portal_url': com.newgrounds.API._connection.__get__hostURL()}); } com.newgrounds.API._connection.sendSimpleCommand('preloadSettings', com.newgrounds.API.onMetadataLoaded, {'publisher_id': com.newgrounds.API._connection.publisherId, 'user_id': com.newgrounds.API._connection.userId}); }; v1.onMetadataLoaded = function (event) { var v11 = event.__get__data(); var v1; var v7; if (!event.__get__success()) { com.newgrounds.Logger.logWarning('Unable to load movie metadata.'); com.newgrounds.API.disconnect(); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, null, event.__get__error()); return undefined; } var v10 = 0; if (v11.medals) { v10 = v11.medals.length; var v18; if (com.newgrounds.API.__get__hasUserSession()) { v18 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username()); } else { v18 = com.newgrounds.API.loadLocal('medals_unlocked'); } v1 = 0; while (v1 < v10) { var v4 = v11.medals[v1]; var v15 = v4.medal_unlocked; var v17 = v18 && v18[v4.medal_id]; var v14 = com.newgrounds.API.__get__hasUserSession() ? v15 : v17; if (com.newgrounds.API.__get__debugMode() != com.newgrounds.API.RELEASE_MODE) { v14 = false; } var v5 = new com.newgrounds.Medal(com.newgrounds.API._connection, v4.medal_id, v4.medal_name, v4.medal_description, Boolean(int(v4.secret)), v14, v4.medal_value, v4.medal_difficulty, v4.medal_icon); v5.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, com.newgrounds.API.onMedalUnlocked, false, 0, true); v5.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, com.newgrounds.API.onMedalUnlockConfirmed, false, 0, true); com.newgrounds.API._medals[v5.__get__name()] = v5; com.newgrounds.API._medalsArray.push(v5); com.newgrounds.Logger.logMessage(v5); if (com.newgrounds.API.__get__hasUserSession() && v17 && !v15) { com.newgrounds.Logger.logMessage('Server missed the "' + v5.__get__name() + '" unlock. Resending...'); v5.unlock(); } ++v1; } } com.newgrounds.Logger.logMessage(v10 + ' medal' + ((v10 != 1) ? 's' : '') + ' initialized.'); v10 = 0; if (v11.score_boards) { v10 = v11.score_boards.length; v1 = 0; while (v1 < v10) { var v16 = v11.score_boards[v1]; var v9 = new com.newgrounds.ScoreBoard(com.newgrounds.API._connection, v16.name, v16.id); com.newgrounds.API._scoreBoards[v9.__get__name()] = v9; com.newgrounds.API._scoreBoardsArray.push(v9); com.newgrounds.Logger.logMessage(v9); ++v1; } } com.newgrounds.Logger.logMessage(v10 + ' scoreboard' + ((v10 != 1) ? 's' : '') + ' initialized.'); v10 = 0; if (v11.save_groups) { v10 = v11.save_groups.length; v1 = 0; while (v1 < v10) { var v2 = v11.save_groups[v1]; var v13 = []; if (v2.keys) { v7 = 0; while (v7 < v2.keys.length) { var v6 = v2.keys[v7]; v13.push(new com.newgrounds.SaveKey(v6.name, v6.id, v6.type)); ++v7; } } var v12 = []; if (v2.ratings) { v1 = 0; while (v1 < v2.ratings.length) { var v3 = v2.ratings[v1]; v12.push(new com.newgrounds.SaveRating(v3.name, v3.id, v3.float, v3.min, v3.max)); ++v1; } } var v8 = new com.newgrounds.SaveGroup(com.newgrounds.API._connection, v2.group_name, v2.group_id, v2.group_type, v13, v12); com.newgrounds.API._saveGroups[v8.__get__name()] = v8; com.newgrounds.API._saveGroupsArray.push(v8); com.newgrounds.Logger.logMessage(v8); ++v1; } } com.newgrounds.Logger.logMessage(v10 + ' save group' + ((v10 != 1) ? 's' : '') + ' initialized.'); if (v11.save_file_path) { com.newgrounds.API._saveFilePath = v11.save_file_path + '/'; com.newgrounds.SaveFile._saveFilePath = com.newgrounds.API._saveFilePath; com.newgrounds.Logger.logInternal('Save file path: ' + com.newgrounds.API._saveFilePath); } if (v11.image_file_path) { com.newgrounds.API._imageFilePath = v11.image_file_path + '/'; com.newgrounds.SaveFile._imageFilePath = com.newgrounds.API._imageFilePath; com.newgrounds.Logger.logInternal('Image file path: ' + com.newgrounds.API._imageFilePath); } com.newgrounds.Logger.logMessage('Connection complete!'); com.newgrounds.API._connection.connectionState = com.newgrounds.APIConnection.CONNECTED; com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.API_CONNECTED, {'movieName': com.newgrounds.API._movieName, 'newVersion': com.newgrounds.API._newVersion}); if (com.newgrounds.API._requestedSaveFileId && com.newgrounds.API._requestedSaveGroupId) { com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_LOADED, com.newgrounds.API.onRequestedFileLoaded); com.newgrounds.API.loadSaveFile(com.newgrounds.API._requestedSaveFileId, false); } }; v1.disconnect = function () { if (!com.newgrounds.API._connection.__get__connected()) { com.newgrounds.Logger.logWarning('The Newgrounds API is already disconnected.'); return undefined; } com.newgrounds.API._connection.reset(); for (var v2 in com.newgrounds.API._medals) { var v1 = com.newgrounds.API._medals[v2]; v1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, com.newgrounds.API.onMedalUnlocked); v1.removeEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, com.newgrounds.API.onMedalUnlockConfirmed); } com.newgrounds.API._newVersion = false; com.newgrounds.API._medals = new Object(); com.newgrounds.API._medalsArray = []; com.newgrounds.API._scoreBoards = new Object(); com.newgrounds.API._scoreBoardsArray = []; com.newgrounds.API._saveGroups = new Object(); com.newgrounds.API._saveGroupsArray = []; com.newgrounds.API._sharedObjects = new Object(); com.newgrounds.API._imageFilePath = null; com.newgrounds.API._saveFilePath = null; com.newgrounds.Logger.logMessage('Disconnected from the Newgrounds API.'); }; v1.loadNewgrounds = function () { com.newgrounds.API._connection.loadInBrowser('loadNewgrounds'); }; v1.loadOfficialVersion = function () { if (com.newgrounds.API._connection.assertInitialized()) { com.newgrounds.API._connection.loadInBrowser('loadOfficialVersion', false); } }; v1.loadMySite = function () { if (com.newgrounds.API._connection.assertInitialized()) { com.newgrounds.API._connection.loadInBrowser('loadMySite'); } }; v1.loadCustomLink = function (linkName) { if (com.newgrounds.API._connection.assertInitialized()) { com.newgrounds.API._connection.loadInBrowser('loadCustomLink', true, {'link': linkName}); } }; v1.getMedal = function (medalName) { return com.newgrounds.API._medals[medalName]; }; v1.unlockMedal = function (medalName) { if (!com.newgrounds.API.assertConnected()) { return undefined; } var v1 = com.newgrounds.API._medals[medalName]; if (!v1) { com.newgrounds.Logger.logError('No medal named "' + medalName + '" w.'); return undefined; } v1.unlock(); }; v1.onMedalUnlocked = function (event) { if (event.__get__success()) { var v2 = com.newgrounds.Medal(event.__get__data()); var v1; if (com.newgrounds.API.__get__hasUserSession()) { v1 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username()); if (!v1) { v1 = new Object(); } v1[v2.__get__id()] = true; com.newgrounds.API.saveLocal('medals_unlocked_' + com.newgrounds.API.__get__username(), v1); } else { v1 = com.newgrounds.API.loadLocal('medals_unlocked'); if (!v1) { v1 = new Object(); } v1[(com.newgrounds.Medal(event.__get__data())).__get__id()] = true; com.newgrounds.API.saveLocal('medals_unlocked', v1); com.newgrounds.Logger.logMessage('User instanceof not logged in. Medal "' + v2.__get__name() + '" unlocked locally.'); } } }; v1.onMedalUnlockConfirmed = function (event) { if (com.newgrounds.API.__get__hasUserSession()) { var v1 = com.newgrounds.API.loadLocal('medals_unlocked_' + com.newgrounds.API.__get__username()); if (!v1) { v1 = new Object(); } else { delete v1[(com.newgrounds.Medal(event.__get__data())).__get__id()]; } com.newgrounds.API.saveLocal('medals_unlocked_' + com.newgrounds.API.__get__username(), v1); } }; v1.clearLocalMedals = function () { for (var v2 in com.newgrounds.API._medals) { var v1 = com.newgrounds.API._medals[v2]; v1.setUnlocked(false); } if (!com.newgrounds.API.__get__hasUserSession()) { com.newgrounds.API.saveLocal('medals_unlocked', new Object()); } }; v1.getScoreBoard = function (scoreBoardName) { if (!com.newgrounds.API.assertConnected()) { return null; } return com.newgrounds.API._scoreBoards[scoreBoardName]; }; v1.loadScores = function (scoreBoardName, period, firstResult, numResults, tag) { if (period == undefined) { period = 'All-Time'; } if (firstResult == undefined) { firstResult = 1; } if (numResults == undefined) { numResults = 10; } if (tag == undefined) { tag = null; } if (!com.newgrounds.API.assertConnected()) { return null; } var v1 = com.newgrounds.API._scoreBoards[scoreBoardName]; if (!v1) { com.newgrounds.Logger.logError('No scoreboard named "' + scoreBoardName + '" w.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORES_LOADED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT); return null; } v1.__set__period(period); v1.__set__firstResult(firstResult); v1.__set__numResults(numResults); v1.__set__tag(tag); v1.loadScores(); return v1; }; v1.postScore = function (scoreBoardName, numericScore, tag) { if (tag == undefined) { tag = null; } if (!com.newgrounds.API.assertConnected()) { return undefined; } if (!com.newgrounds.API.__get__hasUserSession()) { com.newgrounds.Logger.logError('The user must be logged-in to post a score.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN); return undefined; } var v1 = com.newgrounds.API._scoreBoards[scoreBoardName]; if (!v1) { com.newgrounds.Logger.logError('No scoreboard named "' + scoreBoardName + '" w.'); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT); return undefined; } v1.postScore(numericScore, tag); }; v1.getSaveGroup = function (groupName) { if (!com.newgrounds.API.assertConnected()) { return null; } return com.newgrounds.API._saveGroups[groupName]; }; v1.getSaveGroupById = function (id) { for (var v3 in com.newgrounds.API._saveGroups) { var v1 = com.newgrounds.API._saveGroups[v3]; if (v1.__get__id() == id) { return v1; } } return null; }; v1.createSaveFile = function (groupName) { if (!com.newgrounds.API.assertConnected()) { return null; } var v1 = com.newgrounds.API.getSaveGroup(groupName); if (!v1) { com.newgrounds.Logger.logError('The save group "' + groupName + '" w found.'); return null; } return new com.newgrounds.SaveFile(v1); }; v1.loadSaveFile = function (saveId, loadContents) { if (loadContents == undefined) { loadContents = true; } com.newgrounds.API._connection.sendSimpleCommand('loadSaveFile', com.newgrounds.API.onFileLoaded, {'save_id': saveId, 'get_contents': loadContents}); }; v1.onFileLoaded = function (event) { var v2; if (event.__get__success()) { v2 = com.newgrounds.SaveFile.fromObject(com.newgrounds.API.getSaveGroupById((event.__get__data()).group_id), (event.__get__data()).file); if ((event.__get__data()).get_contents) { v2.load(); } else { com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, v2); } } else { com.newgrounds.Logger.logError('Unable to load file:', event.__get__error()); com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_LOADED, null, event.__get__error()); } }; v1.createSaveQuery = function (groupName) { if (!com.newgrounds.API.assertConnected()) { return null; } var v1 = com.newgrounds.API.getSaveGroup(groupName); if (!v1) { com.newgrounds.Logger.logError('The save group "' + groupName + '" w found.'); return null; } var v2 = new com.newgrounds.SaveQuery(v1); return v2; }; v1.createSaveQueryByDate = function (groupName, sortDescending) { if (sortDescending == undefined) { sortDescending = true; } var v1 = com.newgrounds.API.createSaveQuery(groupName); if (!v1) { return null; } v1.sortOn(com.newgrounds.SaveQuery.CREATED_ON, sortDescending); return v1; }; v1.createSaveQueryByName = function (groupName, filename, exactMatch, sortDescending) { if (exactMatch == undefined) { exactMatch = false; } if (sortDescending == undefined) { sortDescending = false; } var v1 = com.newgrounds.API.createSaveQuery(groupName); if (!exactMatch) { v1.addCondition(com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.OPERATOR_CONTAINS, filename); return v1; } v1.addCondition(com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.OPERATOR_EQUAL, filename); return v1; }; v1.createSaveQueryByRating = function (groupName, ratingName, sortDescending) { if (sortDescending == undefined) { sortDescending = true; } var v1 = com.newgrounds.API.createSaveQuery(groupName); v1.sortOn(ratingName, sortDescending); return v1; }; v1.onRequestedFileLoaded = function (event) { com.newgrounds.API.removeEventListener(com.newgrounds.APIEvent.FILE_LOADED, com.newgrounds.API.onRequestedFileLoaded); if (event.__get__success()) { var v1 = event.__get__data(); if (v1) { com.newgrounds.API.dispatchEvent(com.newgrounds.APIEvent.FILE_REQUESTED, v1); } } }; v1.addEventListener = function (eventType, listener, priority, useWeakReference) { if (priority == undefined) { priority = 0; } if (useWeakReference == undefined) { useWeakReference = true; } com.newgrounds.API._dispatcher.addEventListener(eventType, listener, false, priority, useWeakReference); }; v1.removeEventListener = function (eventType, listener) { com.newgrounds.API._dispatcher.removeEventListener(eventType, listener); }; v1.dispatchEvent = function (event, data, error) { if (data == undefined) { data = null; } if (error == undefined) { error = null; } com.newgrounds.API._dispatcher.dispatchEvent(new com.newgrounds.APIEvent(event, data, error)); }; v1.saveLocal = function (saveId, saveData) { try { var v3; var v2 = 'ng_ap_secure_' + com.newgrounds.API._connection.trackerId + '_' + com.newgrounds.crypto.RC4.encrypt(saveId, com.newgrounds.API._connection.encryptionKey); if (!com.newgrounds.API._sharedObjects[saveId]) { com.newgrounds.API._sharedObjects[saveId] = SharedObject.getLocal(v2); } v3 = com.newgrounds.API._sharedObjects[saveId]; v3.data.data = com.newgrounds.API.encodeData(saveData); } catch (v0) { if (Error(v0) != null) { var error = Error(v0); com.newgrounds.Logger.logError('Unable to save local data.', error); return false; return true; } throw v0; } return true; }; v1.loadLocal = function (saveId) { try { var v1; var v3 = 'ng_ap_secure_' + com.newgrounds.API._connection.trackerId + '_' + com.newgrounds.crypto.RC4.encrypt(saveId, com.newgrounds.API._connection.encryptionKey); if (!com.newgrounds.API._sharedObjects[saveId]) { com.newgrounds.API._sharedObjects[saveId] = SharedObject.getLocal(v3); } v1 = com.newgrounds.API._sharedObjects[saveId]; if (v1 && v1.data && v1.data.data) { return com.newgrounds.API.decodeData(v1.data.data); } return null; } catch (v0) { if (Error(v0) != null) { var error = Error(v0); com.newgrounds.Logger.logError('Unable to load local data.', error); return null; } throw v0; } return null; }; v1.logCustomEvent = function (eventName) { if (com.newgrounds.API.assertConnected()) { com.newgrounds.Logger.logMessage('Logged event: ' + eventName); com.newgrounds.API._connection.sendSimpleCommand('logCustomEvent', null, {'event': eventName}); } }; v1.encodeData = function (data) { if (!com.newgrounds.API._connection.assertInitialized()) { return null; } return com.newgrounds.crypto.RC4.encrypt(com.newgrounds.encoders.json.JSON.encode(data), com.newgrounds.API._connection.encryptionKey); }; v1.decodeData = function (data) { if (!com.newgrounds.API._connection.assertInitialized()) { return null; } try { return com.newgrounds.encoders.json.JSON.decode(com.newgrounds.crypto.RC4.decrypt(data, com.newgrounds.API._connection.encryptionKey)); } catch (v0) { if (Error(v0) != null) { var error = Error(v0); return null; } throw v0; } return null; }; v1.stopPendingCommands = function () { com.newgrounds.APICommand.stopPendingCommands(); com.newgrounds.Logger.logMessage('Pending commands stopped.'); }; v1.trimWhitespace = function (string) { if (!string) { return null; } var v3 = 0; while (string.charAt(v3) == ' ') { ++v3; } var v1 = string.length - 1; for (;;) { if (!(string.charAt(v1) == ' ' && v1 >= 0)) break; --v1; } return string.slice(v3, v1 + 1); }; v1.VERSION = '3.1.0 AS2'; v1.RELEASE_MODE = 'releaseMode'; v1.DEBUG_MODE_LOGGED_IN = 'debugModeLoggedIn'; v1.DEBUG_MODE_LOGGED_OUT = 'debugModeLoggedOut'; v1.DEBUG_MODE_NEW_VERSION = 'debugModeNewVersion'; v1.DEBUG_MODE_HOST_BLOCKED = 'debugModeHostBlocked'; v1.TEST_AD_FEED_URL = 'http://www.ngads.com/adtest.php'; v1._dispatcher = new com.newgrounds.APIEventDispatcher(); v1._connection = new com.newgrounds.APIConnection(); v1._debugMode = com.newgrounds.API.DEBUG_MODE_LOGGED_IN; v1._adsApproved = false; v1._medals = new Object(); v1._medalsArray = []; v1._scoreBoards = new Object(); v1._scoreBoardsArray = []; v1._saveGroups = new Object(); v1._saveGroupsArray = []; v1._sharedObjects = new Object(); v1.addProperty('adFeedURL', v1.__get__adFeedURL, function () {}); v1.addProperty('adsApproved', v1.__get__adsApproved, function () {}); v1.addProperty('apiId', v1.__get__apiId, function () {}); v1.addProperty('connected', v1.__get__connected, function () {}); v1.addProperty('debugMode', v1.__get__debugMode, v1.__set__debugMode); v1.addProperty('hasUserSession', v1.__get__hasUserSession, function () {}); v1.addProperty('hostDomain', v1.__get__hostDomain, function () {}); v1.addProperty('hostURL', v1.__get__hostURL, function () {}); v1.addProperty('isNetworkHost', v1.__get__isNetworkHost, function () {}); v1.addProperty('isNewgrounds', v1.__get__isNewgrounds, function () {}); v1.addProperty('medals', v1.__get__medals, function () {}); v1.addProperty('publisherId', v1.__get__publisherId, function () {}); v1.addProperty('saveGroups', v1.__get__saveGroups, function () {}); v1.addProperty('scoreBoards', v1.__get__scoreBoards, function () {}); v1.addProperty('sessionId', v1.__get__sessionId, function () {}); v1.addProperty('userId', v1.__get__userId, function () {}); v1.addProperty('username', v1.__get__username, function () {}); ASSetPropFlags(com.newgrounds.API.prototype, null, 1); } #endinitclip } movieClip 757 __Packages.com.newgrounds.encoders.ImageScanner { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.ImageScanner) { var v1 = function (hashLength, charsPerPixel) { if (hashLength) { this._hash = com.newgrounds.encoders.ImageScanner.DEFAULT_HASH.substr(0, hashLength); } this._baseN = new com.newgrounds.encoders.BaseN(this._hash); if (charsPerPixel) { this._charsPerPixel = charsPerPixel; } this.__set__encodeAlpha(false); }; com.newgrounds.encoders.ImageScanner = v1; var v2 = v1.prototype; v2.__get__encodeAlpha = function () { return this._encodeAlpha; }; v2.__set__encodeAlpha = function (v) { this._encodeAlpha = v; this._maxPerChannel = int(Math.pow(this._hash.length, this._charsPerPixel / (this._encodeAlpha ? 4 : 3))); if (this._maxPerChannel > 256) { this._maxPerChannel = 256; } return this.__get__encodeAlpha(); }; v2.encode = function (source, callbackFunction, callbackObject) { var v4 = {'callbackFunction': callbackFunction, 'callbackObject': callbackObject, 'source': source, 'x': 0, 'y': 0, 'output': null}; var v2 = source.width.toString(); var v3 = source.height.toString(); while (v2.length < 3) { v2 = '0' + v2; } while (v3.length < 3) { v3 = '0' + v3; } v4.output = v2 + v3; var v6 = setInterval(this, 'doEncode', com.newgrounds.encoders.ImageScanner.WORK_INTERVAL, v4); v4.interval = v6; }; v2.decode = function (source, callbackFunction, callbackObject) { var v2 = {'callbackFunction': callbackFunction, 'callbackObject': callbackObject, 'source': source, 'i': 6, 'x': 0, 'y': 0, 'output': null}; var v5 = int(source.substr(0, 3)); var v6 = int(source.substr(3, 3)); v2.output = new flash.display.BitmapData(v5, v6, this._encodeAlpha); var v4 = setInterval(this, 'doDecode', com.newgrounds.encoders.ImageScanner.WORK_INTERVAL, v2); v2.interval = v4; }; v2.doEncode = function (state) { var v3 = getTimer(); for (;;) { if (!(state.y < state.source.height && getTimer() - v3 < com.newgrounds.encoders.ImageScanner.WORK_INTERVAL)) break; state.output += this.encodePixel(state.source.getPixel32(state.x, state.y)); ++state.x; if (state.x == state.source.width) { state.x = 0; ++state.y; } } if (state.y == state.source.height) { clearInterval(state.interval); state.callbackFunction.call(state.callbackObject, state.output); } }; v2.doDecode = function (state) { var v4 = getTimer(); for (;;) { if (!(state.y < state.output.height && getTimer() - v4 < com.newgrounds.encoders.ImageScanner.WORK_INTERVAL)) break; var v3 = this.decodePixel(state.source.substr(state.i, this._charsPerPixel)); state.output.setPixel32(state.x, state.y, v3); state.i += this._charsPerPixel; ++state.x; if (state.x == state.output.width) { state.x = 0; ++state.y; } } if (state.y == state.output.height) { clearInterval(state.interval); state.callbackFunction.call(state.callbackObject, state.output); } }; v2.encodePixel = function (pixel) { var v3 = pixel >> 24 & 255; var v4 = pixel >> 16 & 255; var v5 = pixel >> 8 & 255; var v2 = pixel & 255; v3 = int((v3 / 256) * this._maxPerChannel); v4 = int((v4 / 256) * this._maxPerChannel); v5 = int((v5 / 256) * this._maxPerChannel); v2 = int((v2 / 256) * this._maxPerChannel); var v7 = v4 * this._maxPerChannel * this._maxPerChannel + v5 * this._maxPerChannel + v2; if (this._encodeAlpha) { v7 += v3 * this._maxPerChannel * this._maxPerChannel * this._maxPerChannel; } return this._baseN.encodeUint(v7, this._charsPerPixel); }; v2.decodePixel = function (encodedPixel) { var v3 = 255; var v5; var v6; var v4; var v7 = 0; var v2 = this._baseN.decodeUint(encodedPixel); v4 = v2 % this._maxPerChannel; v2 /= int(this._maxPerChannel); v6 = v2 % this._maxPerChannel; v2 /= int(this._maxPerChannel); v5 = v2 % this._maxPerChannel; v2 /= int(this._maxPerChannel); if (this._encodeAlpha) { v3 = v2 % this._maxPerChannel; v2 /= int(this._maxPerChannel); } return v3 << 24 | v5 << 16 | v6 << 8 | v4; }; v1.DEFAULT_HASH = '0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&'; v2._hash = com.newgrounds.encoders.ImageScanner.DEFAULT_HASH; v2._charsPerPixel = 2; v1.WORK_INTERVAL = 33.33333333333334; v2.addProperty('encodeAlpha', v2.__get__encodeAlpha, v2.__set__encodeAlpha); ASSetPropFlags(com.newgrounds.encoders.ImageScanner.prototype, null, 1); } #endinitclip } movieClip 758 __Packages.com.newgrounds.SaveFile { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveFile) { var v1 = function (group) { super(); this._iconLoader = new com.newgrounds.BitmapLoader(com.newgrounds.SaveFile.DEFAULT_ICON, null); this._group = group; this._keys = {}; this._ratings = {}; }; com.newgrounds.SaveFile = v1; com.newgrounds.SaveFile extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v1.__get__currentFile = function () { return com.newgrounds.SaveFile._currentFile; }; v1.fromObject = function (group, fileData) { var v4 = new com.newgrounds.SaveFile(group); v4._name = fileData.filename; v4._description = fileData.description; v4._id = fileData.save_id; v4._authorId = fileData.user_id; v4._authorName = fileData.user_name; v4._createdDate = fileData.created; v4._modifiedDate = fileData.last_update; v4._views = fileData.views; if (fileData.thumb && fileData.thumb != '') { v4._iconLoader.__set__url(com.newgrounds.SaveFile._imageFilePath + fileData.thumb); } v4._dataURL = com.newgrounds.SaveFile._saveFilePath + fileData.file; v4._fileSize = fileData.file_size; v4._approved = fileData.status != com.newgrounds.SaveFile.STATUS_UNAPPROVED; v4._readOnly = false; v4._public = fileData.status != com.newgrounds.SaveFile.STATUS_PRIVATE && fileData.status != com.newgrounds.SaveFile.STATUS_UNAPPROVED; for (var v8 in fileData.keys) { var v6 = fileData.keys[v8]; var v2 = group.getKeyById(v6.id); if (v2) { v4._keys[v2.__get__name()] = v2.validateValue(v6.value); } } for (var v9 in fileData.ratings) { var v5 = fileData.ratings[v9]; var v3 = group.getRatingById(v5.id); if (v3) { v4._ratings[v3.__get__name()] = v3.validateValue(v5.score); } } return v4; }; v2.__get__group = function () { return this._group; }; v2.__get__name = function () { return this._name; }; v2.__set__name = function (val) { this._name = val; return this.__get__name(); }; v2.__get__description = function () { return this._description; }; v2.__set__description = function (val) { this._description = val; return this.__get__description(); }; v2.__get__id = function () { return this._id; }; v2.__get__data = function () { return this._data; }; v2.__set__data = function (val) { this._data = val; return this.__get__data(); }; v2.__get__bytesLoaded = function () { if (this._data) { return this.__get__bytesTotal(); } else { if (!this._dataLoader) { return 0; } else { return this._dataLoader.getBytesLoaded(); } } }; v2.__get__bytesTotal = function () { return this._fileSize; }; v2.__get__readOnly = function () { return this._readOnly; }; v2.__get__draft = function () { return this._draft; }; v2.__set__draft = function (v) { this._draft = v; return this.__get__draft(); }; v2.__get__authorId = function () { return this._authorId; }; v2.__get__authorName = function () { return this._authorName; }; v2.__get__keys = function () { return this._keys; }; v2.__get__ratings = function () { return this._ratings; }; v2.__get__views = function () { return this._views; }; v2.__get__createdDate = function () { return this._createdDate; }; v2.__get__updatedDate = function () { return this._modifiedDate; }; v2.toString = function () { return 'Save File: ' + this._name; }; v2.__get__icon = function () { return this._iconLoader.__get__bitmapData(); }; v2.__set__icon = function (v) { this.createIcon(v); return this.__get__icon(); }; v2.__get__iconLoaded = function () { return this._iconLoader.__get__loaded(); }; v2.createIcon = function (source) { var v9 = new flash.display.BitmapData(com.newgrounds.SaveFile.ICON_WIDTH, com.newgrounds.SaveFile.ICON_HEIGHT, false, 0); var v6; var v5; var v10 = 0; var v8 = 0; if (source instanceof flash.display.BitmapData) { v6 = source.width; v5 = source.height; } else { if (source instanceof MovieClip) { v6 = source._width; v5 = source._height; var v7 = (MovieClip(source)).getBounds(source); v10 = v7.xMin; v8 = v7.yMin; } } var v3 = new flash.geom.Matrix(); var v4; v4 = Math.min(com.newgrounds.SaveFile.ICON_WIDTH / v6, com.newgrounds.SaveFile.ICON_HEIGHT / v5); v3.translate(-v10, -v8); v3.scale(v4, v4); v3.translate((com.newgrounds.SaveFile.ICON_WIDTH - v6 * v4) / 2, (com.newgrounds.SaveFile.ICON_HEIGHT - v5 * v4) / 2); v9.draw(source, v3); this._iconLoader.__set__bitmapData(v9); }; v2.attachIcon = function (parent) { if (this._iconLoader) { return this._iconLoader.attachBitmap(parent); } com.newgrounds.Logger.logError('No icon available for this sumbission.'); return null; }; v2.save = function () { if (!(this._group.__get__connection()).__get__hasUserSession()) { com.newgrounds.Logger.logError('The user must be logged-in to save a file.'); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, null, com.newgrounds.APIEvent.ERROR_NOT_LOGGED_IN)); return undefined; } ++com.newgrounds.BitmapLoader._cacheSeed; com.newgrounds.SaveFile._currentFile = this; if (this.__get__iconLoaded()) { com.newgrounds.SaveFile.ICON_IMAGE_SCANNER.encode(this.__get__icon(), this.onIconEncoded, this); } else { this.encodeData(true); } }; v2.onIconEncoded = function (encodedIcon) { this._encodedIcon = encodedIcon; this.encodeData(true); }; v2.doSave = function () { var v4 = new com.newgrounds.APICommand('saveFile'); (v4.__get__secureParameters()).group = this._group.id; (v4.__get__secureParameters()).user_name = (this._group.__get__connection()).username; (v4.__get__secureParameters()).filename = this._name; (v4.__get__secureParameters()).description = this._description; if (this._draft) { (v4.__get__secureParameters()).draft = true; } if (this._id && !this._readOnly) { (v4.__get__secureParameters()).overwrite = 1; (v4.__get__secureParameters()).save_id = this._id; } var v8 = []; for (var v9 in this._keys) { var v2 = this._group.getKey(v9); if (v2) { v8.push({'id': v2.__get__id(), 'value': v2.validateValue(this._keys[v9])}); } else { com.newgrounds.Logger.logError('No key named "' + v9 + '" in save group "' + this._group.__get__name() + '".'); } } (v4.__get__secureParameters()).keys = v8; var v7 = []; for (var v10 in this._ratings) { var v3 = this._group.getRating(v10); if (v3) { v7.push({'id': v3.__get__id(), 'value': v3.validateValue(this._ratings[v10])}); } else { com.newgrounds.Logger.logError('No rating named "' + v10 + '" in save group "' + this._group.__get__name() + '".'); } } (v4.__get__secureParameters()).ratings = v7; if (typeof this._encodedData == 'string') { v4.addFile('file', this._encodedData, 'file'); } else { v4.addFile('file', com.newgrounds.encoders.json.JSON.encode(this._encodedData), 'file'); } if (this.__get__iconLoaded()) { v4.addFile('thumbnail', this._encodedIcon, 'thumbnail'); } v4.addEventListener(com.newgrounds.APIEvent.COMMAND_COMPLETE, {'target': this, 'func': this.onSaveComplete}); (this._group.__get__connection()).sendCommand(v4); }; v2.encodeData = function (encode) { this._encoderQueue = []; this._encoding = encode; if (encode) { this._encodedData = this._data; this.preEncodeObject(this, '_encodedData'); } else { this.preEncodeObject(this, '_data'); } this.encodeObject(); }; v2.preEncodeObject = function (parent, property) { var v3 = parent[property]; var v5; try { if (this._encoding) { v5 = v3 instanceof flash.display.BitmapData; } else { v5 = v3.type == '__bitmap'; } } var v2 = v3; var v8; if (v5) { this._encoderQueue.push({'parent': parent, 'property': property}); } else { if (typeof v3 == 'object' && !v8) { if (this._encoding) { if (v3 instanceof Array) { v2 = []; } else { v2 = {}; } for (var v4 in v3) { v2[v4] = v3[v4]; } parent[property] = v2; } for (v4 in v2) { this.preEncodeObject(v2, v4); } } } }; v2.encodeObject = function () { if (!this._encoderQueue.length) { if (this._encoding) { this.doSave(); } else { this._dataLoaded = true; this.checkLoadComplete(); } return undefined; } var v6 = this._encoderQueue.pop(); var v4 = v6.parent; var v3 = v6.property; var v2 = v4[v3]; var v5; if (this._encoding) { v5 = {'type': '__bitmap', 'width': v2.width, 'height': v2.height, 'transparent': v2.transparent}; v4[v3] = v5; this._encodingParent = v5; this._encodingProperty = 'data'; com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.__set__encodeAlpha(v2.transparent); com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.encode(flash.display.BitmapData(v2), this.encodeBitmapComplete, this); } else { this._encodingParent = v4; this._encodingProperty = v3; com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.__set__encodeAlpha(v2.transparent); com.newgrounds.SaveFile.DATA_IMAGE_SCANNER.decode(String(v2.data), this.encodeBitmapComplete, this); } }; v2.encodeBitmapComplete = function (data) { this._encodingParent[this._encodingProperty] = data; this.encodeObject(); }; v2.load = function () { com.newgrounds.SaveFile._currentFile = this; this._dataLoaded = false; this._data = null; if (!this.__get__iconLoaded()) { this._iconLoader.addEventListener(com.newgrounds.APIEvent.ICON_LOADED, {'target': this, 'func': this.onIconLoaded}); this._iconLoader.load(); } this._dataLoader = new LoadVars(); var file = this; this._dataLoader.onData = function (data) { file.onDataLoaded(data); }; this._dataLoader.load(this._dataURL); }; v2.onIconLoaded = function (event) { if (!event.__get__success() && this._iconLoader.__get__url()) { com.newgrounds.Logger.logWarning('Unable to load the icon for this save file.'); } this._iconLoader.removeEventListener(com.newgrounds.APIEvent.ICON_LOADED, this.onIconLoaded); this.checkLoadComplete(); }; v2.checkLoadComplete = function () { if (this._dataLoaded && this.__get__iconLoaded()) { com.newgrounds.Logger.logMessage('Data loaded.'); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this)); } }; v2.onDataLoaded = function (data) { try { if (data) { if (data.charAt(0) == '{') { this._data = com.newgrounds.encoders.json.JSON.decode(String(data)); } else { this._data = String(data); } this.encodeData(false); } } catch (v0) { if (Error(v0) != null) { var error = Error(v0); com.newgrounds.Logger.logError('Error while loading data:', error); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE)); } else { throw v0; } } }; v2.onDataError = function (error) { com.newgrounds.Logger.logError('Unable to load data:', error); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_LOADED, this, com.newgrounds.APIEvent.ERROR_BAD_FILE)); }; v2.onSaveComplete = function (event) { if (event.__get__success()) { com.newgrounds.Logger.logMessage('File "' + this._name + '" saved!'); if (event.__get__data()) { this._id = (event.__get__data()).save_id; this._dataURL = unescape((event.__get__data()).file_url); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this)); } else { com.newgrounds.Logger.logError('Error saving file "' + this._name + '":', event.__get__error()); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.FILE_SAVED, this, event.__get__error())); } }; v2.sendVote = function (ratingName, vote) { var v2 = this._group.getRating(ratingName); if (!v2) { com.newgrounds.Logger.logError('No save rating named "' + ratingName + '" exists for this save group.'); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT)); return undefined; } vote = v2.validateValue(vote); if (isNaN(vote)) { com.newgrounds.Logger.logError('Invalid vote (' + vote + '). ' + ratingName + ' allows a range of ' + v2.__get__minimum() + '-' + v2.__get__maximum() + '.'); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, {}, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT)); return undefined; } com.newgrounds.Logger.logMessage('Voting ' + vote + ' for ' + ratingName + ' on ' + this._name + '...'); (this._group.__get__connection()).sendSimpleCommand('rateSaveFile', {'target': this, 'func': this.onVoteComplete}, null, {'group': this._group.__get__id(), 'save_id': this._id, 'rating_id': v2.__get__id(), 'vote': vote}); }; v2.onVoteComplete = function (event) { var v2 = event.__get__error(); if ((event.__get__data()).already_voted) { com.newgrounds.Logger.logError('Vote failed. You\'ve already voted on this rating today.'); v2 = com.newgrounds.APIEvent.ERROR_ALREADY_VOTED; } if (v2 == com.newgrounds.APIEvent.ERROR_NONE) { var v3 = this._group.getRatingById((event.__get__data()).rating_id); if (v3) { this._ratings[v3.__get__name()] = v3.validateValue((event.__get__data()).score); } com.newgrounds.Logger.logMessage('Vote complete!'); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.VOTE_COMPLETE, this, v2)); }; v2.clone = function () { var v3 = new com.newgrounds.SaveFile(this._group); v3._data = this._data; v3._description = this._description; v3._draft = this._draft; v3._fileSize = this._fileSize; v3._iconLoader.__set__bitmapData(this._iconLoader.bitmapData); var v2; for (v2 in this._keys) { v3._keys[v2] = this._keys[v2]; } for (v2 in this._ratings) { v3._ratings[v2] = this._ratings[v2]; } v3._name = this._name; return v3; }; v1.ICON_WIDTH = 90; v1.ICON_HEIGHT = 90; v1.DEFAULT_ICON = flash.display.BitmapData.loadBitmap('DefaultSaveIcon'); v1.STATUS_PRIVATE = 0; v1.STATUS_SHARED = 1; v1.STATUS_UNAPPROVED = 2; v1.STATUS_APPROVED = 3; v1._imageFilePath = ''; v1._saveFilePath = ''; v1.ICON_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner(); v1.DATA_IMAGE_SCANNER = new com.newgrounds.encoders.ImageScanner(64, 6); v2.addProperty('authorId', v2.__get__authorId, function () {}); v2.addProperty('authorName', v2.__get__authorName, function () {}); v2.addProperty('bytesLoaded', v2.__get__bytesLoaded, function () {}); v2.addProperty('bytesTotal', v2.__get__bytesTotal, function () {}); v2.addProperty('createdDate', v2.__get__createdDate, function () {}); v1.addProperty('currentFile', v1.__get__currentFile, function () {}); v2.addProperty('data', v2.__get__data, v2.__set__data); v2.addProperty('description', v2.__get__description, v2.__set__description); v2.addProperty('draft', v2.__get__draft, v2.__set__draft); v2.addProperty('group', v2.__get__group, function () {}); v2.addProperty('icon', v2.__get__icon, v2.__set__icon); v2.addProperty('iconLoaded', v2.__get__iconLoaded, function () {}); v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('keys', v2.__get__keys, function () {}); v2.addProperty('name', v2.__get__name, v2.__set__name); v2.addProperty('ratings', v2.__get__ratings, function () {}); v2.addProperty('readOnly', v2.__get__readOnly, function () {}); v2.addProperty('updatedDate', v2.__get__updatedDate, function () {}); v2.addProperty('views', v2.__get__views, function () {}); ASSetPropFlags(com.newgrounds.SaveFile.prototype, null, 1); } #endinitclip } movieClip 756 __Packages.com.newgrounds.SaveGroup { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveGroup) { var v1 = function (connection, name, id, type, keys, ratings) { this._connection = connection; this._id = id; this._name = name; this._type = type; this._keysArray = keys; this._ratingsArray = ratings; this._keys = new Object(); this._ratings = new Object(); var v11; for (var v7 in keys) { var v2 = keys[v7]; this._keys[v2.__get__name()] = v2; } for (var v6 in ratings) { var v3 = ratings[v6]; this._ratings[v3.__get__name()] = v3; } }; com.newgrounds.SaveGroup = v1; var v2 = v1.prototype; v2.__get__connection = function () { return this._connection; }; v2.__get__name = function () { return this._name; }; v2.__get__type = function () { return this._type; }; v2.__get__id = function () { return this._id; }; v2.__get__keys = function () { return this._keysArray; }; v2.__get__ratings = function () { return this._ratingsArray; }; v2.getKey = function (name) { return this._keys[name]; }; v2.getRating = function (name) { return this._ratings[name]; }; v2.getKeyById = function (id) { for (var v4 in this._keys) { var v2 = this._keys[v4]; if (v2.__get__id() == id) { return v2; } } return null; }; v2.getRatingById = function (id) { for (var v4 in this._ratings) { var v2 = this._ratings[v4]; if (v2.__get__id() == id) { return v2; } } return null; }; v2.toString = function () { return 'SaveGroup: ' + this.__get__name() + ' Keys: ' + this._keysArray + ' Ratings: ' + this._ratingsArray; }; v1.TYPE_SYSTEM = 0; v1.TYPE_PRIVATE = 1; v1.TYPE_PUBLIC = 2; v1.TYPE_MODERATED = 3; v2.addProperty('connection', v2.__get__connection, function () {}); v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('keys', v2.__get__keys, function () {}); v2.addProperty('name', v2.__get__name, function () {}); v2.addProperty('ratings', v2.__get__ratings, function () {}); v2.addProperty('type', v2.__get__type, function () {}); ASSetPropFlags(com.newgrounds.SaveGroup.prototype, null, 1); } #endinitclip } movieClip 754 __Packages.com.newgrounds.SaveKey { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveKey) { var v1 = function (name, id, type) { this._name = name; this._id = id; this._type = type; }; com.newgrounds.SaveKey = v1; var v2 = v1.prototype; v2.__get__name = function () { return this._name; }; v2.__get__id = function () { return this._id; }; v2.__get__type = function () { return this._type; }; v2.validateValue = function (value) { switch (this._type) { return null; case com.newgrounds.SaveKey.TYPE_INTEGER: value = Number(value); if (!isNaN(value)) { var v3 = int(value); if (v3 != value) { com.newgrounds.Logger.logWarning('Float value ' + value + ' given for integer key "' + this._name + '". Clamping to ' + v3 + '.'); } return v3; } return null; case com.newgrounds.SaveKey.TYPE_FLOAT: value = Number(value); if (!isNaN(value)) { return isNaN(Number(value)); } return null; case com.newgrounds.SaveKey.TYPE_BOOLEAN: return Boolean(value); return null; case com.newgrounds.SaveKey.TYPE_STRING: return value ? value.toString() : ''; return null; } return null; }; v2.toString = function () { return this._name; }; v1.TYPE_FLOAT = 1; v1.TYPE_INTEGER = 2; v1.TYPE_STRING = 3; v1.TYPE_BOOLEAN = 4; v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('name', v2.__get__name, function () {}); v2.addProperty('type', v2.__get__type, function () {}); ASSetPropFlags(com.newgrounds.SaveKey.prototype, null, 1); } #endinitclip } movieClip 755 __Packages.com.newgrounds.SaveRating { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveRating) { var v1 = function (name, id, isFloat, minimum, maximum) { this._name = name; this._id = id; this._isFloat = isFloat; this._minimum = minimum; this._maximum = maximum; }; com.newgrounds.SaveRating = v1; var v2 = v1.prototype; v2.__get__name = function () { return this._name; }; v2.__get__id = function () { return this._id; }; v2.__get__isFloat = function () { return this._isFloat; }; v2.__get__minimum = function () { return this._minimum; }; v2.__get__maximum = function () { return this._maximum; }; v2.validateValue = function (value) { var v2 = Number(value); if (isNaN(v2)) { com.newgrounds.Logger.logError('Invalid value for rating "' + this._name + '".'); return NaN; } if (v2 < this._minimum) { com.newgrounds.Logger.logWarning(v2 + ' is out of acceptable range for rating "' + this._name + '". Clamping to ' + this._minimum + '.'); return this._minimum; } if (v2 > this._maximum) { com.newgrounds.Logger.logWarning(v2 + ' is out of acceptable range for rating "' + this._name + '". Clamping to ' + this._maximum + '.'); return this._maximum; } if (!this.__get__isFloat()) { var v3 = int(v2); if (v3 != v2) { com.newgrounds.Logger.logWarning('Float value ' + v2 + ' given for integer rating "' + this._name + '". Clamping to ' + v3 + '.'); } return v3; } return v2; }; v2.toString = function () { return this._name; }; v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('isFloat', v2.__get__isFloat, function () {}); v2.addProperty('maximum', v2.__get__maximum, function () {}); v2.addProperty('minimum', v2.__get__minimum, function () {}); v2.addProperty('name', v2.__get__name, function () {}); ASSetPropFlags(com.newgrounds.SaveRating.prototype, null, 1); } #endinitclip } movieClip 750 __Packages.com.newgrounds.BitmapLoader { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.BitmapLoader) { var v1 = function (defaultBitmap, url) { super(); this._bitmapData = defaultBitmap; this._url = url; }; com.newgrounds.BitmapLoader = v1; com.newgrounds.BitmapLoader extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v2.__get__url = function () { return this._url; }; v2.__set__url = function (v) { this._loaded = false; this._url = v; return this.__get__url(); }; v2.__get__bitmapData = function () { return this._bitmapData; }; v2.__set__bitmapData = function (v) { this._bitmapData = v; this._loaded = true; return this.__get__bitmapData(); }; v2.__get__loaded = function () { return this._loaded; }; v2.disposeLoader = function () { if (this._loader) { if (this._loaderClip._parent == _root) { this._loader.unloadClip(this._loaderClip.bitmap); this._loaderClip.removeMovieClip(); } this._loader = null; this._loaderClip = null; } }; v2.load = function () { if (!this._url || this._url == '') { this.onLoadComplete(); return undefined; } this._loaded = false; if (this._bitmapData) { this._bitmapData.dispose(); this._bitmapData = null; } this.disposeLoader(); this.attachBitmap(null); }; v2.attachBitmap = function (parent) { if (!parent) { parent = _root; } var v5 = parent.getNextHighestDepth(); var v3 = parent.createEmptyMovieClip('__bitmap' + v5, v5); if (!this._loaded && this._url && this._url != '') { v3.createEmptyMovieClip('bitmap', 0); this._loader = new MovieClipLoader(); this._loaderClip = v3; if (parent == _root) { this._loaderClip._visible = false; } var thisObj = this; this._loaderClip.onEnterFrame = function () { thisObj.pollLoad(); }; this._loader.addListener({'onLoadError': function () { thisObj.onLoadComplete(); }}); this._loader.loadClip(this._url, v3.bitmap); return v3; } v3.attachBitmap(this._bitmapData, 0); return v3; }; v2.pollLoad = function () { if (this._loaderClip._width) { this.onLoadComplete(); } }; v2.onLoadComplete = function () { var v2; if (this._loader && this._loaderClip && this._loaderClip._width) { try { this._loaderClip.onEnterFrame = null; v2 = new flash.display.BitmapData(this._loaderClip._width, this._loaderClip._height, true, 0); v2.draw(this._loaderClip); this._bitmapData = v2; this._loaded = true; } catch (error) { if (v2) { v2.dispose(); } } } this.disposeLoader(); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.ICON_LOADED, this, this._loaded ? null : com.newgrounds.APIEvent.ERROR_BAD_FILE)); }; v1._cacheSeed = 0; v2._loaded = true; v2.addProperty('bitmapData', v2.__get__bitmapData, v2.__set__bitmapData); v2.addProperty('loaded', v2.__get__loaded, function () {}); v2.addProperty('url', v2.__get__url, v2.__set__url); ASSetPropFlags(com.newgrounds.BitmapLoader.prototype, null, 1); } #endinitclip } movieClip 759 __Packages.com.newgrounds.SaveQuery { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveQuery) { var v1 = function (group) { super(); this._group = group; this._connection = group.connection; this.reset(); }; com.newgrounds.SaveQuery = v1; com.newgrounds.SaveQuery extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v2.__get__group = function () { return this._group; }; v2.__get__resultsPerPage = function () { return this._resultsPerPage; }; v2.__set__resultsPerPage = function (val) { this._resultsPerPage = Math.min(Math.max(val, 1), 100); return this.__get__resultsPerPage(); }; v2.__get__page = function () { return this._page; }; v2.__set__page = function (val) { this._page = Math.max(val, 1); return this.__get__page(); }; v2.prevPage = function () { this.__set__page(this.__get__page() - 1); }; v2.nextPage = function () { this.__set__page(this.__get__page() + 1); }; v2.__get__isRandomized = function () { return this._isRandomized; }; v2.__set__isRandomized = function (val) { this._isRandomized = val; return this.__get__isRandomized(); }; v2.__get__files = function () { return this._files; }; v2.reset = function () { this._page = 1; this._resultsPerPage = 10; this._isRandomized = false; this._lookupKeys = []; this._lookupRatings = []; this._fileConditions = []; this._keyConditions = []; this._ratingConditions = []; this._sortFields = []; this._files = []; this.includeAllFields(); }; v2.clone = function () { var v2 = new com.newgrounds.SaveQuery(this._group); v2._page = this._page; v2._resultsPerPage = this._resultsPerPage; v2._isRandomized = this._isRandomized; v2._lookupKeys = this._lookupKeys.concat(); v2._lookupRatings = this._lookupRatings.concat(); v2._fileConditions = this._fileConditions.concat(); v2._keyConditions = this._keyConditions.concat(); v2._ratingConditions = this._ratingConditions.concat(); return v2; }; v2.includeAllFields = function () { for (var v5 in this._group.__get__keys()) { var v2 = (this._group.__get__keys())[v5]; this._lookupKeys.push(v2.__get__id()); } for (var v4 in this._group.__get__ratings()) { var v3 = (this._group.__get__ratings())[v4]; this._lookupRatings.push(v3.__get__id()); } }; v2.addCondition = function (field, operator, value) { var v2; v2 = 0; while (v2 < com.newgrounds.SaveQuery.FILE_FIELDS.length) { if (com.newgrounds.SaveQuery.FILE_FIELDS[v2] == field) { break; } ++v2; } if (v2 == com.newgrounds.SaveQuery.FILE_FIELDS.length) { v2 = -1; } if (v2 >= 0) { this._fileConditions.push({'field': v2, 'operator': operator, 'value': value}); } else { var v3 = this._group.getKey(field); if (v3) { value = v3.validateValue(value); this._keyConditions.push({'key_id': v3.__get__id(), 'operator': operator, 'value': value}); return undefined; } var v4 = field.split('.'); var v6 = this._group.getRating(v4[0]); if (v6) { value = v6.validateValue(value); this._ratingConditions.push({'rating_id': v6.__get__id(), 'operator': operator, 'value': value, 'column': v4[1] ? v4[1] : 'score'}); return undefined; } com.newgrounds.Logger.logError('The save group "' + this._group.__get__name() + '" does not have a field named "' + field + '".'); } }; v2.sortOn = function (field, sortDescending) { if (sortDescending == undefined) { sortDescending = false; } var v2; v2 = 0; while (v2 < com.newgrounds.SaveQuery.FILE_FIELDS.length) { if (com.newgrounds.SaveQuery.FILE_FIELDS[v2] == field) { break; } ++v2; } if (v2 == com.newgrounds.SaveQuery.FILE_FIELDS.length) { v2 = -1; } if (v2 >= 0) { this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_FILES, 'field': v2, 'desc': sortDescending}); } else { var v5 = this._group.getKey(field); if (v5) { this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_KEYS, 'field': v5.__get__id(), 'desc': sortDescending}); return undefined; } var v3 = field.split('.'); var v6 = this._group.getRating(v3[0]); if (v6) { this._sortFields.push({'table': com.newgrounds.SaveQuery.TABLE_RATINGS, 'field': v6.__get__id(), 'desc': sortDescending, 'extra': v3[1] ? v3[1] : 'score'}); return undefined; } com.newgrounds.Logger.logError('The save group "' + this._group.__get__name() + '" does not have a field named "' + field + '".'); } }; v2.execute = function () { var v5 = {}; v5.page = this._page; v5.num_results = this._resultsPerPage; if (this._isRandomized) { v5.randomize = 1; } if (this._lookupKeys && this._lookupKeys.length) { v5.lookup_keys = this._lookupKeys; } if (this._lookupRatings && this._lookupRatings.length) { v5.lookup_ratings = this._lookupRatings; } if (this._fileConditions && this._fileConditions.length) { v5.file_conditions = this._fileConditions; } if (this._keyConditions && this._keyConditions.length) { v5.key_conditions = this._keyConditions; } if (this._ratingConditions && this._ratingConditions.length) { v5.rating_conditions = this._ratingConditions; } if (this._sortFields && this._sortFields.length) { v5.sort_conditions = this._sortFields; } this._connection.sendSimpleCommand('lookupSaveFiles', {'target': this, 'func': this.onQueryComplete}, {'publisher_id': this._connection.publisherId, 'group_id': this._group.__get__id(), 'query': v5}); }; v2.onQueryComplete = function (event) { if (event.__get__success()) { var v4 = event.__get__data(); this._files = []; if (v4.files) { var v2 = 0; while (v2 < v4.files.length) { var v3 = com.newgrounds.SaveFile.fromObject(this._group, v4.files[v2]); if (v3) { this._files.push(v3); } ++v2; } } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this)); } else { com.newgrounds.Logger.logError('Query failed: ' + event.__get__error()); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.QUERY_COMPLETE, this, event.__get__error())); } }; v1.FILE_ID = 'fileId'; v1.AUTHOR_ID = 'authorId'; v1.AUTHOR_NAME = 'authorName'; v1.FILE_NAME = 'fileName'; v1.CREATED_ON = 'createdOn'; v1.UPDATED_ON = 'updatedOn'; v1.FILE_VIEWS = 'fileViews'; v1.FILE_STATUS = 'fileStatus'; v1.FILE_FIELDS = [com.newgrounds.SaveQuery.FILE_ID, com.newgrounds.SaveQuery.AUTHOR_ID, com.newgrounds.SaveQuery.AUTHOR_NAME, com.newgrounds.SaveQuery.FILE_NAME, com.newgrounds.SaveQuery.CREATED_ON, com.newgrounds.SaveQuery.UPDATED_ON, com.newgrounds.SaveQuery.FILE_VIEWS, com.newgrounds.SaveQuery.FILE_STATUS]; v1.OPERATOR_EQUAL = '='; v1.OPERATOR_LESS_THAN = '<'; v1.OPERATOR_GREATER_THAN = '>'; v1.OPERATOR_NOT_EQUAL = '!='; v1.OPERATOR_LESS_OR_EQUAL = '<='; v1.OPERATOR_GREATER_OR_EQUAL = '>='; v1.OPERATOR_CONTAINS = '*'; v1.OPERATOR_NOT_CONTAINS = '!*'; v1.OPERATOR_NOT_BEGINS_WITH = '!*='; v1.OPERATOR_NOT_ENDS_WITH = '!=*'; v1.OPERATOR_BEGINS_WITH = '*='; v1.OPERATOR_ENDS_WITH = '=*'; v1.TABLE_FILES = 1; v1.TABLE_KEYS = 2; v1.TABLE_RATINGS = 3; v2._page = 1; v2._resultsPerPage = 10; v2._isRandomized = false; v2.addProperty('files', v2.__get__files, function () {}); v2.addProperty('group', v2.__get__group, function () {}); v2.addProperty('isRandomized', v2.__get__isRandomized, v2.__set__isRandomized); v2.addProperty('page', v2.__get__page, v2.__set__page); v2.addProperty('resultsPerPage', v2.__get__resultsPerPage, v2.__set__resultsPerPage); ASSetPropFlags(com.newgrounds.SaveQuery.prototype, null, 1); } #endinitclip } movieClip 751 __Packages.com.newgrounds.Medal { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Medal) { var v1 = function (connection, id, name, description, secret, unlocked, value, difficultyId, iconURL) { super(); this._connection = connection; this._id = id; this._name = name; this._description = description; this._secret = secret; this._unlocked = unlocked; this._value = value; this._difficulty = com.newgrounds.Medal.DIFFICULTIES[difficultyId]; this._iconLoader = new com.newgrounds.BitmapLoader(com.newgrounds.Medal.DEFAULT_ICON, iconURL); this._iconLoader.load(); }; com.newgrounds.Medal = v1; com.newgrounds.Medal extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v2.__get__difficulty = function () { return this._difficulty; }; v2.__get__icon = function () { return this._iconLoader.__get__bitmapData(); }; v2.__get__id = function () { return this._id; }; v2.__get__name = function () { return this._name; }; v2.__get__description = function () { return this._description; }; v2.__get__secret = function () { return this._secret; }; v2.__get__unlocked = function () { return this._unlocked; }; v2.__get__value = function () { return this._value; }; v2.toString = function () { if (!this._unlocked) { return 'Medal: ' + this._name + '\t\t(' + 'locked, ' + this._value + 'pts, ' + this._difficulty + ')'; } return 'Medal: ' + this._name + '\t\t(' + 'unlocked, ' + this._value + 'pts, ' + this._difficulty + ')'; }; v2.attachIcon = function (parent) { return this._iconLoader.attachBitmap(parent); }; v2.unlock = function () { if (this._unlocked) { com.newgrounds.Logger.logWarning('Medal "' + this._name + '" is already unlocked.'); return undefined; } com.newgrounds.Logger.logMessage('Unlocking medal "' + this.__get__name() + '"...'); this._unlocked = true; if (this._connection.__get__hasUserSession()) { this._connection.sendSimpleCommand('unlockMedal', {'target': this, 'func': this.onUnlockConfirmed}, null, {'medal_id': this.__get__id()}); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCKED, this)); }; v2.setUnlocked = function (unlocked) { this._unlocked = unlocked; }; v2.onUnlockConfirmed = function (event) { if (event.__get__success()) { com.newgrounds.Logger.logMessage('Medal "' + this.__get__name() + '" unlocked.'); } else { com.newgrounds.Logger.logError('Failed to unlock "' + this.__get__name() + '"!'); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.MEDAL_UNLOCK_CONFIRMED, this, event.__get__error())); }; v1.ICON_WIDTH = 50; v1.ICON_HEIGHT = 50; v1.DEFAULT_ICON = flash.display.BitmapData.loadBitmap('DefaultMedalIcon'); v1.DIFFICULTY_EASY = 'Easy'; v1.DIFFICULTY_MODERATE = 'Moderate'; v1.DIFFICULTY_CHALLENGING = 'Challenging'; v1.DIFFICULTY_DIFFICULT = 'Difficult'; v1.DIFFICULTY_BRUTAL = 'Brutal'; v1.DIFFICULTIES = ['Unknown', com.newgrounds.Medal.DIFFICULTY_EASY, com.newgrounds.Medal.DIFFICULTY_MODERATE, com.newgrounds.Medal.DIFFICULTY_CHALLENGING, com.newgrounds.Medal.DIFFICULTY_DIFFICULT, com.newgrounds.Medal.DIFFICULTY_BRUTAL]; v2.addProperty('description', v2.__get__description, function () {}); v2.addProperty('difficulty', v2.__get__difficulty, function () {}); v2.addProperty('icon', v2.__get__icon, function () {}); v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('name', v2.__get__name, function () {}); v2.addProperty('secret', v2.__get__secret, function () {}); v2.addProperty('unlocked', v2.__get__unlocked, function () {}); v2.addProperty('value', v2.__get__value, function () {}); ASSetPropFlags(com.newgrounds.Medal.prototype, null, 1); } #endinitclip } movieClip 753 __Packages.com.newgrounds.ScoreBoard { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.ScoreBoard) { var v1 = function (connection, name, id) { super(); this._connection = connection; this._name = name; this._id = id; }; com.newgrounds.ScoreBoard = v1; com.newgrounds.ScoreBoard extends com.newgrounds.APIEventDispatcher; var v2 = v1.prototype; v2.__get__name = function () { return this._name; }; v2.__get__scores = function () { return this._scores; }; v2.__get__period = function () { return this._period; }; v2.__set__period = function (val) { this._period = val; return this.__get__period(); }; v2.__get__firstResult = function () { return this._firstResult; }; v2.__set__firstResult = function (val) { this._firstResult = Math.max(1, val); return this.__get__firstResult(); }; v2.__get__numResults = function () { return this._numResults; }; v2.__set__numResults = function (val) { this._numResults = val; return this.__get__numResults(); }; v2.__get__tag = function () { return this._tag; }; v2.__set__tag = function (val) { this._tag = val; return this.__get__tag(); }; v2.__get__page = function () { return Math.ceil((this._firstResult - 1) / this._numResults) + 1; }; v2.prevPage = function () { if (this.__get__firstResult() > this._numResults) { this.firstResult -= this._numResults; } }; v2.nextPage = function () { this.firstResult += this._numResults; }; v2.loadScores = function () { this._connection.sendSimpleCommand('loadScores', {'target': this, 'func': this.onScoresLoaded}, {'publisher_id': this._connection.publisherId, 'board': this._id, 'page': (this._firstResult - 1) / this._numResults + 1, 'num_results': this._numResults, 'period': this._period, 'tag': this._tag}); }; v2.postScore = function (numericScore, tag) { if (tag == undefined) { tag = null; } if (isNaN(numericScore)) { com.newgrounds.Logger.logError('Cannot post invalid score: ' + numericScore); this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, null, com.newgrounds.APIEvent.ERROR_INVALID_ARGUMENT)); return undefined; } com.newgrounds.Logger.logMessage('Posting a score of ' + numericScore + ' by ' + this._connection.username + ' to scoreboard "' + this._name + '"...'); this._connection.sendSimpleCommand('postScore', {'target': this, 'func': this.onScorePosted}, null, {'user_name': this._connection.username, 'board': this._id, 'value': numericScore, 'tag': tag}); }; v2.onScoresLoaded = function (event) { var v4 = event.__get__data(); this._scores = []; var v5; if (v4.first_result) { v5 = v4.first_result; } else { v5 = this._firstResult; } if (v4.scores) { var v3 = 0; while (v3 < v4.scores.length) { var v2 = v4.scores[v3]; if (v2) { this._scores[v3] = new com.newgrounds.Score(v5, v2.username, v2.value, v2.numeric_value, v2.tag); } v3++; v5++; } } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORES_LOADED, this)); }; v2.onScorePosted = function (event) { if (event.__get__success()) { com.newgrounds.Logger.logMessage('Score posted!'); var v4 = event.__get__data(); var v2 = {}; v2.score = v4.value; v2.scoreBoard = this; } else { com.newgrounds.Logger.logError('Error posting score: ' + event.__get__error()); } this.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.SCORE_POSTED, storedv2, event.__get__error())); }; v2.toString = function () { return 'Scoreboard: ' + this._name; }; v1.TODAY = 'Today'; v1.THIS_WEEK = 'This Week'; v1.THIS_MONTH = 'This Month'; v1.THIS_YEAR = 'This Year'; v1.ALL_TIME = 'All-Time'; v2._period = com.newgrounds.ScoreBoard.ALL_TIME; v2._firstResult = 1; v2._numResults = 10; v2.addProperty('firstResult', v2.__get__firstResult, v2.__set__firstResult); v2.addProperty('name', v2.__get__name, function () {}); v2.addProperty('numResults', v2.__get__numResults, v2.__set__numResults); v2.addProperty('page', v2.__get__page, function () {}); v2.addProperty('period', v2.__get__period, v2.__set__period); v2.addProperty('scores', v2.__get__scores, function () {}); v2.addProperty('tag', v2.__get__tag, v2.__set__tag); ASSetPropFlags(com.newgrounds.ScoreBoard.prototype, null, 1); } #endinitclip } movieClip 742 __Packages.com.newgrounds.Logger { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Logger) { var v1 = function () {}; com.newgrounds.Logger = v1; var v2 = v1.prototype; v1.logInternal = function () { var v2 = arguments; com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_INTERNAL, v2); }; v1.logMessage = function () { var v2 = arguments; com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_MESSAGE, v2); }; v1.logWarning = function () { var v2 = arguments; com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_WARNING, v2); }; v1.logError = function () { var v2 = arguments; com.newgrounds.Logger.log(com.newgrounds.Logger.PRIORITY_ERROR, v2); }; v1.log = function (priority, messages) { if (priority == undefined) { priority = com.newgrounds.Logger.PRIORITY_MESSAGE; } if (messages == undefined) { messages = null; } if (priority >= com.newgrounds.Logger._messageLevel) { var v1 = 0; while (v1 < messages.length) { trace(com.newgrounds.Logger.HEADER + messages[v1]); com.newgrounds.Logger._eventDispatcher.dispatchEvent(new com.newgrounds.APIEvent(com.newgrounds.APIEvent.LOG, messages[v1])); ++v1; } } if (priority >= com.newgrounds.Logger._throwLevel) { throw new Error(messages.join('\n')); } }; v1.addEventListener = function (event, listener) { com.newgrounds.Logger._eventDispatcher.addEventListener(event, listener, false, 0, false); }; v1.PRIORITY_INTERNAL = 0; v1.PRIORITY_MESSAGE = 1; v1.PRIORITY_WARNING = 2; v1.PRIORITY_ERROR = 3; v1.PRIORITY_MAX = 4; v1.HEADER = '[Newgrounds API] :: '; v1._eventDispatcher = new com.newgrounds.EventDispatcher(); v1._messageLevel = com.newgrounds.Logger.PRIORITY_MESSAGE; v1._throwLevel = com.newgrounds.Logger.PRIORITY_MAX; ASSetPropFlags(com.newgrounds.Logger.prototype, null, 1); } #endinitclip } movieClip 761 __Packages.com.newgrounds.components.FlashAdBase { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.components) { _global.com.newgrounds.components = new Object(); } if (!_global.com.newgrounds.components.FlashAdBase) { var v1 = function () { super(); try { System.security.allowDomain('server.cpmstar.com'); System.security.allowInsecureDomain('server.cpmstar.com'); } this._x = int(this._x); this._y = int(this._y); this.stop(); if (this.__get___newgroundsButton()) { (this.__get___newgroundsButton()).onRelease = this.onNGClick; } this.onUnload = this.removeAd; var v4 = this; this._adListener = {'onLoadError': function (target, error, httpStatus) { target._parent.onAdError(target, error, httpStatus); }}; if (this.__get__fullScreen()) { this.drawFullScreenRect(); } if (com.newgrounds.API.__get__adFeedURL()) { this.loadAdFeed(); } else { com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.API_CONNECTED, {'target': this, 'func': this.loadAdFeed}); } }; com.newgrounds.components.FlashAdBase = v1; com.newgrounds.components.FlashAdBase extends MovieClip; var v2 = v1.prototype; v2.__get___adContainer = function () { return this.adContainer; }; v2.__get___newgroundsButton = function () { return this.newgroundsButton; }; v2.__get__fullScreen = function () { return this._fullScreen; }; v2.__set__fullScreen = function (v) { this._fullScreen = v; if (v) { this.drawFullScreenRect(); } else { this.clear(); } return this.__get__fullScreen(); }; v2.__get__showBorder = function () { return this._showBorder; }; v2.__set__showBorder = function (value) { this._showBorder = value; if (this._showBorder) { if (this._ad) { var v2 = this._ad.getProgress(this.__get___adContainer()); if (v2.bytesLoaded >= v2.bytesTotal) { if (this.showPlayButton) { this.gotoAndStop('loadedPlay'); } else { this.gotoAndStop('loaded'); } } else { this.gotoAndStop('loading'); } } else { this.gotoAndStop('idle'); } } else { this.gotoAndStop('noBorder'); } return this.__get__showBorder(); }; v2.loadAdFeed = function (event) { if (event == undefined) { event = null; } this._adFeedLoader = new LoadVars(); var target = this; this._adFeedLoader.onData = function (data) { target.onAdFeedLoaded(data); }; this._adFeedLoader.load(com.newgrounds.API.__get__adFeedURL(), this._adFeedLoader); }; v2.onAdFeedLoaded = function (data) { if (data && data != '') { this.loadAd(data); } else { this.onAdError(); } }; v2.loadAd = function (adURL) { if (this.showPlayButton) { this.gotoAndStop('loadedPlay'); } if (this.adType != this.VIDEO_ADS) { if (adURL.indexOf('?') >= 0) { adURL += '&'; } else { adURL += '?'; } adURL += 'blockoverlays=1'; } this._ad = new MovieClipLoader(); this._ad.addListener(this._adListener); (this.__get___adContainer())._lockroot = true; this._ad.loadClip(adURL, this.__get___adContainer()); }; v2.removeAd = function () { this._adFeedLoader.onData = null; this._adFeedLoader = null; this._ad.removeListener(this._adListener); if (this.__get___adContainer()) { this._ad.unloadClip(this.__get___adContainer()); } this._ad = null; }; v2.onAdError = function (target, error, httpStatus) { com.newgrounds.Logger.logError('Unable to load ad.'); this.removeAd(); }; v2.onNGClick = function () { com.newgrounds.API.loadNewgrounds(); }; v2.drawFullScreenRect = function () { this._x = (Stage.width - this._width) / 2; this._y = (Stage.height - this._height) / 2; this.beginFill(0); this.moveTo(-Stage.width, -Stage.height); this.lineTo(Stage.width, -Stage.height); this.lineTo(Stage.width, Stage.height); this.lineTo(-Stage.width, Stage.height); this.lineTo(-Stage.width, -Stage.height); this.endFill(); }; v2._showBorder = true; v2.adType = com.newgrounds.components.FlashAdBase.prototype.VIDEO_ADS; v2.VIDEO_ADS = 'Video'; v2.SIMPLE_ADS = 'Simple'; v2.addProperty('_adContainer', v2.__get___adContainer, function () {}); v2.addProperty('_newgroundsButton', v2.__get___newgroundsButton, function () {}); v2.addProperty('fullScreen', v2.__get__fullScreen, v2.__set__fullScreen); v2.addProperty('showBorder', v2.__get__showBorder, v2.__set__showBorder); ASSetPropFlags(com.newgrounds.components.FlashAdBase.prototype, null, 1); } #endinitclip } movieClip 736 __Packages.com.newgrounds.shims.APIShim { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.shims) { _global.com.newgrounds.shims = new Object(); } if (!_global.com.newgrounds.shims.APIShim) { var v1 = function () { super(); }; com.newgrounds.shims.APIShim = v1; com.newgrounds.shims.APIShim extends MovieClip; var v2 = v1.prototype; ASSetPropFlags(com.newgrounds.shims.APIShim.prototype, null, 1); } #endinitclip } movieClip 746 __Packages.com.newgrounds.crypto.MD5 { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.crypto) { _global.com.newgrounds.crypto = new Object(); } if (!_global.com.newgrounds.crypto.MD5) { var v1 = function () {}; com.newgrounds.crypto.MD5 = v1; var v2 = v1.prototype; v1.hash = function (src) { return com.newgrounds.crypto.MD5.hex_md5(src); }; v1.hex_md5 = function (src) { return com.newgrounds.crypto.MD5.binl2hex(com.newgrounds.crypto.MD5.core_md5(com.newgrounds.crypto.MD5.str2binl(src), src.length * 8)); }; v1.core_md5 = function (x, len) { x[len >> 5] |= 128 << len % 32; x[(len + 64 >>> 9 << 4) + 14] = len; var v4 = 1732584193; var v3 = -271733879; var v2 = -1732584194; var v1 = 271733878; var v5 = 0; while (v5 < x.length) { var v10 = v4; var v9 = v3; var v8 = v2; var v7 = v1; v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 0], 7, -680876936); v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 1], 12, -389564586); v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 2], 17, 606105819); v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 3], 22, -1044525330); v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 4], 7, -176418897); v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 5], 12, 1200080426); v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 6], 17, -1473231341); v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 7], 22, -45705983); v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 8], 7, 1770035416); v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 9], 12, -1958414417); v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 10], 17, -42063); v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 11], 22, -1990404162); v4 = com.newgrounds.crypto.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 12], 7, 1804603682); v1 = com.newgrounds.crypto.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 13], 12, -40341101); v2 = com.newgrounds.crypto.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 14], 17, -1502002290); v3 = com.newgrounds.crypto.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 15], 22, 1236535329); v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 1], 5, -165796510); v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 6], 9, -1069501632); v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 11], 14, 643717713); v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 0], 20, -373897302); v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 5], 5, -701558691); v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 10], 9, 38016083); v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 15], 14, -660478335); v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 4], 20, -405537848); v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 9], 5, 568446438); v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 14], 9, -1019803690); v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 3], 14, -187363961); v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 8], 20, 1163531501); v4 = com.newgrounds.crypto.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 13], 5, -1444681467); v1 = com.newgrounds.crypto.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 2], 9, -51403784); v2 = com.newgrounds.crypto.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 7], 14, 1735328473); v3 = com.newgrounds.crypto.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 12], 20, -1926607734); v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 5], 4, -378558); v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 8], 11, -2022574463); v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 11], 16, 1839030562); v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 14], 23, -35309556); v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 1], 4, -1530992060); v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 4], 11, 1272893353); v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 7], 16, -155497632); v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 10], 23, -1094730640); v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 13], 4, 681279174); v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 0], 11, -358537222); v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 3], 16, -722521979); v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 6], 23, 76029189); v4 = com.newgrounds.crypto.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 9], 4, -640364487); v1 = com.newgrounds.crypto.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 12], 11, -421815835); v2 = com.newgrounds.crypto.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 15], 16, 530742520); v3 = com.newgrounds.crypto.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 2], 23, -995338651); v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 0], 6, -198630844); v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 7], 10, 1126891415); v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 14], 15, -1416354905); v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 5], 21, -57434055); v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 12], 6, 1700485571); v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 3], 10, -1894986606); v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 10], 15, -1051523); v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 1], 21, -2054922799); v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 8], 6, 1873313359); v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 15], 10, -30611744); v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 6], 15, -1560198380); v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 13], 21, 1309151649); v4 = com.newgrounds.crypto.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 4], 6, -145523070); v1 = com.newgrounds.crypto.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 11], 10, -1120210379); v2 = com.newgrounds.crypto.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 2], 15, 718787259); v3 = com.newgrounds.crypto.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 9], 21, -343485551); v4 = com.newgrounds.crypto.MD5.safe_add(v4, v10); v3 = com.newgrounds.crypto.MD5.safe_add(v3, v9); v2 = com.newgrounds.crypto.MD5.safe_add(v2, v8); v1 = com.newgrounds.crypto.MD5.safe_add(v1, v7); v5 += 16; } return new Array(v4, v3, v2, v1); }; v1.md5_cmn = function (q, a, b, x, s, t) { return com.newgrounds.crypto.MD5.safe_add(com.newgrounds.crypto.MD5.bit_rol(com.newgrounds.crypto.MD5.safe_add(com.newgrounds.crypto.MD5.safe_add(a, q), com.newgrounds.crypto.MD5.safe_add(x, t)), s), b); }; v1.md5_ff = function (a, b, c, d, x, s, t) { return com.newgrounds.crypto.MD5.md5_cmn(b & c | ~b & d, a, b, x, s, t); }; v1.md5_gg = function (a, b, c, d, x, s, t) { return com.newgrounds.crypto.MD5.md5_cmn(b & d | c & ~d, a, b, x, s, t); }; v1.md5_hh = function (a, b, c, d, x, s, t) { return com.newgrounds.crypto.MD5.md5_cmn(b ^ c ^ d, a, b, x, s, t); }; v1.md5_ii = function (a, b, c, d, x, s, t) { return com.newgrounds.crypto.MD5.md5_cmn(c ^ (b | ~d), a, b, x, s, t); }; v1.bit_rol = function (num, cnt) { return num << cnt | num >>> 32 - cnt; }; v1.safe_add = function (x, y) { var v1 = (x & 65535) + (y & 65535); var v2 = (x >> 16) + (y >> 16) + (v1 >> 16); return v2 << 16 | v1 & 65535; }; v1.str2binl = function (str) { var v3 = new Array(); var v4 = 255; var v1 = 0; while (v1 < str.length * 8) { v3[v1 >> 5] |= (str.charCodeAt(v1 / 8) & v4) << v1 % 32; v1 += 8; } return v3; }; v1.binl2hex = function (binarray) { var v4 = new String(''); var v3 = new String('0123456789abcdef'); var v1 = 0; while (v1 < binarray.length * 4) { v4 += v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 + 4 & 15) + v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 & 15); ++v1; } return v4; }; ASSetPropFlags(com.newgrounds.crypto.MD5.prototype, null, 1); } #endinitclip } movieClip 747 __Packages.com.newgrounds.crypto.RC4 { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.crypto) { _global.com.newgrounds.crypto = new Object(); } if (!_global.com.newgrounds.crypto.RC4) { var v1 = function () {}; com.newgrounds.crypto.RC4 = v1; var v2 = v1.prototype; v1.encrypt = function (src, key) { var v3 = com.newgrounds.crypto.RC4.strToChars(src); var v1 = com.newgrounds.crypto.RC4.strToChars(key); var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1); return com.newgrounds.crypto.RC4.charsToHex(v2); }; v1.encryptbin = function (src, key) { var v3 = com.newgrounds.crypto.RC4.strToChars(src); var v1 = com.newgrounds.crypto.RC4.strToChars(key); var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1); return v2; }; v1.decrypt = function (src, key) { var v3 = com.newgrounds.crypto.RC4.hexToChars(src); var v1 = com.newgrounds.crypto.RC4.strToChars(key); var v2 = com.newgrounds.crypto.RC4.calculate(v3, v1); return com.newgrounds.crypto.RC4.charsToStr(v2); }; v1.initialize = function (pwd) { var v2 = 0; var v3; var v4 = pwd.length; var v1 = 0; while (v1 <= 255) { com.newgrounds.crypto.RC4.mykey[v1] = pwd[v1 % v4]; com.newgrounds.crypto.RC4.sbox[v1] = v1; ++v1; } v1 = 0; while (v1 <= 255) { v2 = (v2 + com.newgrounds.crypto.RC4.sbox[v1] + com.newgrounds.crypto.RC4.mykey[v1]) % 256; v3 = com.newgrounds.crypto.RC4.sbox[v1]; com.newgrounds.crypto.RC4.sbox[v1] = com.newgrounds.crypto.RC4.sbox[v2]; com.newgrounds.crypto.RC4.sbox[v2] = v3; ++v1; } }; v1.calculate = function (plaintxt, psw) { com.newgrounds.crypto.RC4.initialize(psw); var v1 = 0; var v2 = 0; var v9 = new Array(); var v7; var v5; var v6; var v3 = 0; while (v3 < plaintxt.length) { v1 = (v1 + 1) % 256; v2 = (v2 + com.newgrounds.crypto.RC4.sbox[v1]) % 256; v5 = com.newgrounds.crypto.RC4.sbox[v1]; com.newgrounds.crypto.RC4.sbox[v1] = com.newgrounds.crypto.RC4.sbox[v2]; com.newgrounds.crypto.RC4.sbox[v2] = v5; var v4 = (com.newgrounds.crypto.RC4.sbox[v1] + com.newgrounds.crypto.RC4.sbox[v2]) % 256; v7 = com.newgrounds.crypto.RC4.sbox[v4]; v6 = plaintxt[v3] ^ v7; v9.push(v6); ++v3; } return v9; }; v1.charsToHex = function (chars) { var v4 = new String(''); var v3 = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); var v1 = 0; while (v1 < chars.length) { v4 += v3[chars[v1] >> 4] + v3[chars[v1] & 15]; ++v1; } return v4; }; v1.hexToChars = function (hex) { var v3 = new Array(); var v1 = (hex.substr(0, 2) == '0x') ? 2 : 0; while (v1 < hex.length) { v3.push(parseInt(hex.substr(v1, 2), 16)); v1 += 2; } return v3; }; v1.charsToStr = function (chars) { var v3 = new String(''); var v1 = 0; while (v1 < chars.length) { v3 += String.fromCharCode(chars[v1]); ++v1; } return v3; }; v1.strToChars = function (str) { var v3 = new Array(); var v1 = 0; while (v1 < str.length) { v3.push(str.charCodeAt(v1)); ++v1; } return v3; }; v1.sbox = new Array(255); v1.mykey = new Array(255); ASSetPropFlags(com.newgrounds.crypto.RC4.prototype, null, 1); } #endinitclip } movieClip 748 __Packages.com.newgrounds.encoders.json.JSON { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.json) { _global.com.newgrounds.encoders.json = new Object(); } if (!_global.com.newgrounds.encoders.json.JSON) { var v1 = function () {}; com.newgrounds.encoders.json.JSON = v1; var v2 = v1.prototype; v1.encode = function (arg, noquotes) { var v3; var v2; var v6; var v1 = ''; var v4; if (arg.isSServerVar()) { var v8 = 'sservervariable'; } else { var v8 = typeof arg; } switch (v8) { return 'null'; case 'sservervariable': return '?' + arg.getEncodedValue(); break; case 'object': if (arg) { if (arg instanceof Array) { v2 = 0; while (v2 < arg.length) { v4 = com.newgrounds.encoders.json.JSON.encode(arg[v2]); if (v1) { v1 += ','; } v1 += v4; ++v2; } return '[' + v1 + ']'; } else { if (typeof arg.toString != 'undefined') { for (v2 in arg) { v4 = arg[v2]; if (typeof v4 != 'undefined' && typeof v4 != 'function') { v4 = com.newgrounds.encoders.json.JSON.encode(v4); if (v1) { v1 += ','; } v1 += com.newgrounds.encoders.json.JSON.encode(v2) + ':' + v4; } } return '{' + v1 + '}'; } } } return 'null'; case 'number': return isFinite(arg) ? String(arg) : 'null'; case 'string': v6 = arg.length; if (noquotes) { var v7 = ''; } else { var v7 = '"'; } v1 = v7; v2 = 0; while (v2 < v6) { v3 = arg.charAt(v2); if (v3 >= ' ') { if (v3 == '\\' || v3 == '"') { v1 += '\\'; } v1 += v3; } else { switch (v3) { case '\b': v1 += '\\b'; break; case '\f': v1 += '\\f'; break; case '\n': v1 += '\\n'; break; case '\r': v1 += '\\r'; break; case '\t': v1 += '\\t'; break; default: v3 = v3.charCodeAt(); v1 += '\\u00' + (Math.floor(v3 / 16)).toString(16) + (v3 % 16).toString(16); } } v2 += 1; } return v1 + v7; case 'boolean': return String(arg); default: return 'null'; } }; v1.background_encode = function (arg, callback) { if (com.newgrounds.encoders.json.JSON.busy) { trace('[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed'); return false; } else { if (!callback) { trace('[Newgrounds Encoder] :: Missing a callback function, skipping encode'); return false; } } com.newgrounds.encoders.json.JSON.busy = true; var v2 = new Date(); com.newgrounds.encoders.json.JSON.start = v2.getTime(); com.newgrounds.encoders.json.JSON.cache = {'busy': false, 'complete': false, 'arg': arg, 'target': arg, 'parents': [], 'encoded': '', 'callback': callback, 'encode_chunk': function () { com.newgrounds.encoders.json.JSON.encode_chunk(); }}; if (com.newgrounds.encoders.json.JSON.getType(arg) == 'object') { com.newgrounds.encoders.json.JSON.cache.encoded = '{'; com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'encode_chunk', 25); return true; } if (com.newgrounds.encoders.json.JSON.getType(arg) == 'array') { com.newgrounds.encoders.json.JSON.cache.encoded = '['; } com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'encode_chunk', 25); return true; }; v1.background_decode = function (arg, callback) { if (com.newgrounds.encoders.json.JSON.busy) { trace('[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed'); return false; } else { if (!callback) { trace('[Newgrounds Encoder] :: Missing a callback function, skipping decode'); return false; } } com.newgrounds.encoders.json.JSON.busy = true; var v1 = new Date(); com.newgrounds.encoders.json.JSON.start = v1.getTime(); com.newgrounds.encoders.json.JSON.cache = {'busy': false, 'callback': callback, 'complete': false, 'arg': arg, 'pos': 0, 'parents': ['root'], 'target': null, 'scratch': '', 'decode_chunk': function () { com.newgrounds.encoders.json.JSON.decode_chunk(); }}; com.newgrounds.encoders.json.JSON.interval = setInterval(com.newgrounds.encoders.json.JSON.cache, 'decode_chunk', 25); return true; }; v1.decode = function (text) { var at = 0; var ch = ' '; var _value; var _error = function (m) { throw {'name': 'JSONError', 'message': m, 'at': at - 1, 'text': text}; }; var _next = function () { ch = text.charAt(at); at += 1; return ch; }; var _white = function () { while (ch) { if (ch <= ' ') { _next(); } else { if (ch == '/') { switch (_next()) { case '/': for (;;) { if (!(_next() && ch != '\n' && ch != '\r')) break; } break; case '*': _next(); for (;;) { if (ch) { if (ch == '*') { if (_next() == '/') { _next(); break; } } else { _next(); } continue; } _error('Unterminated comment'); } break; default: _error('Syntax error'); } } else { break; } } } }; var _string = function () { var v4; var v1 = ''; var v3; var v2; var v5 = false; if (ch == '"') { while (_next()) { if (ch == '"') { _next(); return v1; } else { if (ch == '\\') { switch (_next()) { case 'b': v1 += '\b'; break; case 'f': v1 += '\f'; break; case 'n': v1 += '\n'; break; case 'r': v1 += '\r'; break; case 't': v1 += '\t'; break; case 'u': v2 = 0; v4 = 0; while (v4 < 4) { v3 = parseInt(_next(), 16); if (!isFinite(v3)) { v5 = true; break; } v2 = v2 * 16 + v3; v4 += 1; } if (v5) { v5 = false; } else { v1 += String.fromCharCode(v2); break; default: v1 += ch; } } } else { v1 += ch; } } } } _error('Bad string'); }; var _array = function () { var v1 = []; if (ch == '[') { _next(); _white(); if (ch == ']') { _next(); return v1; } while (ch) { v1.push(_value()); _white(); if (ch == ']') { _next(); return v1; } else { if (ch != ',') { break; } } _next(); _white(); } } _error('Bad array'); }; var _object = function () { var v2; var v1 = {}; if (ch == '{') { _next(); _white(); if (ch == '}') { _next(); return v1; } while (ch) { v2 = _string(); _white(); if (ch != ':') { break; } _next(); v1[v2] = _value(); _white(); if (ch == '}') { _next(); return v1; } else { if (ch != ',') { break; } } _next(); _white(); } } _error('Bad object'); }; var _number = function () { var v1 = ''; var v2; if (ch == '-') { v1 = '-'; _next(); } for (;;) { if (!(ch >= '0' && ch <= '9')) break; v1 += ch; _next(); } if (ch == '.') { v1 += '.'; for (;;) { if (!(_next() && ch >= '0' && ch <= '9')) break; v1 += ch; } } v2 = 1 * v1; if (!isFinite(v2)) { _error('Bad number'); } else { return v2; } }; var _word = function () { switch (ch) { case 't': if (_next() == 'r' && _next() == 'u' && _next() == 'e') { _next(); return true; } break; case 'f': if (_next() == 'a' && _next() == 'l' && _next() == 's' && _next() == 'e') { _next(); return false; } break; case 'n': if (_next() == 'u' && _next() == 'l' && _next() == 'l') { _next(); return null; } } _error('Syntax error'); }; _value = function () { _white(); switch (ch) { case '{': return _object(); case '[': return _array(); case '"': return _string(); case '-': return _number(); } return (ch >= '0' && ch <= '9') ? _number() : _word(); }; return _value(); }; v1.getType = function (v) { if (v instanceof Array) { return 'array'; } else { return typeof v; } }; v1.decode_chunk = function () { if (!com.newgrounds.encoders.json.JSON.cache.busy && !com.newgrounds.encoders.json.JSON.cache.complete) { com.newgrounds.encoders.json.JSON.cache.busy = true; var v1 = 0; while (v1 < com.newgrounds.encoders.json.JSON.decode_chunks) { com.newgrounds.encoders.json.JSON.chunk_decoder(); if (com.newgrounds.encoders.json.JSON.cache.complete) { break; } ++v1; } trace(Math.round((com.newgrounds.encoders.json.JSON.cache.pos / com.newgrounds.encoders.json.JSON.cache.arg.length) * 100) + '% decoded'); com.newgrounds.encoders.json.JSON.cache.busy = false; } if (com.newgrounds.encoders.json.JSON.cache.complete) { var v2 = new Date(); com.newgrounds.encoders.json.JSON.busy = false; clearInterval(com.newgrounds.encoders.json.JSON.interval); com.newgrounds.encoders.json.JSON.cache.callback(com.newgrounds.encoders.json.JSON.cache.root, v2.getTime() - com.newgrounds.encoders.json.JSON.start); com.newgrounds.encoders.json.JSON.cache.arg = ''; } }; v1.encode_chunk = function () { if (!com.newgrounds.encoders.json.JSON.cache.busy && !com.newgrounds.encoders.json.JSON.cache.complete) { com.newgrounds.encoders.json.JSON.cache.busy = true; var v1 = 0; while (v1 < com.newgrounds.encoders.json.JSON.encode_chunks) { com.newgrounds.encoders.json.JSON.chunk_encoder(); if (com.newgrounds.encoders.json.JSON.cache.complete) { break; } ++v1; } com.newgrounds.encoders.json.JSON.cache.busy = false; } if (com.newgrounds.encoders.json.JSON.cache.complete) { var v3 = new Date(); var v2 = v3.getTime(); com.newgrounds.encoders.json.JSON.busy = false; clearInterval(com.newgrounds.encoders.json.JSON.interval); com.newgrounds.encoders.json.JSON.cache.callback(com.newgrounds.encoders.json.JSON.cache.encoded, v2 - com.newgrounds.encoders.json.JSON.start); com.newgrounds.encoders.json.JSON.cache.encoded = ''; } }; v1.chunk_decoder = function () { function _object() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (!com.newgrounds.encoders.json.JSON.cache.mode) { com.newgrounds.encoders.json.JSON.cache.mode = 'object'; ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (v1 != '"') { throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")'; } com.newgrounds.encoders.json.JSON.cache.scratch = ''; _setTargetValue({}); } else { if (v1 == ',') { ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (v1 != '"') { throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")'; } com.newgrounds.encoders.json.JSON.cache.scratch = ''; } else { if (v1 == '}') { _useParent(); } else { if (v1 == '"') { ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (v1 != ':') { throw 'Malformed object notation. Object keys and values must be separated by colons(:)'; } _addParent(com.newgrounds.encoders.json.JSON.cache.scratch); com.newgrounds.encoders.json.JSON.cache.mode = null; } else { if (v1 == '\\') { ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); } com.newgrounds.encoders.json.JSON.cache.scratch += v1; } } } } ++com.newgrounds.encoders.json.JSON.cache.pos; } function _array() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (!com.newgrounds.encoders.json.JSON.cache.mode) { com.newgrounds.encoders.json.JSON.cache.mode = 'array'; ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); _setTargetValue([]); if (v1 != ']') { _addArrayKey(); } else { _useParent(); } return undefined; } else { if (v1 == ',') { _addArrayKey(); } else { if (v1 == ']') { _useParent(); } } } ++com.newgrounds.encoders.json.JSON.cache.pos; } function _boolean() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (v1 == 't') { _setTargetValue(true); com.newgrounds.encoders.json.JSON.cache.pos += 3; } else { if (v1 == 'f') { _setTargetValue(false); com.newgrounds.encoders.json.JSON.cache.pos += 4; } else { throw 'Bool values must be true or false'; } } _useParent(); } function _null() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (v1 == 'n') { _setTargetValue(null); com.newgrounds.encoders.json.JSON.cache.pos += 2; } else { throw 'Null values must be null'; } _useParent(); } function _string() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); if (!com.newgrounds.encoders.json.JSON.cache.mode) { if (v1 != '"') { throw 'Strings must be wrapped in quotes ("")'; } com.newgrounds.encoders.json.JSON.cache.scratch = ''; com.newgrounds.encoders.json.JSON.cache.mode = 'string'; } else { if (v1 == '"') { _setTargetValue(com.newgrounds.encoders.json.JSON.cache.scratch); _useParent(); } else { if (v1 == '\\') { ++com.newgrounds.encoders.json.JSON.cache.pos; v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); switch (v1) { case 'n': v1 = '\n'; break; case 'r': v1 = '\n'; break; case 't': v1 = '\t'; break; case 'u': v1 = '\\' + v1; } } com.newgrounds.encoders.json.JSON.cache.scratch += v1; } } ++com.newgrounds.encoders.json.JSON.cache.pos; } function _number() { var v1 = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); var v2 = '01234567890.-'; if (!com.newgrounds.encoders.json.JSON.cache.mode) { com.newgrounds.encoders.json.JSON.cache.mode = 'number'; com.newgrounds.encoders.json.JSON.cache.scratch = ''; } if (v2.indexOf(v1) < 0) { _setTargetValue(Number(com.newgrounds.encoders.json.JSON.cache.scratch)); _useParent(); } else { com.newgrounds.encoders.json.JSON.cache.scratch += v1; ++com.newgrounds.encoders.json.JSON.cache.pos; } } function _setTargetValue(newval) { var v2 = (_getParent()).obj; var v1 = com.newgrounds.encoders.json.JSON.cache.parents[com.newgrounds.encoders.json.JSON.cache.parents.length - 1]; v2[v1] = newval; } function _useParent() { com.newgrounds.encoders.json.JSON.cache.mode = com.newgrounds.encoders.json.JSON.getType((_getParent()).obj); com.newgrounds.encoders.json.JSON.cache.parents.pop(); } function _getParent() { var v2 = com.newgrounds.encoders.json.JSON.cache; var v1 = 0; while (v1 < com.newgrounds.encoders.json.JSON.cache.parents.length - 1) { v2 = v2[com.newgrounds.encoders.json.JSON.cache.parents[v1]]; ++v1; } return {'obj': v2, 'name': com.newgrounds.encoders.json.JSON.cache.parents[v1]}; } function _getCurrent() { var v2 = com.newgrounds.encoders.json.JSON.cache; var v1 = 0; while (v1 < com.newgrounds.encoders.json.JSON.cache.parents.length) { v2 = v2[com.newgrounds.encoders.json.JSON.cache.parents[v1]]; ++v1; } return {'obj': v2, 'name': com.newgrounds.encoders.json.JSON.cache.parents[v1]}; } function _addParent(child) { com.newgrounds.encoders.json.JSON.cache.parents.push(child); } function _addArrayKey() { var v1 = (_getCurrent()).obj.length; com.newgrounds.encoders.json.JSON.cache.parents.push(v1); com.newgrounds.encoders.json.JSON.cache.mode = null; } if (com.newgrounds.encoders.json.JSON.cache.pos >= com.newgrounds.encoders.json.JSON.cache.arg.length) { com.newgrounds.encoders.json.JSON.cache.complete = true; return undefined; } else { if (com.newgrounds.encoders.json.JSON.cache.mode) { ('_' + com.newgrounds.encoders.json.JSON.cache.mode)(); } else { var char = com.newgrounds.encoders.json.JSON.cache.arg.charAt(com.newgrounds.encoders.json.JSON.cache.pos); switch (char) { case '{': _object(); break; case '[': _array(); break; case '"': _string(); break; case 'n': _null(); break; case 't': _boolean(); break; case 'f': _boolean(); break; default: _number(); } } } }; v1.chunk_encoder = function () { if (com.newgrounds.encoders.json.JSON.cache.complete) { return undefined; } var v2 = com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target); switch (v2) { case 'number': com.newgrounds.encoders.json.JSON.cache.encoded += com.newgrounds.encoders.json.JSON.cache.target; com.newgrounds.encoders.json.JSON.getParent(); break; case 'string': com.newgrounds.encoders.json.JSON.cache.encoded += '"' + (com.newgrounds.encoders.json.JSON.cache.target.split('"')).join('\\"') + '"'; com.newgrounds.encoders.json.JSON.getParent(); break; case 'boolean': com.newgrounds.encoders.json.JSON.cache.encoded += (com.newgrounds.encoders.json.JSON.cache.target == true) ? 'true' : 'false'; com.newgrounds.encoders.json.JSON.getParent(); break; case 'null': com.newgrounds.encoders.json.JSON.cache.encoded += 'null'; com.newgrounds.encoders.json.JSON.getParent(); break; case 'array': if (com.newgrounds.encoders.json.JSON.cache.target.length < 1) { com.newgrounds.encoders.json.JSON.cache.encoded += ']'; com.newgrounds.encoders.json.JSON.getParent(); } else { com.newgrounds.encoders.json.JSON.cache.parents.push(com.newgrounds.encoders.json.JSON.cache.target); com.newgrounds.encoders.json.JSON.cache.target = com.newgrounds.encoders.json.JSON.cache.target[0]; if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'array') { com.newgrounds.encoders.json.JSON.cache.encoded += '['; } else { if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'object') { com.newgrounds.encoders.json.JSON.cache.encoded += '{'; } } } break; case 'object': for (var v1 in com.newgrounds.encoders.json.JSON.cache.target) { break; } if (v1 === undefined) { com.newgrounds.encoders.json.JSON.cache.encoded += '}'; com.newgrounds.encoders.json.JSON.getParent(); } else { com.newgrounds.encoders.json.JSON.cache.parents.push(com.newgrounds.encoders.json.JSON.cache.target); com.newgrounds.encoders.json.JSON.cache.target = com.newgrounds.encoders.json.JSON.cache.target[v1]; com.newgrounds.encoders.json.JSON.cache.encoded += '"' + (v1.split('"')).join('\\"') + '":'; if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'array') { com.newgrounds.encoders.json.JSON.cache.encoded += '['; } else { if (com.newgrounds.encoders.json.JSON.getType(com.newgrounds.encoders.json.JSON.cache.target) == 'object') { com.newgrounds.encoders.json.JSON.cache.encoded += '{'; } } } break; default: com.newgrounds.encoders.json.JSON.cache.encoded += 'null'; com.newgrounds.encoders.json.JSON.getParent(); } }; v1.getParent = function () { if (com.newgrounds.encoders.json.JSON.cache.parents.length > 0) { var v1 = com.newgrounds.encoders.json.JSON.cache.parents.pop(); if (com.newgrounds.encoders.json.JSON.getType(v1) == 'array') { v1.shift(); } else { for (var v3 in v1) { delete v1[v3]; break; } } if (com.newgrounds.encoders.json.JSON.getType(v1) == 'object' or com.newgrounds.encoders.json.JSON.getType(v1) == 'array') { for (var v2 in v1) { break; } if (v2 !== undefined) { com.newgrounds.encoders.json.JSON.cache.encoded += ','; } } com.newgrounds.encoders.json.JSON.cache.target = v1; } else { com.newgrounds.encoders.json.JSON.cache.complete = true; } }; v1.encode_chunks = 20000; v1.decode_chunks = 20000; v1.busy = false; ASSetPropFlags(com.newgrounds.encoders.json.JSON.prototype, null, 1); } #endinitclip } movieClip 752 __Packages.com.newgrounds.Score { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Score) { var v1 = function (rank, username, score, numericValue, tag) { this._rank = rank; this._username = username; this._score = score; this._numericValue = numericValue; this._tag = tag; }; com.newgrounds.Score = v1; var v2 = v1.prototype; v2.__get__numericValue = function () { return this._numericValue; }; v2.__get__rank = function () { return this._rank; }; v2.__get__score = function () { return this._score; }; v2.__get__tag = function () { return this._tag; }; v2.__get__username = function () { return this._username; }; v2.toString = function () { return this._rank + '.\t' + this._username + '\t' + this._score; }; v2.addProperty('numericValue', v2.__get__numericValue, function () {}); v2.addProperty('rank', v2.__get__rank, function () {}); v2.addProperty('score', v2.__get__score, function () {}); v2.addProperty('tag', v2.__get__tag, function () {}); v2.addProperty('username', v2.__get__username, function () {}); ASSetPropFlags(com.newgrounds.Score.prototype, null, 1); } #endinitclip } frame 3 { function setControlsToBindings() { controls.walkleft = keyBindings[0]; controls.walkright = keyBindings[1]; controls.jump = keyBindings[2]; controls.plantseed = keyBindings[3]; controls.usetool = keyBindings[4]; controls.discardtool = keyBindings[5]; controls.inventoryleft = keyBindings[6]; controls.inventoryright = keyBindings[7]; controls.pause = keyBindings[8]; } function onEnterFrame() { if (saveLoadEnabled) { if (!loadedData) { if (loadLocalData()) { loadedData = true; screenBlack.gotoAndStop(2); fader.gotoAndPlay('fadein'); } else { --loadRetries; screenBlack.gotoAndStop(1); if (loadRetries <= 0) { play(); fader.gotoAndPlay('fadein'); } } } } else { play(); } } function saveGame() { var v1 = {'hardcoreGame': hardcoreGame, 'hardcoreSeed': hardcoreSeed, 'collectedSeeds': collectedSeeds, 'powerupsGotten': powerupsGotten, 'gottenGlowyBug': gottenGlowyBug}; var v2 = {'rotationLocked': rotationLocked, 'gravityIndicatorEnabled': gravityIndicatorEnabled, 'keyBindings': keyBindings, 'beatenGameOnce': beatenGameOnce, 'flagIndicatorEnabled': flagIndicatorEnabled, 'gameMuted': gameMuted, 'backgroundsEnabled': backgroundsEnabled}; saveSharedObject = SharedObject.getLocal('dwarfPlanetLocalSave'); if (saveSharedObject.data.localData == undefined) { trace('Saved Game'); } else { trace('Overwrote Saved Game'); } localData = {}; localData.saveGame = v1; localData.userSettings = v2; saveSharedObject.data.localData = localData; saveSharedObject.data.flush(); } function loadLocalData() { saveSharedObject = SharedObject.getLocal('dwarfPlanetLocalSave'); if (saveSharedObject.data.localData == undefined) { trace('No Saved Game'); _root.startFromIntro = true; return false; } else { var v2 = saveSharedObject.data.localData; beatenGameOnce = v2.userSettings.beatenGameOnce; rotationLocked = v2.userSettings.rotationLocked; gravityIndicatorEnabled = v2.userSettings.gravityIndicatorEnabled; flagIndicatorEnabled = v2.userSettings.flagIndicatorEnabled; keyBindings = v2.userSettings.keyBindings; setControlsToBindings(); backgroundsEnabled = v2.userSettings.backgroundsEnabled; gameMuted = v2.userSettings.gameMuted; trace('loaded data'); return true; } } function loadGame() { saveSharedObject = SharedObject.getLocal('dwarfPlanetLocalSave'); var v1 = saveSharedObject.data.localData; hardcoreGame = v1.saveGame.hardcoreGame; hardcoreSeed = v1.saveGame.hardcoreSeed; collectedSeeds = v1.saveGame.collectedSeeds; trace(collectedSeeds); powerupsGotten = v1.saveGame.powerupsGotten; gottenGlowyBug = v1.saveGame.gottenGlowyBug; if (gottenGlowyBug) { boundaryStage = 1; } trace('loaded game'); } var saveLoadEnabled = true; var releaseBuild = true; var loadedData = false; var loadRetries = 60; var beatenGameOnce = false; var rotationLocked = false; var gravityIndicatorEnabled = true; var flagIndicatorEnabled = true; var backgroundsEnabled = true; var gameMuted = false; var hardcoreGame = false; var hardcoreSeed = 1; var collectedSeeds = new Array(); var powerupsGotten = new Array(false, false, false, false, false); var boundaryStage = 0; if (!releaseBuild) { boundaryStage = 1; } var gottenGlowyBug = false; var mainFlagPosition = {'x': 0, 'y': 0}; var mainFlagRotation = 0; var mainFlagPlaced = false; var keyBindings = new Array(37, 39, 38, 40, 32, 90, 188, 190, 80); var controls = new Object(); setControlsToBindings(); stop(); var myMenu = new ContextMenu(); myMenu.hideBuiltInItems(); _root.menu = myMenu; } movieClip 800 { } movieClip 804 { } // unknown tag 88 length 146 movieClip 812 { frame 1 { stop(); if (_root.beatenGameOnce) { nextFrame(); } } } movieClip 814 { } movieClip 817 { frame 60 { stop(); } } movieClip 819 { } movieClip 820 { frame 23 { stop(); } } movieClip 833 { } movieClip 834 { frame 35 { stop(); } } movieClip 835 { frame 1 { function onEnterFrame() { if (active) { if (Key.isDown(40) && !downHeld) { downHeld = true; if ((_currentframe != 4 || _root.beatenGameOnce) && _currentframe != 5) { nextFrame(); } } else { if (!Key.isDown(40) && downHeld) { downHeld = false; } } if (Key.isDown(38) && !upHeld) { upHeld = true; if (this._currentframe != 1) { prevFrame(); } } else { if (!Key.isDown(38) && upHeld) { upHeld = false; } } if (Key.isDown(32) || Key.isDown(13) && !spaceHeld) { spaceHeld = true; runMenuItem(); } else { if (!Key.isDown(32) && !Key.isDown(13) && spaceHeld) { spaceHeld = false; } } } } stop(); var downHeld = true; var upHeld = true; var spaceHeld = true; var active = true; } frame 1 { function runMenuItem() { _root.fader.gotoAndPlay('fadeout'); _root.nextLoadedScene = 'main'; _root.loadGame(); active = false; } } instance of movieClip 814 { onClipEvent (enterFrame) { if (!_root.beatenGameOnce) { _visible = false; } else { _visible = true; } } } frame 2 { function runMenuItem() { gotoAndStop('newgame'); } } frame 3 { function runMenuItem() { gotoAndStop('newhardcore'); } } instance of movieClip 820 { onClipEvent (load) { if (_root.beatenGameOnce) { _visible = false; } } } frame 4 { function runMenuItem() { gotoAndStop('credits'); } } frame 5 { function runMenuItem() { _root.gotoAndPlay('ending'); } } frame 6 { function onEnterFrame() { if (active) { if (Key.isDown(27)) { gotoAndStop(1); } if (Key.isDown(89)) { runMenuItem(); } } } stop(); } frame 6 { function runMenuItem() { _root.fader.gotoAndPlay('fadeout'); _root.nextLoadedScene = 'main'; _root.startFromIntro = true; active = false; } } frame 7 { function onEnterFrame() { if (active) { if (Key.isDown(27)) { gotoAndStop(1); } if (Key.isDown(89)) { runMenuItem(); } } } stop(); } frame 7 { function runMenuItem() { nextFrame(); } } frame 8 { function onEnterFrame() { if (active) { if ((Key.isDown(40) || Key.isDown(39)) && !downHeld) { downHeld = true; if (_currentframe != 13) { nextFrame(); } } else { if (!Key.isDown(40) && !Key.isDown(39) && downHeld) { downHeld = false; } } if ((Key.isDown(38) || Key.isDown(37)) && !upHeld) { upHeld = true; if (this._currentframe != 8) { prevFrame(); } } else { if (!Key.isDown(38) && !Key.isDown(37) && upHeld) { upHeld = false; } } if (Key.isDown(32) || Key.isDown(13) && !spaceHeld) { spaceHeld = true; runMenuItem(); } else { if (!Key.isDown(32) && !Key.isDown(13) && spaceHeld) { spaceHeld = false; } } if (Key.isDown(27)) { gotoAndStop(1); } } } function runMenuItem() { _root.hardcoreGame = true; _root.hardcoreSeed = selectedSeed; _root.fader.gotoAndPlay('fadeout'); _root.nextLoadedScene = 'main'; _root.startFromIntro = true; active = false; } stop(); var downHeld = true; var upHeld = true; var spaceHeld = true; } frame 8 { var selectedSeed = 1; } frame 9 { var selectedSeed = 2; } frame 10 { var selectedSeed = 3; } frame 11 { var selectedSeed = 4; } frame 12 { var selectedSeed = 5; } frame 13 { var selectedSeed = 6; } frame 14 { function onEnterFrame() { if (active) { if (Key.isDown(27)) { runMenuItem(); } } } stop(); } frame 14 { function runMenuItem() { gotoAndStop(1); } } } instance of movieClip 835 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } movieClip 841 { frame 103 { stop(); } frame 340 { if (_root.nextLoadedScene == _root._currentframe) { _root.prevFrame(); _root.play(); } else { gotoAndPlay('fadein'); _root.gotoAndPlay(_root.nextLoadedScene); } _root.EndCutscene(); stopAllSounds(); gotoAndPlay('fadein'); } frame 460 { if (_root.nextLoadedScene == _root._currentframe) { _root.prevFrame(); _root.play(); } else { gotoAndPlay('fadein'); _root.gotoAndPlay(_root.nextLoadedScene); } _root.EndCutscene(); stopAllSounds(); gotoAndPlay('fadein'); } } instance fader of movieClip 841 { onClipEvent (enterFrame) { _x = _root.camera._x; _y = _root.camera._y; _rotation = _root.camera._rotation; _xscale = _root.camera._xscale; _yscale = _root.camera._yscale; } } movieClip 842 { frame 2 { stop(); } } frame 6 { function onEnterFrame() { if (cutsceneTimer > 0) { if (!cutscenePaused) { --cutsceneTimer; if (cutsceneTimer <= 0) { EndCutscene(); } } } } function TriggerCutscene(cutsceneTime, cameraTarget) { gamePaused = true; cutsceneTimer = cutsceneTime; _root.camera.target = cameraTarget; } function EndCutscene() { gamePaused = false; _root.camera.target = _root.guy; cutsceneTimer = 0; } function Die() { guy.hasDied = true; fader.gotoAndPlay('circleout'); } function checkGuyHit(enemyX, enemyY, colliderSize, checkType) { if (!guy.invincible) { var v3 = colliderSize / 2; if (Math.abs(guy._x - enemyX) < v3 + guy.hitWidth) { if (Math.abs(guy._y - enemyY) < v3 + guy.hitWidth) { if (checkType == 'BOTTOM') { if (distanceBetweenPoints(guy._x + guy.llCor.x, guy._y + guy.llCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } else { if (distanceBetweenPoints(guy._x + guy.lrCor.x, guy._y + guy.lrCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } } } else { if (checkType == 'CORNERS') { if (distanceBetweenPoints(guy._x, guy._y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } else { if (distanceBetweenPoints(guy._x + guy.llCor.x, guy._y + guy.llCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } else { if (distanceBetweenPoints(guy._x + guy.lrCor.x, guy._y + guy.lrCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } else { if (distanceBetweenPoints(guy._x + guy.urCor.x, guy._y + guy.urCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } else { if (distanceBetweenPoints(guy._x + guy.ulCor.x, guy._y + guy.ulCor.y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } } } } } } else { if (checkType == 'CENTER') { if (distanceBetweenPoints(guy._x, guy._y, enemyX, enemyY) < v3) { guy.getHit(enemyX, enemyY); } } } } } } } } function distanceBetweenPoints(x1, y1, x2, y2) { xDist = x1 - x2; yDist = y1 - y2; return Math.sqrt(xDist * xDist + yDist * yDist); } function distanceBetweenObjects(mc1, mc2) { return distanceBetweenPoints(mc1._x, mc1._y, mc2._x, mc2._y); } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function vectorBetweenPoints(x1, y1, x2, y2) { xDist = x1 - x2; yDist = y1 - y2; return {'x': xDist, 'y': yDist}; } function magnitude(inputX, inputY) { return Math.sqrt(inputX * inputX + inputY * inputY); } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function pauseCheck(mc) { if (gamePaused) { if (mc.animating || mc.isAnimating) { mc.stop(); } } else { if (mc.animating || mc.isAnimating) { mc.play(); } } } function despawnFX(inputX, inputY) { var v2 = attachMovie('DespawnFX', 'despawn fx', this.getNextHighestDepth(), {'_x': inputX, '_y': inputY}); v2.blendMode = 'add'; } function checkOutOfBounds(inputX, inputY) { return distanceBetweenPoints(inputX, inputY, boundary._x, boundary._y) > boundary.boundaryDistance[_root.boundaryStage]; } function getRotationDiff(rot1, rot2) { return (rot2 - rot1 + 360 + 180) % 360 - 180; } function clamp(numberToClamp, lowBound, highBound) { return Math.max(Math.min(numberToClamp, highBound), lowBound); } function randomInt(min, max) { return Math.floor(Math.random() * (max - min + 1)) + min; } function updateWeaponInventory(weaponID) { hud.WeaponInventory.gotoAndStop(weaponID); } stop(); var gamePaused = false; var nextLoadedScene = 'main'; var mainLevel = true; var cutsceneTimer = 0; var cutscenePaused = false; var selectedLetter = 1; var heldWeapon = 1; var gameEnding = false; if (startFromIntro) { startFromIntro = false; gotoAndPlay('intro'); } var stageBackground = 'blueGalaxy'; if (powerupCutscene) { var spawnedPowerup = _root.itemsAttachPoint.attachMovie('powerup', 'power' + unlockedPowerup, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': 370, '_y': -180, '_rotation': 0}); spawnedPowerup.power = unlockedPowerup; spawnedPowerup.graphicMC.gotoAndStop(unlockedPowerup); spawnedPowerup.gotoAndStop(spawnedPowerup._totalframes); spawnedPowerup.hitPushActive = false; _root.itemsAttachPoint.attachMovie('SuperTwinkleFX', 'FX', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': spawnedPowerup._x, '_y': spawnedPowerup._y, '_rotation': _rotation}); TriggerCutscene(200, spawnedPowerup); if (unlockedPowerup == 2) { com.newgrounds.API.unlockMedal('Retriever'); } else { if (unlockedPowerup == 3) { com.newgrounds.API.unlockMedal('Brain Scramblant'); } else { if (unlockedPowerup == 4) { com.newgrounds.API.unlockMedal('Stopwatch'); } else { if (unlockedPowerup == 5) { com.newgrounds.API.unlockMedal('Invincible'); } } } } } powerupCutscene = false; var unlockedPowerup = 0; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; } movieClip 844 { } movieClip 847 { } movieClip 851 { } movieClip 855 { } // unknown tag 88 length 294 movieClip 861 { } movieClip 863 { } movieClip 865 { } movieClip 867 { } movieClip 869 { } movieClip 871 MedalPopup { frame 1 { function onMedalUnlocked(event) { if (event.__get__success()) { _medalQueue.push(event.__get__data()); showNextUnlock(); } } function showNextUnlock() { if (_unlockedMedal) { return undefined; } if (!_medalQueue.length) { gotoAndStop('hidden'); onEnterFrame = null; return undefined; } _unlockedMedal = com.newgrounds.Medal(_medalQueue.shift()); gotoAndPlay('medalUnlocked'); } gotoAndStop('hidden'); com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, onMedalUnlocked); var alwaysOnTop; _x = int(_x); _y = int(_y); var _unlockedMedal; var _medalQueue = []; var _alwaysOnTop = true; if (alwaysOnTop) { _alwaysOnTop = alwaysOnTop == 'true'; } } frame 15 { function medalPopupEnterFrame() { if (_alwaysOnTop) { var v1 = getNextHighestDepth(); swapDepths(v1); } if (_medalScrollRect) { _medalScrollRect.offset(2, 0); medalNameClip.scrollRect = _medalScrollRect; if (_medalScrollRect.left >= medalNameClip.textField.textWidth + 10) { _medalScrollRect = null; play(); } } } var _medalScrollRect; if (_unlockedMedal) { if (medalNameClip && medalNameClip.textField) { medalNameClip.textField.text = _unlockedMedal.name; } if (medalPointsText) { medalPointsText.text = _unlockedMedal.value.toString(); } if (medalNameClip.textField.textWidth > medalNameClip._width) { _medalScrollRect = new flash.geom.Rectangle(-medalNameClip._width, 0, medalNameClip._width, medalNameClip._height); medalNameClip.textField._width = 1000; medalNameClip.scrollRect = _medalScrollRect; } onEnterFrame = medalPopupEnterFrame; } } frame 23 { if (_unlockedMedal && medalIcon) { _unlockedMedal.attachIcon(medalIcon); } } frame 84 { if (_medalScrollRect) { stop(); } } frame 105 { stop(); _unlockedMedal = null; showNextUnlock(); } } instance of movieClip 871 MedalPopup { onClipEvent (construct) { alwaysOnTop = 'false'; } } // unknown tag 88 length 202 movieClip 875 { } instance stageManager of movieClip 875 { onClipEvent (load) { function addSeedToStart(seedMC) { seedMC._x = ss._x + slots[nextEmptySlot]._x; seedMC._y = ss._y + slots[nextEmptySlot]._y; seedMC.active = true; seedMC.target = _root.guy; ++nextEmptySlot; } this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); var ss = _root.seedslots; var slots = new Array(ss.s1, ss.s2, ss.s3, ss.s4, ss.s5, ss.s6, ss.s7, ss.s8, ss.s9, ss.s10, ss.s11, ss.s12, ss.s13, ss.s14, ss.s15, ss.s16, ss.s17, ss.s18, ss.s19, ss.s20, ss.s21); var nextEmptySlot = 0; var ps = _root.powerupslots; var pslots = new Array(ps.s1, ps.s2, ps.s3, ps.s4, ps.s5); var i = 0; while (i < pslots.length) { if (_root.powerupsGotten[i]) { var spawnedPowerup = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _root.powerupslots._x + _root.stageManager.pslots[i]._x, '_y': _root.powerupslots._y + _root.stageManager.pslots[i]._y, '_rotation': _root.stageManager.pslots[i]._rotation}); spawnedPowerup.power = i + 2; spawnedPowerup.graphicMC.gotoAndStop(i + 2); } ++i; } var frameCount = 0; } onClipEvent (enterFrame) { var spawnedPlatforms = _root.guy.spawnedObjects; var actionWindow = _root.actionWindow; var i = 0; while (i < spawnedPlatforms.length) { if (spawnedPlatforms[i]._visible) { if (!spawnedPlatforms[i].hitTest(actionWindow)) { spawnedPlatforms[i]._visible = false; } } else { if (spawnedPlatforms[i].hitTest(actionWindow)) { spawnedPlatforms[i]._visible = true; } } ++i; } ++frameCount; if (frameCount == 3 || frameCount == 500) { trace(frameCount); if (_root.boundaryStage == 1) { com.newgrounds.API.unlockMedal('whoosh'); com.newgrounds.API.unlockMedal('Buggy'); } if (_root.powerupsGotten[0]) { com.newgrounds.API.unlockMedal('Retriever'); } if (_root.powerupsGotten[1]) { com.newgrounds.API.unlockMedal('Brain Scramblant'); } if (_root.powerupsGotten[2]) { com.newgrounds.API.unlockMedal('Stopwatch'); } if (_root.powerupsGotten[3]) { com.newgrounds.API.unlockMedal('Invincible'); } var i = 0; while (i < sleepables.length) { if (_root.distanceBetweenObjects(sleepables[i].itemPoint.itemMC, _root.guy) < 1000) { if (sleepables[i].noclip) { com.newgrounds.API.unlockMedal('Clippy'); } else { if (sleepables[i].watcher) { com.newgrounds.API.unlockMedal('Sweaty'); } else { com.newgrounds.API.unlockMedal('Scribbly'); } } } ++i; } if (frameCount < 10) { var i = 0; while (i < seeds.length) { if (_root.distanceBetweenObjects(seeds[i], _root.guy) < 1000) { if (seeds[i].seedType == 4) { com.newgrounds.API.unlockMedal('Cyan'); } else { if (seeds[i].seedType == 5) { com.newgrounds.API.unlockMedal('Nega One'); } else { if (seeds[i].seedType == 6) { com.newgrounds.API.unlockMedal('Green'); } else { if (seeds[i].seedType == 7) { com.newgrounds.API.unlockMedal('Nega Two'); } else { if (seeds[i].seedType == 8) { com.newgrounds.API.unlockMedal('ABCDEFGHIJKLMNOPQRSTUVWXYZ'); } } } } } } ++i; } } } } } movieClip 877 { } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } else { if (prevLabel == 'prevRedguySound') { prevRedguySound = newPrevNumber; } else { if (prevLabel == 'prevRedguyHurt') { prevRedguyHurt = newPrevNumber; } else { if (prevLabel == 'prevSleepSound') { prevSleepSound = newPrevNumber; } else { if (prevLabel == 'prevPlatSound') { prevPlatSound = newPrevNumber; } } } } } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } else { if (prevLabel == 'prevRedguySound') { return prevRedguySound; } else { if (prevLabel == 'prevRedguyHurt') { return prevRedguyHurt; } else { if (prevLabel == 'prevSleepSound') { return prevSleepSound; } else { if (prevLabel == 'prevPlatSound') { return prevPlatSound; } } } } } } } } } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; var sporeSounds = new Array('sp-01', 'sp-02', 'sp-03', 'sp-04', 'sp-05', 'sp-06', 'sp-07', 'sp-08', 'sp-09', 'sp-10', 'sp-11', 'sp-12', 'sp-13', 'sp-14', 'sp-15', 'sp-16', 'sp-17', 'sp-18', 'sp-19', 'sp-20', 'sp-21', 'sp-22'); var spore2Sounds = new Array('sr-01', 'sr-02', 'sr-03', 'sr-04', 'sr-05', 'sr-06', 'sr-07', 'sr-08', 'sr-09', 'sr-10', 'sr-11', 'sr-12', 'sr-13', 'sr-14', 'sr-15', 'sr-16', 'sr-17', 'sr-18', 'sr-19', 'sr-20', 'sr-21', 'sr-22'); var sporeResetSounds = new Array('resetSpawn-01', 'resetSpawn-02', 'resetSpawn-03', 'resetSpawn-04'); var bugIdleSounds = new Array('bug-01.wav', 'bug-02.wav', 'bug-03.wav', 'bug-04.wav', 'bug-05.wav', 'bug-06.wav', 'bug-07.wav', 'bug-08.wav', 'bug-09.wav', 'bug-10.wav', 'bug-11.wav', 'bug-12.wav', 'bug-13.wav', 'bug-14.wav', 'bug-15.wav', 'bug-16.wav', 'bug-17.wav', 'bug-18.wav', 'bug-19.wav', 'bug-20.wav', 'bug-21.wav', 'bug-22.wav', 'bug-23.wav', 'bug-24.wav', 'bug-25.wav', 'bug-26.wav', 'bug-27.wav', 'bug-28.wav', 'bug-29.wav', 'bug-30.wav', 'bug-31.wav', 'bug-32.wav', 'bug-33.wav', 'bug-34.wav', 'bug-35.wav', 'bug-36.wav', 'bug-37.wav', 'bug-38.wav', 'bug-39.wav', 'bug-40.wav', 'bug-41.wav', 'bug-42.wav'); var bugHurtSounds = new Array('bugHurt-01.wav', 'bugHurt-02.wav', 'bugHurt-03.wav', 'bugHurt-04.wav', 'bugHurt-05.wav', 'bugHurt-06.wav'); var prevBugHurt = 0; var gatorSounds = new Array('gaderbite.wav', 'gaderbite2.wav', 'gaderbite3.wav'); var prevGatorSound = 0; var redguySounds = new Array('red-01.wav', 'red-02.wav', 'red-03.wav', 'red-04.wav', 'red-05.wav', 'red-06.wav', 'red-07.wav', 'red-08.wav', 'red-09.wav', 'red-10.wav', 'red-11.wav', 'red-12.wav', 'red-13.wav', 'red-14.wav', 'red-15.wav', 'red-16.wav', 'red-17.wav', 'red-18.wav', 'red-19.wav', 'red-20.wav', 'red-21.wav', 'red-22.wav'); var prevRedguySound = 0; var redguyHurtSounds = new Array('redhurt-01.wav', 'redhurt-02.wav', 'redhurt-03.wav', 'redhurt-04.wav', 'redhurt-05.wav'); var prevRedguyHurt = 0; var sleepSounds = new Array('sleep-03.wav', 'sleep-04.wav', 'sleep-05.wav', 'sleep-06.wav'); var prevSleepSound = 0; var platSounds = new Array('plat1.wav', 'plat3.wav', 'plat4.wav', 'plat5.wav', 'plat6.wav', 'plat7.wav', 'plat8.wav'); var prevPlatSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (_root.gameEnding) { var transitionProgress = (_root.distanceBetweenPoints(guy._x, guy._y, 0, 0) - 5000) / 5000; if (transitionProgress > 1) { transitionProgress = 1; } bgms[0].targetVolume *= 1 - transitionProgress; bgms[1].targetVolume *= 1 - transitionProgress; bgms[2].targetVolume *= 1 - transitionProgress; bgms[3].targetVolume *= 1 - transitionProgress; fallVolume *= Math.max(0.5 - transitionProgress, 0); playingFallSound.onSoundComplete = function () {}; } if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } movieClip 879 { frame 1 { function camControl() { rp.x = _x; rp.y = _y; var v5 = camH * (_yscale * 0.01); var v6 = camW * (_xscale * 0.01); var v3 = sH / v5; var v4 = sW / v6; _x2 = (v6 / 2) * v4; _y2 = (v5 / 2) * v3; _xscale2 = v4 * 100; _yscale2 = v3 * 100; _rotation2 = -_rotation; _root.filters = this.filters; _root.transform.colorTransform = this.transform.colorTransform; } function reset() { _root._xscale = 100; _root._yscale = 100; _root._x = 0; _root._y = 0; _root._rotation = 0; _root._visible = true; } function set_x2(value) { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._x += value - v2.x; } function get_x2() { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); return v2.x; } function set_y2(value) { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._y += value - v2.y; } function get_y2() { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); return v2.y; } function get_xscale2() { return _root._xscale; } function set_xscale2(value) { setProperty2('_xscale', value); } function get_yscale2() { return _root._yscale; } function set_yscale2(value) { setProperty2('_yscale', value); } function get_rotation2() { return parent.rotation; } function set_rotation2(value) { setProperty2('_rotation', value); } function setProperty2(prop, n) { var v3 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v3); _root[prop] = n; var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._x -= v2.x - v3.x; _root._y -= v2.y - v3.y; } var hud = _root.hud; var actionWindow = _root.actionWindow; var tutorialText = _root.tutorialText; _visible = true; addProperty('_x2', get_x2, set_x2); addProperty('_y2', get_y2, set_y2); addProperty('_xscale2', get_xscale2, set_xscale2); addProperty('_yscale2', get_yscale2, set_yscale2); addProperty('_rotation2', get_rotation2, set_rotation2); var oldScaleMode = stage.scaleMode; stage.scaleMode = 'exactFit'; var sW = Stage.width; var sH = Stage.height; stage.scaleMode = oldScaleMode; var bounds_obj = this.getBounds(this); var camH = Math.abs(bounds_obj.yMax - bounds_obj.yMin); var camW = Math.abs(bounds_obj.xMax - bounds_obj.xMin); var rp = {'x': this._x, 'y': this._y}; onEnterFrame = function () { camControl(); hud._x = this._x; hud._y = this._y; hud._rotation = this._rotation; hud._xscale = this._xscale; hud._yscale = this._yscale; actionWindow._x = _x; actionWindow._y = _y; actionWindow._rotation = _rotation; actionWindow._xscale = _xscale; actionWindow._yscale = _yscale; tutorialText._x = _x; tutorialText._y = _y; tutorialText._rotation = _rotation; tutorialText._xscale = _xscale; tutorialText._yscale = _yscale; }; this.onUnload = reset; } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { if (_root.gameEnding) { if (positionSmoothing < 1) { positionSmoothing += 0.002; } else { positionSmoothing = 1; } } xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { _rotation = 0; } } } } movieClip 885 { } movieClip 887 { } movieClip 888 { } movieClip 892 { } movieClip 894 { } movieClip 899 { } movieClip 900 { } movieClip 904 { } movieClip 905 { } movieClip 909 { } movieClip 917 { } movieClip 920 { } movieClip 922 { } movieClip 924 { } movieClip 926 { } movieClip 928 { } movieClip 930 { } movieClip 932 { } movieClip 934 { } movieClip 936 { } movieClip 937 { } movieClip 940 { } movieClip 947 { } movieClip 948 { } movieClip 957 { frame 1 { stop(); } frame 175 { _parent.gotoAndStop('heavySpirals'); } frame 241 { stop(); } } movieClip 962 { } movieClip 964 { } movieClip 966 { } movieClip 967 { } movieClip 969 { } movieClip 973 { frame 1542 { gotoAndPlay(loopPoint); } } movieClip 976 { } movieClip 977 { frame 1 { stop(); } instance of movieClip 885 { onClipEvent (load) { var stuff = _parent.stuff; var startPositions = _parent.startPositions; } onClipEvent (enterFrame) { var i = 0; while (i < stuff.length) { stuff[i]._x = startPositions[i].x + _root.guy._x * (0.1 * i); stuff[i]._y = startPositions[i].y + _root.guy._y * (0.1 * i); ++i; } } } frame 3 { var stuff = new Array(ob1); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } instance of movieClip 894 { } frame 4 { var stuff = new Array(ob1, ob2, ob3, ob4, ob5); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } instance of movieClip 904 { onClipEvent (load) { var stuff = _parent.stuff; var startPositions = _parent.startPositions; } onClipEvent (enterFrame) { var i = 0; while (i < stuff.length) { stuff[i]._x = startPositions[i].x + _root.guy._x * (0.1 * i); stuff[i]._y = startPositions[i].y + _root.guy._y * (0.1 * i); ++i; } } } frame 5 { var stuff = new Array(ob1, ob2, ob3, ob4, ob5); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } instance of movieClip 885 { onClipEvent (load) { var stuff = _parent.stuff; var startPositions = _parent.startPositions; } onClipEvent (enterFrame) { var i = 0; while (i < stuff.length) { stuff[i]._x = startPositions[i].x + _root.guy._x * (0.1 * i); stuff[i]._y = startPositions[i].y + _root.guy._y * (0.1 * i); ++i; } } } frame 6 { var stuff = new Array(ob1, ob2, ob3, ob4, ob5, ob6, ob7, ob8); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } instance of movieClip 885 { onClipEvent (load) { var stuff = _parent.stuff; var startPositions = _parent.startPositions; } onClipEvent (enterFrame) { var i = 0; while (i < stuff.length) { trace(startPositions[i].x + _root.guy._x * (0.0001 * i)); stuff[i]._x = startPositions[i].x + _root.guy._x * (0.1 * i); stuff[i]._y = startPositions[i].y + _root.guy._y * (0.1 * i); ++i; } } } frame 7 { stop(); var stuff = new Array(ob1); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } frame 12 { var stuff = new Array(ob1, ob2, ob3, ob4, ob5); var startPositions = new Array(); var i = 0; while (i < stuff.length) { var myObj = {'x': stuff[i]._x, 'y': stuff[i]._y}; startPositions.push(myObj); ++i; } } instance of movieClip 885 { onClipEvent (load) { var stuff = _parent.stuff; var startPositions = _parent.startPositions; } onClipEvent (enterFrame) { var i = 0; while (i < stuff.length) { stuff[i]._x = startPositions[i].x + _root.guy._x * (0.1 * i); stuff[i]._y = startPositions[i].y + _root.guy._y * (0.1 * i); ++i; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop(_root.stageBackground); } } } movieClip 980 { frame 2 { stop(); } } movieClip 984 { } movieClip 985 { } movieClip 987 { } movieClip 988 { } movieClip 989 { frame 2 { stop(); } } movieClip 990 { frame 1 { var attachPoint = terrainComposite.attachPoint; } instance hazardTerrain of movieClip 988 { } } instance terrain of movieClip 990 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } movieClip 993 { } movieClip 995 { frame 1 { stop(); } frame 20 { _root.boundaryStage = 1; } frame 149 { _root.tutorialText.gotoAndPlay('placeflag'); } frame 150 { stop(); } } instance boundary of movieClip 995 { onClipEvent (load) { var boundaryDistance = [1730, 3370]; if (_root.boundaryStage == 1) { this.gotoAndStop('stage1'); } } } movieClip 1001 { frame 1 { this.onEnterFrame = function () { if (!_root.gamePaused && !_parent.timeStopped) { play(); } else { stop(); } }; } } movieClip 1005 { frame 85 { gotoAndPlay('loop'); } } movieClip 1007 { } movieClip 1012 { frame 1 { this.onEnterFrame = function () { if (!_root.gamePaused && !_parent.timeStopped) { play(); } else { stop(); } }; } } movieClip 1014 { } movieClip 1015 { } movieClip 1019 { } movieClip 1022 { } movieClip 1023 { frame 1 { stop(); } } movieClip 1025 { frame 1 { stop(); var firstLoad = true; var activeBugs = _root.stageManager.activeBugs; activeBugs.push(this); if (bugType == 2 && _root.gottenGlowyBug) { bugType = 1; } _visible = false; this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { _visible = true; play(); } }; } instance downward of movieClip 1005 { onClipEvent (enterFrame) { if (!_root.gamePaused) { if (!_parent.grounded) { if (_currentframe == 2) { gotoAndPlay(3); } } else { if (_currentframe != 2) { gotoAndStop(2); } } if (_parent.gravityLerping) { _rotation = _parent.glerpRotation - _parent._rotation; } } if (_parent.shouldUpdate) { if (!_visible) { _visible = true; } } else { if (_visible) { _visible = false; } } } } instance itemPoint of movieClip 1007 { onClipEvent (load) { function setItemActive() { if (_parent.myItem != 0) { itemMC.setActive(); itemMC.target = _root.guy; } } function resetItemToTarget() { if (!itemMC.active) { if (_parent.myItem != 0) { var v2 = {'x': _x, 'y': _y}; _parent.localToGlobal(v2); itemMC._parent.globalToLocal(v2); itemMC._x = v2.x; itemMC._y = v2.y; } } } if (_parent.myItem != 0) { var itemXY = {'x': itemPoint._x, 'y': itemPoint._y}; if (!itemMC) { var itemMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'seed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + _parent._x, '_y': _y + _parent._y}); itemMC.active = false; itemMC.target = this; itemMC.gotoAndStop(_parent.myItem); } } } } frame 2 { function pauseCheck() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { resetToSpawnPoint(); trace('bug stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { resetToSpawnPoint(); trace('bug stuck?'); } } function rotatelrCorIntoPosition() { i = 0; for (;;) { if (!(!terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++i; } if (i >= 360 / slopeCheckStep - 1) { resetToSpawnPoint(); trace('bug stuck?'); } i = 0; for (;;) { if (!(terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++i; } if (i >= 360 / slopeCheckStep - 1) { resetToSpawnPoint(); trace('bug stuck?'); } } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function resetToSpawnPoint() { _x = spawnPoint.x; _y = spawnPoint.y; rotateGuy(spawnRotation); offScreenTimer = 0; forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); grounded = terrain.hitTest2(_x + gravityNormal.x * groundCheckDistance, _y + gravityNormal.y * groundCheckDistance, true); i = 0; for (;;) { if (!(terrain.hitTest2(_x, _y, true) && i < 10000)) break; _x = _x + gravityNormal.x; _y = _y + gravityNormal.y; ++i; } gotoAndPlay('respawn'); } function setDontHit(dontHitTime) { dontHit = true; dontHitTimer = dontHitTime; } function endDontHit() { dontHit = false; this._visible = true; } function getHit(colX, colY) { var v5 = _x; var v4 = _y; grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); fallSpeed = -hitJumpStrength; if (bugType == 2 || bugType == 3) { fallSpeed = -1; } _x = _x + gravityNormal.x * (groundCheckDistance + 2); _y = _y + gravityNormal.y * (groundCheckDistance + 2); var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { hitPushDirection = -1; } else { hitPushDirection = 1; } } else { if (facingLeft) { hitPushDirection = 1; } else { hitPushDirection = -1; } } hitPushActive = true; setDontHit(60); audioManager.stopSound(playingChirp); audioManager.triggerNonrepeatingProximitySound('prevBugHurt', 'bugHurtSound', audioManager.bugHurtSounds, 9, 1200, this); chirpTimer = 80; } var audioManager = _root.audioManager; var playingChirp = undefined; var chirpTimer = 0; var minChirpTime = 30; var chirpRandomness = 80; var animating = false; var killed = false; var hitJumpStrength = 6; var hitPush = 2; var hitPushDirection = -1; var hitPushActive = false; var terrain = _root.terrain; var grounded = true; var groundCheckDistance = 5; var slopeCheckDistance = 15; var slopeCheckStep = 5; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance; var dontHit = false; var donthitTimer = 0; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; if (spawnPoint == undefined) { var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; } var speed = 2; var forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; var gravityNormal = {'x': 0, 'y': -1}; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var fallSpeed = 0; var fallAccel = 0.2; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 2; var glerpNormal = {'x': 0, 'y': -1}; var inverter = 1; _xscale = 100; var usingBoundary = true; var offScreenTimer = 0; var isInGroup = _parent != _root; var shouldUpdate = false; var timeStopped = false; if (!firstLoad) { setDontHit(140); firstLoad = false; } Pattern.gotoAndStop(bugType); this.onEnterFrame = function () { pauseCheck(); if (!_root.gamePaused) { shouldUpdate = false; if (!isInGroup) { if (this.hitTest(_root.actionWindow)) { shouldUpdate = true; } if (_root.distanceBetweenObjects(this, _root.finalLevel) < 1600) { shouldUpdate = true; } } else { if (this._parent.hitTest(_root.actionWindow)) { shouldUpdate = true; } } if (!grounded) { shouldUpdate = true; } if (shouldUpdate) { if (!timeStopped) { if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; if (chirpTimer <= 0) { chirpTimer = minChirpTime + _root.randomInt(0, chirpRandomness); playingChirp = audioManager.triggerProximitySound('bugIdleSound', audioManager.bugIdleSounds, 12, 900, this); } else { --chirpTimer; } } if (!terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) && !terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { grounded = false; } else { grounded = true; hitPushActive = false; } if (grounded) { fallSpeed = 0; _x = _x + forwardNormal.x * speed * inverter; _y = _y + forwardNormal.y * speed * inverter; rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var v3 = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(v3); } else { fallSpeed += fallAccel; if (gravityLerping) { glerpNormal = rotatePointAroundOrigin(0, -1, glerpRotation); _x = _x - glerpNormal.x * fallSpeed; _y = _y - glerpNormal.y * fallSpeed; rotateGuy(_rotation + _root.clamp(_root.getRotationDiff(_rotation, glerpRotation), -glerpMax, glerpMax)) % 360; } else { _x = _x - gravityNormal.x * fallSpeed; _y = _y - gravityNormal.y * fallSpeed; } if (hitPushActive) { _x = _x + forwardNormal.x * hitPush * hitPushDirection * inverter; _y = _y + forwardNormal.y * hitPush * hitPushDirection * inverter; } if (terrain.hitTest2(_x + gravityNormal.x * hitHeight, _y + gravityNormal.y * hitHeight, true)) { rotateGuy(_rotation + 180); grounded = true; } if (terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) || terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { grounded = true; hitPushActive = false; downward.gotoAndStop(2); } if (grounded) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var v3 = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(v3); } } if (usingBoundary) { if (_root.checkOutOfBounds(_x, _y)) { resetToSpawnPoint(); } } else { if (!terrain.hitTest(this)) { ++offScreenTimer; if (offScreenTimer > 200) { resetToSpawnPoint(); } } else { offScreenTimer = 0; } } if (terrain.hitTestHazard(_x, _y, true)) { resetToSpawnPoint(); audioManager.stopSound(playingChirp); audioManager.triggerNonrepeatingProximitySound('prevBugHurt', 'bugHurtSound', audioManager.bugHurtSounds, 12, 1200, this); chirpTimer = 80; } } if (!dontHit) { if (_root.scramblantAttachPoint.hitTest(_x, _y, true)) { inverter *= -1; _xscale = -_xscale; setDontHit(30); } } if (!dontHit) { _root.checkGuyHit(_x, _y, hitWidth, 'CORNERS'); } else { if (dontHitTimer % 2 == 0) { if (this._visible) { this._visible = false; } else { this._visible = true; } } if (timeStopped) { if (dontHitTimer % 4 == 0) { dontHitTimer += 4; } } } if (dontHitTimer > 0) { --dontHitTimer; if (dontHitTimer <= 0) { dontHitTimer = 0; endDontHit(); } } } } }; } frame 2 { stop(); } frame 3 { animating = true; killed = true; this._visible = true; var i = 0; while (i < activeBugs.length) { if (activeBugs[i] == this) { activeBugs.splice(i, 1); break; } ++i; } this.onEnterFrame = function () {}; } frame 35 { itemPoint.setItemActive(); if (bugType == 2) { audioManager.triggerSound('get Special sound', new Array('getSpecial'), 30); } else { audioManager.triggerSound('get Thing sound', new Array('getThing'), 30); } com.newgrounds.API.unlockMedal('Buggy'); } frame 37 { stop(); animating = false; this.swapDepths(0); this.removeMovieClip(); } frame 38 { animating = true; itemPoint.resetItemToTarget(); Pattern.gotoAndStop(bugType); this._visible = true; this.onEnterFrame = function () { pauseCheck(); }; } frame 64 { gotoAndStop(2); } } instance deBug of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 2; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 3; var bugType = 3; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 3; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 4; var bugType = 1; } } movieClip 1027 { frame 1 { var spores = _root.stageManager.spores; spores.push(this); var mySporeID = spores.length - 1; stop(); _visible = false; this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { _visible = true; play(); } }; } frame 2 { function onEnterFrame() { if (!_root.gamePaused) { if (waitingForRespawn) { if (terrain.hitTest3(startPosition.x, startPosition.y, true)) { _x = startPosition.x; _y = startPosition.y; rotateBouncer(startRotation); waitingForRespawn = false; } } else { if (!timeStopped) { _root.p1._x = savedPositions[0].x; _root.p1._y = savedPositions[0].y; _root.p2._x = savedPositions[1].x; _root.p2._y = savedPositions[1].y; _root.p3._x = savedPositions[2].x; _root.p3._y = savedPositions[2].y; var v8 = {'x': _x + moveVector.x * speed, 'y': _y + moveVector.y * speed}; if (!terrain.hitTest3(v8.x, v8.y, true)) { var v20 = slopeCheckSpread + Math.random(slopeCheckSpreadRandomization); var v6 = _root.rotatePointAroundOrigin(-v20, 0, _rotation); var v5 = _root.rotatePointAroundOrigin(v20, 0, _rotation); var v10 = 1; var v11 = 1; var v14 = true; var v13 = true; if (!terrain.hitTest3(_x + v6.x, _y + v6.y, true)) { v10 *= -1; v14 = false; } if (!terrain.hitTest3(_x + v5.x, _y + v5.y, true)) { v11 *= -1; v13 = false; } var v4 = 0; while (v4 < slopeCheckMaxSteps + 1) { v6.x += moveVector.x * v10; v6.y += moveVector.y * v10; if (terrain.hitTest3(_x + v6.x, _y + v6.y, true) != v14) { break; } if (v4 == slopeCheckMaxSteps) { v6 = {'x': 0, 'y': 0}; } ++v4; } v4 = 0; while (v4 < slopeCheckMaxSteps + 1) { v5.x += moveVector.x * v11; v5.y += moveVector.y * v11; if (terrain.hitTest3(_x + v5.x, _y + v5.y, true) != v13) { break; } if (v4 == slopeCheckMaxSteps) { v5 = {'x': 0, 'y': 0}; } ++v4; } var v25 = v6.y - v5.y; var v21 = v6.x - v5.x; var v24 = Math.atan2(v25, v21) * _root.rad2Deg; boundaryPerp = v24 - 90; var v23 = boundaryPerp + (boundaryPerp - _rotation); rotateBouncer(v23); v8 = {'x': _x + moveVector.x * speed, 'y': _y + moveVector.y * speed}; if (!terrain.hitTest3(v8.x, v8.y, true)) { var v12 = false; var v19 = 5; var v17 = _root.rotatePointAroundOrigin(-v19, 0, _rotation); var v18 = _root.rotatePointAroundOrigin(v19, 0, _rotation); if (terrain.hitTest3(_x + v17.x, _y + v17.y, true)) { v12 = true; v8.x = _x + v17.x; v8.y = _y + v17.y; spawnHazard(); } else { if (terrain.hitTest3(_x + v18.x, _y + v18.y, true)) { v12 = true; v8.x = _x + v18.x; v8.y = _y + v18.y; spawnHazard(); } else { var v16 = lastPieces.length; v4 = 0; while (v4 < v16) { var v9 = _root.distanceBetweenPoints(savedPositions[0].x, savedPositions[0].y, _x, _y); if (terrain.hitTest3(savedPositions[0].x, savedPositions[0].y, true) && v9 < maxTeleport) { v8.x = savedPositions[0].x; v8.y = savedPositions[0].y; rotateBouncer(savedPositions[0].rotation + 90); v12 = true; break; } else { lastPieces.shift(); savedPositions.shift(); } ++v4; } } } if (!v12) { _root.despawnFX(_x, _y); resetToSpawnPoint(); } } else { spawnHazard(); } } else { var v15 = 1000; if (!lastPieces[0].hitTest(_x, _y, true)) { var v4 = Math.max(0, spawnedObjects.length - v15); while (v4 < spawnedObjects.length) { var v7 = false; var v3 = 0; while (v3 < lastPieces.length) { if (lastPieces[v3] == spawnedObjects[v4]) { v7 = true; } ++v3; } if (spawnedObjects[v4].hitTest(_x, _y, true)) { if (spawnedObjects[v4].animating) { } else { if (v7) { savedPositions[v4] = {'x': _x, 'y': _y, 'rotation': _rotation}; } else { lastPieces.unshift(spawnedObjects[v4]); savedPositions.unshift({'x': _x, 'y': _y, 'rotation': _rotation}); } } } ++v4; } } else { if (!lastPieces[0].animating) { savedPositions[0] = {'x': _x, 'y': _y, 'rotation': _rotation}; } } if (lastPieces.length > pieceArraySize) { lastPieces.pop(); savedPositions.pop(); } } if (!respawned) { _x = v8.x; _y = v8.y; } else { respawned = false; } if (brainScrambledTimer <= 0) { if (_root.scramblantAttachPoint.hitTest(_x, _y, true)) { if (bounceSpawn == 'bouncerBullet') { bounceSpawn = 'bouncerHazard'; animPiece = 'Sporeworm1Piece'; } else { bounceSpawn = 'bouncerBullet'; animPiece = 'Sporeworm2Piece'; } brainScrambledTimer = 80; } } else { --brainScrambledTimer; } } if (this.hitTest(_root.actionWindow)) { var v22 = _root.sporesAttachPoint.attachMovie(animPiece, 'Sporeworm Piece', _root.sporesAttachPoint.getNextHighestDepth(), {'_x': _x, '_y': _y}); v22.innard.gotoAndStop(graphicStartFrame); ++graphicStartFrame; if (graphicStartFrame == 15) { graphicStartFrame = 1; } } } } } function rotateBouncer(newRotation) { _rotation = newRotation; moveVector = _root.rotatePointAroundOrigin(0, 1, _rotation); } function spawnHazard() { var v4 = _root.sporesAttachPoint.attachMovie(bounceSpawn, 'whatever', _root.sporesAttachPoint.getNextHighestDepth(), {'_x': _x, '_y': _y, '_rotation': boundaryPerp}); if (spawnArray.unshift(v4) > spawnLimit) { var v3 = spawnArray.pop(); v3.clearedForDespawn = true; if (!v3.dead) { v3.gotoAndPlay('despawn'); } } if (bounceSpawn == 'bouncerBullet') { audioManager.triggerProximitySound('sporeSound', audioManager.spore2Sounds, 10, 1200, this); } else { audioManager.triggerProximitySound('sporeSound', audioManager.sporeSounds, 10, 1200, this); } } function resetToSpawnPoint() { respawned = true; if (!terrain.hitTest3(startPosition.x, startPosition.y, true)) { waitingForRespawn = true; } _x = startPosition.x; _y = startPosition.y; rotateBouncer(startRotation); audioManager.triggerProximitySound('sporeResetSound', audioManager.sporeResetSounds, 20, 1200, this); } stop(); var bounceSpawn = 'bouncerHazard'; var animPiece = 'Sporeworm1Piece'; if (type == 2) { bounceSpawn = 'bouncerBullet'; animPiece = 'Sporeworm2Piece'; } var moveVector = {'x': 0, 'y': 0}; var terrain = _root.terrain; var slopeCheckSpread = 7; var slopeCheckSpreadRandomization = 3; var slopeCheckMaxSteps = 50; var spawnArray = new Array(); var startPosition = {'x': _x, 'y': _y}; var startRotation = _rotation; var lastStablePosition = {'x': _x, 'y': _y}; var lastStableRotation = _rotation; var waitingForRespawn = false; var lastPieces = new Array(); var savedPositions = new Array(); var pieceArraySize = 3; var maxTeleport = 120; var boundaryPerp; var respawned = false; var brainScrambledTimer = 0; var timeStopped = false; var spawnedObjects = _root.guy.spawnedObjects; var audioManager = _root.audioManager; rotateBouncer(); var graphicStartFrame = 1; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 1; var speed = 4; var spawnLimit = 3; } } instance linkbug1 of movieClip 1025 { onClipEvent (load) { var myItem = 5; var bugType = 1; } } instance linkspore1 of movieClip 1027 { onClipEvent (load) { var type = 1; var speed = 4; var spawnLimit = 10; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } movieClip 1032 { frame 1 { stop(); } frame 4 { _parent._parent.isBall = false; } frame 5 { _parent._parent.isBall = true; gotoAndStop(1); } } movieClip 1033 { frame 1 { stop(); } frame 27 { gotoAndPlay(2); } } movieClip 1034 { frame 1 { stop(); this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { play(); } }; } frame 2 { function pauseCheck() { if (_root.gamePaused) { if (animating) { stop(); } } else { if (animating) { play(); } } } function doCollisionStuff() { bounced = true; fallSpeed *= -0.5; if (Math.abs(fallSpeed) + hitPush < 4) { fallSpeed = 0; grounded = true; hitPushActive = false; groundedSinceLastReset = true; } graphic.stop(); if (hitpush > 4) { hitpush *= 0.5; } else { hitPush = 2; } rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var v1 = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(v1); } function rotatellCorIntoPosition() { var v2 = 0; for (;;) { if (!(!terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v2 < 360 / slopeCheckStep)) break; llCor = _root.rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v2; } v2 = 0; for (;;) { if (!(terrain.hitTest2(_x + llCor.x, _y + llCor.y, true) && v2 < 360 / slopeCheckStep)) break; llCor = _root.rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v2; } } function rotatelrCorIntoPosition() { i = 0; for (;;) { if (!(!terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = _root.rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++i; } i = 0; for (;;) { if (!(terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = _root.rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++i; } } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = _root.rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = _root.rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); } function resetToLastGrounded() { if (groundedSinceLastReset) { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); glerpRotation = lastGroundedRotation; } else { _x = spawnPoint.x; _y = spawnPoint.y; rotateGuy(spawnRotation); glerpRotation = _root.stageManager.pslots[power - 1]._rotation; } bounced = true; graphic.stop(); offScreenTimer = 0; forwardNormal = {'x': Math.cos(_rotation * 0.0174532925199433), 'y': Math.sin(_rotation * 0.0174532925199433)}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); grounded = terrain.hitTest2(_x + gravityNormal.x * groundCheckDistance, _y + gravityNormal.y * groundCheckDistance, true); i = 0; for (;;) { if (!(terrain.hitTest2(_x, _y, true) && i < 10000)) break; _x = _x + gravityNormal.x; _y = _y + gravityNormal.y; ++i; } if (grounded) { activeTimer = 20; } else { activeTimer = 5; } gotoAndPlay(3); fallSpeed = 0; groundedSinceLastReset = grounded; } function getHit(colX, colY, strength) { if (strength > dribbleStrength) { if (!timeStopped) { graphic.play(); } if (!_root.guy.grounded) { hitPush += strength * 0.7; strength += _root.guy.downForce * 0.4; } } if (grounded) { grounded = false; } else { rotateGuy(_root.guy._rotation); } fallSpeed *= -0.3; fallSpeed -= strength; _x = _x + gravityNormal.x * (groundCheckDistance + 2); _y = _y + gravityNormal.y * (groundCheckDistance + 2); var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { hitPushDirection = -1; } else { hitPushDirection = 1; } } else { if (facingLeft) { hitPushDirection = 1; } else { hitPushDirection = -1; } } hitPushActive = true; bounced = false; } animating = true; var activeTimer = 30; var isBall = true; var hitPush = 2; var hitPushDirection = -1; var hitPushActive = true; var dribbleStrength = 3; var terrain = _root.terrain; var grounded = false; var groundCheckDistance = 5; var slopeCheckDistance = 15; var slopeCheckStep = 5; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance; var llCor = _root.rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); var lrCor = _root.rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var groundedSinceLastReset = false; var gravityNormal = {'x': 0, 'y': -1}; gravityNormal = _root.rotatePointAroundOrigin(0, -1, _rotation); var bounced = false; var forwardNormal = _root.rotatePointAroundOrigin(1, 0, _rotation); var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 8; var glerpNormal = {'x': 0, 'y': -1}; var fallSpeed = 0; var fallAccel = 0.4; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var usingBoundary = true; var offScreenTimer = 0; var possibleStuckInWorldFlag = 0; var timeStopped = false; this.onEnterFrame = function () { pauseCheck(); if (!_root.gamePaused) { shouldUpdate = false; if (this._parent.hitTest(_root.actionWindow)) { shouldUpdate = true; } if (!grounded) { shouldUpdate = true; } if (shouldUpdate) { if (!timeStopped) { if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; } var v4 = _x; var v3 = _y; if (activeTimer > 0) { --activeTimer; } else { if (!_root.guy.reclaimCharged && !_root.guy.reclaimSwinging) { if (_root.distanceBetweenObjects(this, _root.guy) < 30) { getHit(_root.guy._x, _root.guy._y, dribbleStrength); } } if (_root.scramblantAttachPoint.hitTest(_x, _y, true)) { graphic.ballType.nextFrame(); activeTimer = 30; } } if (!terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) && !terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { grounded = false; } else {} if (grounded) { lastGroundedPosition = {'x': _x, 'y': _y}; lastGroundedRotation = _rotation; if (gravityLerping) { lastGroundedRotation = glerpRotation; } } else { fallSpeed += fallAccel; if (Math.abs(_root.getRotationDiff(_rotation, _root.guy._rotation)) > 90) { if (fallSpeed < 0 && !bounced) { gravityNormal = _root.rotatePointAroundOrigin(0, -1, _root.guy._rotation); } } if (gravityLerping) { glerpNormal = _root.rotatePointAroundOrigin(0, -1, glerpRotation); _x = _x - glerpNormal.x * fallSpeed; _y = _y - glerpNormal.y * fallSpeed; } else { _x = _x - gravityNormal.x * fallSpeed; _y = _y - gravityNormal.y * fallSpeed; } if (hitPushActive) { _x = _x + forwardNormal.x * hitPush * hitPushDirection; _y = _y + forwardNormal.y * hitPush * hitPushDirection; } if (terrain.hitTest2(_x + gravityNormal.x * hitHeight, _y + gravityNormal.y * hitHeight, true)) { rotateGuy(_rotation + 180); doCollisionStuff(); } if (terrain.hitTest2(_x + llCor.x - gravityNormal.x * groundCheckDistance, _y + llCor.y - gravityNormal.y * groundCheckDistance, true) || terrain.hitTest2(_x + lrCor.x - gravityNormal.x * groundCheckDistance, _y + lrCor.y - gravityNormal.y * groundCheckDistance, true)) { doCollisionStuff(); } } if (usingBoundary) { if (_root.checkOutOfBounds(_x, _y)) { if (_root.distanceBetweenPoints(_x, _y, lastGroundedPosition.x, lastGroundedPosition.y) < 100) { lastGroundedPosition.x *= 0.98; lastGroundedPosition.y *= 0.98; trace('walk in'); } resetToLastGrounded(); } } else { if (!terrain.hitTest(this)) { ++offScreenTimer; if (offScreenTimer > 200) { resetToLastGrounded(); } } else { offScreenTimer = 0; } } if (terrain.hitTest2(_x, _y, true) && terrain.hitTest2(_x + gravityNormal.x * 10, _y + gravityNormal.y * 10, true) && terrain.hitTest2(_x - gravityNormal.x * 10, _y - gravityNormal.y * 10, true)) { if (possibleStuckInWorldFlag < 3) { ++possibleStuckInWorldFlag; } else { resetToLastGrounded(); trace('stuckball'); } } else { possibleStuckInWorldFlag = 0; } if (terrain.hitTestHazard(_x, _y, true)) { resetToLastGrounded(); } } } } }; } frame 3 { play(); } frame 10 { animating = false; stop(); } } movieClip 1036 { } instance of movieClip 1036 { onClipEvent (load) { var triggeredText = false; } onClipEvent (enterFrame) { if (this.hitTest(_root.guy)) { if (!triggeredText) { triggeredText = true; _root.tutorialText.gotoAndPlay('friend'); com.newgrounds.API.unlockMedal('Hello'); } } } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 8; var bugType = 1; } } movieClip 1038 { } movieClip 1039 { } movieClip 1040 { frame 1 { stop(); } } movieClip 1081 { } movieClip 1114 { } movieClip 1116 { } movieClip 1117 { } movieClip 1118 { } movieClip 1119 { } movieClip 1136 { } movieClip 1138 { frame 1 { stop(); } } movieClip 1141 { frame 1 { stop(); } } movieClip 1143 { frame 1 { _parent.collisionPoints.push(this); } } movieClip 1144 { frame 1 { var sleepables = _root.stageManager.sleepables; sleepables.push(this); var mySleepableID = sleepables.length - 1; stop(); _visible = false; this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { _visible = true; play(); } }; } frame 2 { function activateThis() { if (!active && !animating) { gotoAndPlay('startActive'); particleTimer = 0; determinePotentialTargets(); } } function die(killer) { deathPoint.x = killer._x - 90; deathPoint.y = killer._y - 60; gotoAndPlay('die'); } function determinePotentialTargets() { if (targetCategory == 1) { target = _root.guy; foundTarget = true; } else { if (targetCategory == 2) { potentialTargets = _root.stageManager.activeBugs; findTarget(); } else { if (targetCategory == 3) { potentialTargets = _root.stageManager.sleepables; findTarget(); } else { if (targetCategory == 4) { potentialTargets = _root.stageManager.spores; findTarget(); } else { if (targetCategory == 5) { potentialTargets = undefined; findTarget(); } } } } } } function findTarget() { var v5 = noticeDistance; var v6; if (foundTarget) { v6 = target; } if (targetCategory == 5) { if (_root.soccerball.isBall) { var v4 = _root.distanceBetweenObjects(this, _root.soccerball); if (v4 < v5) { target = _root.soccerball; foundTarget = true; } } } else { var v3 = 0; while (v3 < potentialTargets.length) { if (potentialTargets[v3] != this) { var v4 = _root.distanceBetweenObjects(this, potentialTargets[v3]); if (v4 < v5) { v5 = v4; v6 = potentialTargets[v3]; foundTarget = true; } } ++v3; } if (target != v6) { target = v6; } } } function resetToSpawnPoint() { _x = spawnPoint.x; _y = spawnPoint.y; _rotation = spawnRotation; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); active = false; var v1 = 0; for (;;) { if (!(terrain.hitTest2(_x, _y, true) && v1 < 10000)) break; _x = _x + gravityNormal.x; _y = _y + gravityNormal.y; ++v1; } gotoAndStop('sleeping'); _visible = true; animating = false; } function updateCloudPoint(attachPoint, cloud, cloudxy, snappiness) { var v2 = {'x': cloudxy.x, 'y': cloudxy.y}; var v3 = {'x': 0, 'y': 0}; attachPoint.localToGlobal(v3); v2.x += (v3.x - v2.x) * snappiness; v2.y += (v3.y - v2.y) * snappiness; this.globalToLocal(v2); cloud._x = v2.x; cloud._y = v2.y; v2 = {'x': cloud._x, 'y': cloud._y}; this.localToGlobal(v2); cloudxy.x = v2.x; cloudxy.y = v2.y; } function setDontHit(dontHitTime) { dontHit = true; dontHitTimer = dontHitTime; } function endDontHit() { dontHit = false; this._visible = true; } function getHit(colX, colY) { if (!active) { activateThis(); } else { if (!dontHit) { var v4 = 12; var v3 = {'x': colX - guy._x, 'y': colY - guy._y}; v3 = _root.normalizeVector(v3.x, v3.y); if (!foundTarget) { v4 = 0; } inertia.x = v3.x * v4; inertia.y = v3.y * v4; hitPushTimer = 40; setDontHit(80); } } audioManager.triggerNonrepeatingProximitySound('prevRedguyHurt', 'redguy hurt sound', audioManager.redguyHurtSounds, 20, 500, this); } function tryParticle() { if (!active) { if (particleTimer <= 0) { var v3 = _root.rotatePointAroundOrigin(32, -32, _root.camera._rotation); v3.x += _x; v3.y += _y; var v5 = _root.itemsAttachPoint.attachMovie('particleZ', 'particle', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': v3.x, '_y': v3.y, '_rotation': _root.camera._rotation}); particleTimer = zParticleGenRate; } } else { if (particleTimer <= 0) { if (!watcher) { if (_root.distanceBetweenObjects(this, target) < 60) { var v3 = _root.rotatePointAroundOrigin(0, -40, _root.camera._rotation); v3.x += _x; v3.y += _y; var v5 = _root.itemsAttachPoint.attachMovie('particleHeart', 'particle', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': v3.x, '_y': v3.y, '_rotation': _root.camera._rotation}); particleTimer = heartParticleGenRate; } } else { if (_root.distanceBetweenObjects(this, target) < watcherAccelPoint) { var v3 = _root.rotatePointAroundOrigin(0, -35, _root.camera._rotation); v3.x += _x; v3.y += _y; var v5 = _root.itemsAttachPoint.attachMovie('particleSweat', 'particle', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': v3.x, '_y': v3.y, '_rotation': _root.camera._rotation}); particleTimer = sweatParticleGenRate; } } } } } stop(); if (noclip) { mask.gotoAndStop('noclip'); } var audioManager = _root.audioManager; var active = false; var distanceToActivate = 50; var target = undefined; var accel = 0.03; var percentDistance = 0.1; var minTopSpeed = 2; var maxTopSpeed = 8; var inertia = {'x': 0, 'y': 0}; var speed = 0; var beelinerBounceTimer = 0; var beelinerBounceTime = 3; var beelinerBouncing = false; var noticeDistance = 800; var potentialTargets; var foundTarget = false; var watcherAccelPoint = 140; if (seekingDistance == undefined) { if (watcher) { seekingDistance = 400; } else { var seekingDistance = 50; } } var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var slopeCheckSpread = 15; var slopeCheckSpreadRandomization = 3; var slopeCheckMaxSteps = 50; var hitWidth = 75; var dontHit = false; var donthitTimer = 0; var hitPushTimer = 0; var prevXY = {'x': _x, 'y': _y}; var zParticleGenRate = 100; var heartParticleGenRate = 10; var sweatParticleGenRate = 14; var particleTimer = 0; var animating = false; var killed = false; var guy = _root.guy; var collisionPoints = new Array(); var terrain = _root.terrain; var bounciness = 0.9; var timeStopped = false; var sleepTimer = 0; var timeBetweenSnores = 180; var cloud1xy = {'x': cloud1._x, 'y': cloud1._y}; this.localToGlobal(cloud1xy); var cloud2xy = {'x': cloud2._x, 'y': cloud2._y}; this.localToGlobal(cloud2xy); var cloud3xy = {'x': cloud3._x, 'y': cloud3._y}; this.localToGlobal(cloud3xy); targetIcon.gotoAndStop(targetCategory); var deathPoint = {'x': 0, 'y': 0}; this.onEnterFrame = function () { if (!_root.gamePaused) { if (!timeStopped) { if (particleTimer > 0) { --particleTimer; } tryParticle(); var v29 = {'x': _x - guy._x, 'y': _y - guy._y}; var v36 = Math.sqrt(v29.x * v29.x + v29.y * v29.y); if (active) { prevXY = {'x': _x, 'y': _y}; if (targetCategory != 1) { if (!foundTarget || fickle) { findTarget(); } } else { foundTarget = true; } if (hitPushTimer > 0) { --hitPushTimer; inertia.x *= 0.9300000000000001; inertia.y *= 0.9300000000000001; } else { if (targetCategory == 5) { if (!_root.soccerball.isBall) { foundTarget = false; target = undefined; } } if (!beeliner) { if (foundTarget) { var v35 = {'x': target._x - _x, 'y': target._y - _y}; var v33 = Math.sqrt(v35.x * v35.x + v35.y * v35.y); var v37 = {'x': (v35.x / v33) * seekingDistance, 'y': (v35.y / v33) * seekingDistance}; if (watcher) { if (v33 < watcherAccelPoint) { accel = 0.08; } else { accel = 0.001; } } xDelta = target._x - (_x + v37.x); yDelta = target._y - (_y + v37.y); var v41 = xDelta * accel; var v43 = yDelta * accel; inertia.x += v41; inertia.y += v43; var v39 = Math.sqrt(xDelta * xDelta + yDelta * yDelta); var v32 = v39 * percentDistance; v32 = Math.max(v32, minTopSpeed); v32 = Math.min(v32, maxTopSpeed); if (topSpeedMultiplier != undefined) { v32 *= topSpeedMultiplier; } speed = Math.sqrt(inertia.x * inertia.x + inertia.y * inertia.y); if (speed > v32) { inertia.x *= v32 / speed; inertia.y *= v32 / speed; } } else { inertia.x *= 0.98; inertia.y *= 0.98; } } else { if (foundTarget) { var v32 = 5; if (topSpeedMultiplier != undefined) { v32 *= topSpeedMultiplier; } var v31 = 0.9; speed += 0.1; var v35 = {'x': target._x - _x, 'y': target._y - _y}; var v44 = Math.atan2(v35.y, v35.x) * _root.rad2Deg; var v42 = _root.getRotationDiff(aim._rotation, v44); var v40 = v42 * 0.2; if (!beelinerBouncing) { aim._rotation += v40; } var v30 = _root.rotatePointAroundOrigin(1, 0, aim._rotation); var v34 = {'x': v30.x * speed, 'y': v30.y * speed}; inertia.x += v30.x * accel; inertia.y += v30.y * accel; inertia.x = inertia.x * v31 + v34.x * (1 - v31); inertia.y = inertia.y * v31 + v34.y * (1 - v31); calcSpeed = Math.sqrt(inertia.x * inertia.x + inertia.y * inertia.y); if (calcSpeed > v32) { inertia.x *= v32 / calcSpeed; inertia.y *= v32 / calcSpeed; } if (beelinerBouncing) { --beelinerBounceTimer; if (beelinerBounceTimer <= 0) { beelinerBouncing = false; } } } else { inertia.x *= 0.98; inertia.y *= 0.98; } } } if (!noclip) { var v7 = 0; while (v7 < collisionPoints.length) { var v3 = {'x': 0, 'y': 0}; collisionPoints[v7].localToGlobal(v3); _root.globalToLocal(v3); if (terrain.hitTest2(v3.x, v3.y, true)) { audioManager.triggerNonrepeatingProximitySound('prevRedguySound', 'redguy sound', audioManager.redguySounds, 10, 1000, this); var v19 = slopeCheckSpread + Math.random(slopeCheckSpreadRandomization); var v16 = Math.atan2(collisionPoints[v7]._y, collisionPoints[v7]._x) * _root.rad2Deg + 90; var v12 = {'x': (-collisionPoints[v7]._x / 37) * 3, 'y': (-collisionPoints[v7]._y / 37) * 3}; eye._x = (_root.rotatePointAroundOrigin(37, 0, v16)).x; eye._y = (_root.rotatePointAroundOrigin(37, 0, v16)).y; var v5 = _root.rotatePointAroundOrigin(-v19, 0, v16); var v4 = _root.rotatePointAroundOrigin(v19, 0, v16); v5.x += v3.x; v5.y += v3.y; v4.x += v3.x; v4.y += v3.y; var v14 = 1; var v15 = 1; var v18 = true; var v17 = true; if (!terrain.hitTest2(v5.x, v5.y, true)) { v14 *= -1; v18 = false; } if (!terrain.hitTest2(v4.x, v4.y, true)) { v15 *= -1; v17 = false; } var v28 = inertia; var v10 = 0; while (v10 < slopeCheckMaxSteps + 1) { v5.x += v12.x * v14; v5.y += v12.y * v14; if (terrain.hitTest2(v5.x, v5.y, true) != v18) { break; } if (v10 == slopeCheckMaxSteps) { v5 = {'x': v3.x, 'y': v3.y}; } ++v10; } var v9 = 0; while (v9 < slopeCheckMaxSteps + 1) { v4.x += v12.x * v15; v4.y += v12.y * v15; if (terrain.hitTest2(v4.x, v4.y, true) != v17) { break; } if (v9 == slopeCheckMaxSteps) { v4 = {'x': v3.x, 'y': v3.y}; } ++v9; } var v27 = v5.y - v4.y; var v25 = v5.x - v4.x; var v24 = Math.atan2(v27, v25) * _root.rad2Deg + 180; var v26 = v24 + (v24 - aim._rotation); aim._rotation = v26; var v20 = _root.rotatePointAroundOrigin(1, 0, aim._rotation); inertia.x = v20.x; inertia.y = v20.y; var v8 = {'x': -(collisionPoints[v7]._x / 37), 'y': -(collisionPoints[v7]._y / 37)}; var v21 = 3; var v11 = 1; while (v11 < speed + 10) { var v6 = v11 * v21; var v13 = {'x': v3.x + v8.x * v6 + inertia.x, 'y': v3.y + v8.y * v6 + inertia.y}; if (!terrain.hitTest2(v13.x, v13.y, true)) { _x = _x + v8.x * (v6 + 2); _y = _y + v8.y * (v6 + 2); break; } else {} ++v11; } if (beeliner && hitPushTimer <= 0) { beelinerBouncing = true; beelinerBounceTimer = beelinerBounceTime; } break; } ++v7; } } _x = _x + inertia.x; _y = _y + inertia.y; if (_root.distanceBetweenPoints(_x, _y, prevXY.x, prevXY.y) > 50) { setDontHit(180); trace('reminder: make the thought bubble not blink when you do the final art'); } } else { if (!animating) { if (v36 < distanceToActivate) { activateThis(); } ++sleepTimer; if (sleepTimer == timeBetweenSnores) { sleepTimer = +_root.randomInt(0, 60); audioManager.triggerNonrepeatingProximitySound('prevSleepSound', 'sleep sound', audioManager.sleepSounds, 20, 900, this); } } } if (!active) { cloudPoints._rotation = Math.atan2(_y - guy._y, _x - guy._x) * 57.29577951308232 - 90; var v38 = 400; cloudPoints._rotation += 180 * (Math.max(v38 - v36, 0) / v38); } else { cloudPoints._rotation = Math.atan2(_y - guy._y, _x - guy._x) * 57.29577951308232 + 90; } updateCloudPoint(cloudPoints.point1, cloud1, cloud1xy, 0.6); updateCloudPoint(cloudPoints.point2, cloud2, cloud2xy, 0.2); updateCloudPoint(cloudPoints.point3, cloud3, cloud3xy, 0.1); targetIcon._x = cloud3._x; targetIcon._y = cloud3._y; targetIcon._rotation = _root.camera._rotation; } if (active) { if (!dontHit) { _root.checkGuyHit(_x, _y, hitWidth, 'CORNERS'); } else { if (dontHitTimer % 2 == 0) { if (this._visible) { this._visible = false; } else { this._visible = true; } } if (timeStopped) { if (dontHitTimer % 4 == 0) { dontHitTimer += 4; } } } if (dontHitTimer > 0) { --dontHitTimer; if (dontHitTimer <= 0) { dontHitTimer = 0; endDontHit(); } } } } }; } instance targetIcon of movieClip 1138 { onClipEvent (load) { var animatingRoll = false; var rollAnimationTimer = 0; } onClipEvent (enterFrame) { if (!animatingRoll) { var globalXY = {'x': 0, 'y': 0}; this.localToGlobal(globalXY); _root.globalToLocal(globalXY); if (_root.scramblantAttachPoint.hitTest(globalXY.x, globalXY.y, true)) { animatingRoll = true; rollAnimationTimer = 26; _parent.target = _root.guy; _parent.foundTarget = false; ++_parent.targetCategory; if (_parent.targetCategory > _totalframes) { _parent.targetCategory = 1; } _parent.determinePotentialTargets(); } } else { --rollAnimationTimer; if (rollAnimationTimer <= 0) { animatingRoll = false; gotoAndStop(_parent.targetCategory); } else { if (rollAnimationTimer % 2 == 0) { gotoAndStop(_root.randomInt(1, _totalframes)); } } } } } instance itemPoint of movieClip 1007 { onClipEvent (load) { function setItemActive() { if (_parent.myItem != 0) { itemMC.setActive(); itemMC.target = _root.guy; audioManager.triggerSound('get Thing sound', new Array('getThing'), 30); } } function resetItemToTarget() { if (!itemMC.active) { if (_parent.myItem != 0) { var v2 = {'x': _x, 'y': _y}; _parent.localToGlobal(v2); itemMC._parent.globalToLocal(v2); itemMC._x = v2.x; itemMC._y = v2.y; } } } var xCoord = _x; var yCoord = _y; if (_parent.myItem != 0) { var itemXY = {'x': itemPoint._x, 'y': itemPoint._y}; if (!itemMC) { var itemMC = _root.itemsAttachPoint.attachMovie('AllSeed', 'seed', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + _parent._x, '_y': _y + _parent._y}); itemMC.active = false; itemMC.target = this; itemMC.gotoAndStop(_parent.myItem); } } } onClipEvent (enterFrame) { var thisFrameXY = _root.rotatePointAroundOrigin(xCoord, yCoord, _root.camera._rotation); _x = thisFrameXY.x; _y = thisFrameXY.y; } } frame 3 { stop(); } frame 4 { animating = true; _root.audioManager.triggerSound('screech sound', new Array('doug.wav'), 2); audioManager.triggerNonrepeatingProximitySound('prevRedguyHurt', 'redguy hurt sound', audioManager.redguyHurtSounds, 20, 500, this); } frame 30 { active = true; setDontHit(120); } frame 31 { stop(); animating = false; if (watcher) { aim.gotoAndStop('worried'); } } frame 32 { animating = true; killed = true; this._visible = true; var i = 0; while (i < sleepables.length) { if (sleepables[i] == this) { sleepables.splice(i, 1); break; } ++i; } this.onEnterFrame = function () { _x = _x + (deathPoint.x - _x) * 0.1; _y = _y + (deathPoint.y - _y) * 0.1; }; if (noclip) { com.newgrounds.API.unlockMedal('Clippy'); } else { if (watcher) { com.newgrounds.API.unlockMedal('Sweaty'); } else { com.newgrounds.API.unlockMedal('Scribbly'); } } } frame 65 { itemPoint.setItemActive(); } frame 67 { stop(); } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 1; var myItem = 4; var watcher = false; var beeliner = true; var noclip = false; var fickle = false; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 2; var myItem = 6; var watcher = false; var beeliner = true; var noclip = true; var fickle = false; var topSpeedMultiplier = 2; } } instance linkfollower2 of movieClip 1144 { onClipEvent (load) { var targetCategory = 1; var myItem = 8; var watcher = false; var beeliner = true; var noclip = false; var fickle = false; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 4; var myItem = 5; var watcher = false; var beeliner = true; var noclip = false; var fickle = true; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 4; var myItem = 4; var watcher = true; var beeliner = false; var noclip = true; var fickle = true; } } movieClip 1147 { } movieClip 1151 { } movieClip 1153 { frame 1 { stop(); } } movieClip 1154 { frame 1 { stop(); _visible = false; this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { _visible = true; play(); } }; } frame 2 { function triggerTetherWarningSound(distance) { var v4 = distance - prevDistance; var v3 = 'ropeTick4'; if (v4 > 5) { v3 = 'ropeTick'; } else { if (v4 > 4) { v3 = 'ropeTick2'; } else { if (v4 > 2) { v3 = 'ropeTick3'; } } } _root.audioManager.triggerProximitySound('Tether Warning Sound', new Array(v3), 7 * ((distance - warningScale) / (maxScale - warningScale)) + 3, 3000, this); } function onEnterFrame() { var v3 = _root.distanceBetweenObjects(target1, target2); this._yscale = v3 / (graphicScale / 100); this._xscale = minWidth + (maxWidth - minWidth) * ((maxScale - v3) / maxScale); _x = (target1._x + target2._x) / 2; _y = (target1._y + target2._y) / 2; _rotation = Math.atan2(target1._y - target2._y, target1._x - target2._x) * _root.rad2Deg + 90; if (v3 >= warningScale) { if (!hitWarning) { hitWarning = true; triggerTetherWarningSound(v3); prevSoundTriggerDistance = v3; } else { if (v3 < prevSoundTriggerDistance) { v3 = prevSoundTriggerDistance; } else { if (v3 > prevSoundTriggerDistance + soundTriggerIncrement) { prevSoundTriggerDistance = v3; triggerTetherWarningSound(v3); } } } } else { hitWarning = false; } if (v3 >= maxScale) { _root.despawnFX(target1._x, target1._y); _root.despawnFX(target2._x, target2._y); target1.resetToSpawnPoint(); target2.resetToSpawnPoint(); this._xscale = 20; _root.attachMovie('TetherBreakFX', 'tether break', _root.getNextHighestDepth(), {'_x': this._x, '_y': this._y, '_xscale': this._xscale, '_yscale': this._yscale, '_rotation': this._rotation}); _root.audioManager.triggerProximitySound('Tether Break Sound', new Array('ropeBreak'), 10, 3000, this); hitWarning = false; } else { anim.gotoAndStop(Math.round((v3 / maxScale) * animFrames)); } if (target1.killed || target2.killed) { _root.despawnFX(target1._x, target1._y); _root.despawnFX(target2._x, target2._y); this._xscale = 20; hitWarning = false; this.gotoAndStop(3); } if (!this.hitTest(_root.actionWindow)) { _visible = false; } else { _visible = true; } prevDistance = v3; } if (maxScale == undefined) { var maxScale = 1000; } var graphicScale = 200; var animFrames = 500; var maxWidth = 60; var minWidth = 5; var warningScale = maxScale * 0.8; var hitWarning = false; var prevSoundTriggerDistance; var soundTriggerIncrement = 9; var prevDistance = _root.distanceBetweenObjects(target1, target2); stop(); } frame 3 { function onEnterFrame() {} } } instance of movieClip 1154 { onClipEvent (load) { var target1 = _root.linkbug1; var target2 = _root.linkspore1; } } instance linkfollower1 of movieClip 1144 { onClipEvent (load) { var targetCategory = 2; var myItem = 7; var watcher = false; var beeliner = false; var noclip = true; var fickle = false; } } instance of movieClip 1154 { onClipEvent (load) { var target1 = _root.linkfollower1; var target2 = _root.linkfollower2; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 1; var myItem = 6; var watcher = false; var beeliner = true; var noclip = true; var fickle = false; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 5; var myItem = 4; var watcher = true; var beeliner = false; var noclip = false; var fickle = false; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 2; var bugType = 3; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 1; var myItem = 4; var watcher = true; var beeliner = false; var noclip = false; var fickle = false; } } movieClip 1156 { frame 2 { stop(); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(2); } } movieClip 1158 { frame 2 { stop(); } } movieClip 1159 { frame 1 { stop(); } } movieClip 1160 { frame 2 { stop(); } } movieClip 1162 { } movieClip 1164 { } movieClip 1165 { frame 1 { stop(); var wentin = false; var distanceToTrigger = 20; var spinSpeed = 1; var spinAccel = 0.1; var spinAccelAccel = 0.0015; if (!_root.mainLevel) { distanceToTrigger = 50; } onEnterFrame = function () { if (!wentin) { if (_root.distanceBetweenObjects(this, _root.guy) < distanceToTrigger) { _root.nextLoadedScene = myLevel; _root.fader.gotoAndPlay('fadeout'); wentin = true; _root.TriggerCutscene(400, this); play(); if (!_root.mainLevel) { trace(myWeapon); _root.powerupCutscene = true; _root.unlockedPowerup = myWeapon; } _root.audioManager.triggerSound('zoop sound', new Array('zoop'), 3); } } else { _rotation = _rotation - spinSpeed; spinAccel += spinAccelAccel; spinSpeed += spinAccel; if (_root.camera.rotationSmoothing < 1) { _root.camera.rotationSmoothing += 0.01; } } }; } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'level2'; } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'level4'; } } movieClip 1177 { } movieClip 1178 { frame 1 { var placed = false; if (_root.mainLevel && _root.mainFlagPlaced) { _x = _root.mainFlagPosition.x; _y = _root.mainFlagPosition.y; _rotation = _root.mainFlagRotation; placed = true; } else { _visible = false; } placeFlag = function (xPos, yPos, rot) { _x = xPos; _y = yPos; _rotation = rot; _visible = true; placed = true; if (_root.mainLevel) { _root.mainFlagPosition.x = _x; _root.mainFlagPosition.y = _y; _root.mainFlagRotation = _rotation; _root.mainFlagPlaced = true; } }; } } instance finalLevel of movieClip 1165 { onClipEvent (load) { var myLevel = 'level3'; } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'level1'; } } movieClip 1181 { frame 58 { gotoAndPlay('loop'); } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.2) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } if (_root.gameEnding) { _alpha = _alpha - 0.1; } } } } movieClip 1183 { } movieClip 1184 { frame 1 { stop(); } } movieClip 1187 { } movieClip 1189 { frame 14 { _root.guy.reclaimCharged = true; } frame 20 { stop(); } } movieClip 1190 { frame 1 { stop(); } } movieClip 1191 { frame 1 { function onEnterFrame() { if (!_root.gamePaused) { if (active && !animating) { animating = true; } if (animating) { var v4 = {'x': 0, 'y': 0}; attachPoint.localToGlobal(v4); _root.globalToLocal(v4); if (_root.guy.DestroyCheck(v4.x, v4.y) || _root.guy.HitHittablesCheck(v4.x, v4.y)) { doHitStuff(); } else { var v3 = {'x': 0, 'y': 0}; attachPoint2.localToGlobal(v3); _root.globalToLocal(v3); if (_root.guy.DestroyCheck(v3.x, v3.y) || _root.guy.HitHittablesCheck(v3.x, v3.y)) { doHitStuff(); } } } else { if (hitPauseTimer > 0) { --hitPauseTimer; if (hitPauseTimer == 0) { _root.guy.reclaimSwinging = false; _parent.gotoAndStop(1); } } } } else { if (animating) { animating = false; } } } function doHitStuff() { stop(); pickaxe.play(); active = false; animating = false; hitPauseTimer = hitPauseFrames; } animating = true; active = true; hitPauseFrames = 4; hitPauseTimer = 0; } frame 17 { stop(); _root.guy.reclaimSwinging = false; _parent.gotoAndStop(1); } } movieClip 1193 { } movieClip 1194 { frame 21 { _parent.gotoAndStop(1); } } movieClip 1196 { } movieClip 1197 { frame 8 { stop(); } } movieClip 1198 { frame 1 { stop(); } } movieClip 1200 { } movieClip 1214 { frame 192 { gotoAndPlay('loopPoint'); } } movieClip 1219 { frame 1 { onEnterFrame = function () { _root.guy.arm._rotation = _rotation; var v3 = {'x': 0, 'y': 0}; this.localToGlobal(v3); _root.guy.globalToLocal(v3); _root.guy.arm._x = v3.x; _root.guy.arm._y = v3.y; }; onUnload = function () { _root.guy.arm._rotation = 0; _root.guy.arm._x = 0; _root.guy.arm._y = -15; }; } } movieClip 1225 { frame 32 { stop(); } } movieClip 1236 { frame 76 { gotoAndPlay('loopPoint'); } } movieClip 1252 { } movieClip 1256 { } movieClip 1257 { frame 25 { stop(); } } movieClip 1258 { } movieClip 1263 { frame 19 { stop(); if (_root.guy.fallTime > 50) { _root.guy.gotoAndStop('falling'); } } } movieClip 1272 { frame 1 { play(); } frame 50 { stop(); } } movieClip 1280 { frame 192 { gotoAndPlay('loopPoint'); } } movieClip 1281 { frame 1 { stop(); } frame 8 { if (grounded) { if (runSpeed != 0) { gotoAndStop('walking'); } else { gotoAndStop('idle'); } } else { gotoAndStop('fall'); } } frame 9 { gotoAndStop('hit'); } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function discardWeapon() { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var v2 = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); v2.power = weapon; v2.graphicMC.gotoAndStop(weapon); weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(v2); } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { if (controlArrestTimer <= 0) { controlArrested = true; controlArrestTimer = 5; } else { controlArrested = false; _x = _x + (Math.random() - 0.5); _y = _y + (Math.random() - 0.5); trace('jostle'); } } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; touchedGroundSinceHitHazard = true; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var noShiftCounter = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7', 'gs8']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; if (!_root.mainLevel) { weapon = _root.heldWeapon; } var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.hud.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var touchedGroundSinceHitHazard = true; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { if (Key.getCode() >= 65 && Key.getCode() <= 90) { _root.selectedLetter = Key.getCode() - 64; } else { if (Key.getCode() >= 97 && Key.getCode() <= 122) { _root.selectedLetter = Key.getCode() - 96; } } if (!_root.releaseBuild) { if (Key.isDown(49)) { weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(50)) { weapon = 2; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(51)) { weapon = 3; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(52)) { weapon = 4; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(53)) { weapon = 5; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(57)) { _root.TriggerCutscene(100, this); } if (Key.isDown(17)) { _root.nextLoadedScene = 'level3'; _root.Die(); } } } if (weapon != 5) { if (invincibleTimer > 0) { --invincibleTimer; } if (invincibleTimer == 0 && invincible) { setVincible(); } } else { invincible = true; invincibleTimer = 0; guyMask.gotoAndStop('solid'); } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x, _y, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; var respawnIfHitHazard = !touchedGroundSinceHitHazard && !invincible; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true) && !invincible) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true) && !invincible) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; touchedGroundSinceHitHazard = false; if (respawnIfHitHazard) { respawn(); } } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } audioManager.triggerNonrepeatingSound('prevPlatSound', 'platSound', audioManager.platSounds, 5); } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 3) { arm.gotoAndStop('spray'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } else { if (weapon == 3) { arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { discardWeapon(); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } var distanceFromCenter = _root.distanceBetweenPoints(_x, _y, 0, 0); if (weapon == 5) { if (distanceFromCenter > 5000) { _root.gameEnding = true; _root.actionWindow.gotoAndStop('static'); _root.Inventory._alpha -= 0.1; _root.hud._alpha -= 0.1; _root.beatenGameOnce = true; _root.saveGame(); com.newgrounds.API.unlockMedal('Pink Prison'); if (_root.hardcoreGame) { com.newgrounds.API.unlockMedal('Lucid Dreamer'); } } if (distanceFromCenter > 8000) { controlArrested = true; controlArrestTimer = 99999; runSpeed = 0; hitPush = 0; } if (distanceFromCenter > 12000) { if (_xscale < 1) { _root.flippedEndingGuy = true; } _root.animHookupFrame = anim._currentframe; trace(_root.animHookupFrame); _root.gotoAndPlay('ending'); } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } movieClip 1284 { frame 1 { stop(); } } instance flagIndicator of movieClip 1284 { onClipEvent (load) { function startTrackingFlag() { target = _root.flag; _visible = true; gotoAndStop('flag'); updatePosition(); if (!_root.flagIndicatorEnabled && _visible) { _visible = false; } } function startTrackingPowerup(newTarget) { target = newTarget; gotoAndStop('powerup'); _visible = true; updatePosition(); if (!_root.flagIndicatorEnabled && _visible) { _visible = false; } } function endTrackingPowerup() { if (_root.flag.placed) { target = _root.flag; gotoAndStop('flag'); } else { target = undefined; _visible = false; } } function updatePosition() { var v2 = _root.rotatePointAroundOrigin(0, -15, guy._rotation); _x = guy._x + v2.x; _y = guy._y + v2.y; var v3 = Math.atan2(target._y - guy._y, target._x - guy._x) * 57.29577951308232 + 90; _rotation = _rotation + _root.getRotationDiff(_rotation, v3) * 0.2; } var guy = _root.guy; var target = undefined; _visible = false; if (_root.mainFlagPlaced && _root.mainLevel) { startTrackingFlag(); } } onClipEvent (enterFrame) { if (target == undefined) { if (_root.flag.placed) { startTrackingFlag(); } } else { updatePosition(); } if (!_root.flagIndicatorEnabled && _visible) { _visible = false; } } } movieClip 1285 { frame 1 { stop(); } instance of movieClip 705 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedLetter); } } instance of movieClip 705 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedLetter); } } } movieClip 1287 { frame 2 { stop(); } frame 10 { gotoAndStop(2); } frame 18 { gotoAndStop(2); } instance of movieClip 705 { onClipEvent (enterFrame) { gotoAndStop(_root.selectedLetter); } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3); var inventoryMax = 4; var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; var hasInfiniseed = false; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (!hasInfiniseed) { if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } } movieClip 1293 { } movieClip 1294 { frame 1 { stop(); } } movieClip 1296 { } movieClip 1297 { frame 1 { var globalXY = {'x': 0, 'y': 0}; this.localToGlobal(globalXY); _root.globalToLocal(globalXY); onEnterFrame = function () { eyeTarget = _parent._parent.eyeTarget; var v3 = {'x': eyeTarget._x - globalXY.x, 'y': eyeTarget._y - globalXY.y}; var v4 = Math.atan2(v3.y, v3.x) * _root.rad2Deg; graphic._rotation = v4; }; } } movieClip 1305 { } movieClip 1306 { frame 115 { gotoAndPlay('loopPoint'); } } movieClip 1322 { frame 1 { this.onEnterFrame = function () { if (!_root.gamePaused && !_parent.timeStopped) { play(); } else { stop(); } }; } } movieClip 1384 { frame 91 { _parent.gotoAndStop('rest'); } } movieClip 1433 { frame 91 { _parent.gotoAndStop('rest'); } } movieClip 1482 { frame 91 { _parent.gotoAndStop('rest'); } } movieClip 1483 { frame 1 { stop(); _visible = false; this.onEnterFrame = function () { if (!_root.checkOutOfBounds(this._x, this._y)) { _visible = true; play(); } }; } frame 2 { function updateCloudPoint(attachPoint, cloud, cloudxy, snappiness) { var v2 = {'x': cloudxy.x, 'y': cloudxy.y}; var v3 = {'x': 0, 'y': 0}; attachPoint.localToGlobal(v3); v2.x += (v3.x - v2.x) * snappiness; v2.y += (v3.y - v2.y) * snappiness; this.globalToLocal(v2); cloud._x = v2.x; cloud._y = v2.y; v2 = {'x': cloud._x, 'y': cloud._y}; this.localToGlobal(v2); cloudxy.x = v2.x; cloudxy.y = v2.y; } var guy = _root.guy; var stageManager = _root.stageManager; var audioManager = _root.audioManager; var defaultEatDistance = 60; var wakeDistance = 400; var restDistance = wakeDistance + 100; var eyeTarget = undefined; var resting = true; var cloud1xy = {'x': cloud1._x, 'y': cloud1._y}; this.localToGlobal(cloud1xy); var cloud2xy = {'x': cloud2._x, 'y': cloud2._y}; this.localToGlobal(cloud2xy); var cloud3xy = {'x': cloud3._x, 'y': cloud3._y}; this.localToGlobal(cloud3xy); targetIcon.gotoAndStop(targetCategory); this.onEnterFrame = function () { if (!_root.gamePaused) { if (targetCategory == 1) { } else { if (targetCategory == 2) { var v4 = stageManager.activeBugs; var v7 = defaultEatDistance + v4[0].hitWidth / 2; var v9; var v8 = 3000; var v3 = 0; while (v3 < v4.length) { var v6 = _root.distanceBetweenObjects(this, v4[v3]); if (v6 < v8) { v8 = v6; v9 = v4[v3]; if (v6 < v7) { v4[v3].gotoAndPlay('die'); audioManager.triggerNonrepeatingSound('prevGatorSound', 'gator sound', audioManager.gatorSounds, 40); if (v4[v3].bugType == 2) { if (!_root.gottenGlowyBug) { _root.gottenGlowyBug = true; _root.boundary.play(); _root.TriggerCutscene(200, this); gotoAndStop('eatGlowy'); com.newgrounds.API.unlockMedal('whoosh'); _root.saveGame(); } } else { _root.TriggerCutscene(150, this); gotoAndStop('eatBug'); } } } ++v3; } eyeTarget = v9; if (resting) { if (v8 < wakeDistance) { gotoAndStop('wake'); resting = false; } } else { if (v8 > restDistance) { gotoAndStop('rest'); resting = true; } } } else { if (targetCategory == 3) { var v5 = stageManager.sleepables; var v7 = 60; var v3 = 0; while (v3 < v5.length) { if (Math.abs(v5[v3]._x - _x) < v7) { if (Math.abs(v5[v3]._y - _y) < v7) { if (_root.distanceBetweenObjects(this, v5[v3]) < v7) { v5[v3].die(this); gotoAndStop('eatRed'); audioManager.triggerNonrepeatingSound('prevGatorSound', 'gator sound', audioManager.gatorSounds, 40); _root.TriggerCutscene(200, this); } } } ++v3; } } } } var v10 = {'x': _x - guy._x, 'y': _y - guy._y}; var v12 = Math.sqrt(v10.x * v10.x + v10.y * v10.y); cloudPoints._rotation = Math.atan2(_y - guy._y, _x - guy._x) * 57.29577951308232 - 90; var v11 = 400; cloudPoints._rotation += 180 * (Math.max(v11 - v12, 0) / v11); updateCloudPoint(cloudPoints.point1, cloud1, cloud1xy, 0.1); updateCloudPoint(cloudPoints.point2, cloud2, cloud2xy, 0.05); updateCloudPoint(cloudPoints.point3, cloud3, cloud3xy, 0.08); targetIcon._x = cloud3._x; targetIcon._y = cloud3._y; targetIcon._rotation = _root.camera._rotation; } }; } instance targetIcon of movieClip 1294 { onClipEvent (load) { var animatingRoll = false; var rollAnimationTimer = 0; } onClipEvent (enterFrame) { if (!animatingRoll) { var globalXY = {'x': 0, 'y': 0}; this.localToGlobal(globalXY); _root.globalToLocal(globalXY); if (_root.scramblantAttachPoint.hitTest(globalXY.x, globalXY.y, true)) { animatingRoll = true; rollAnimationTimer = 26; ++_parent.targetCategory; if (_parent.targetCategory > _totalframes) { _parent.targetCategory = 2; } } } else { --rollAnimationTimer; if (rollAnimationTimer <= 0) { animatingRoll = false; gotoAndStop(_parent.targetCategory); } else { if (rollAnimationTimer % 2 == 0) { gotoAndStop(_root.randomInt(1, _totalframes)); } } } } } frame 3 { stop(); } } instance of movieClip 1483 { onClipEvent (load) { var targetCategory = 3; } } instance of movieClip 1483 { onClipEvent (load) { var targetCategory = 3; } } instance of movieClip 1483 { onClipEvent (load) { var targetCategory = 2; } } instance of movieClip 1483 { onClipEvent (load) { var targetCategory = 2; } } movieClip 1497 { } movieClip 1501 { frame 1 { stop(); } } movieClip 1503 { } movieClip 1505 { } movieClip 1506 { frame 1 { stop(); } frame 539 { _parent.halfHeart = false; } } movieClip 1507 { frame 1 { stop(); } } movieClip 1508 { frame 1 { function camControl() { rp.x = _x; rp.y = _y; var v5 = camH * (_yscale * 0.01); var v6 = camW * (_xscale * 0.01); var v3 = sH / v5; var v4 = sW / v6; _x2 = (v6 / 2) * v4; _y2 = (v5 / 2) * v3; _xscale2 = v4 * 100; _yscale2 = v3 * 100; _rotation2 = -_rotation; _root.filters = this.filters; _root.transform.colorTransform = this.transform.colorTransform; } function reset() { _root._xscale = 100; _root._yscale = 100; _root._x = 0; _root._y = 0; _root._rotation = 0; _root._visible = true; } function set_x2(value) { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._x += value - v2.x; } function get_x2() { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); return v2.x; } function set_y2(value) { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._y += value - v2.y; } function get_y2() { var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); return v2.y; } function get_xscale2() { return _root._xscale; } function set_xscale2(value) { setProperty2('_xscale', value); } function get_yscale2() { return _root._yscale; } function set_yscale2(value) { setProperty2('_yscale', value); } function get_rotation2() { return parent.rotation; } function set_rotation2(value) { setProperty2('_rotation', value); } function setProperty2(prop, n) { var v3 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v3); _root[prop] = n; var v2 = {'x': rp.x, 'y': rp.y}; _root.localToGlobal(v2); _root._x -= v2.x - v3.x; _root._y -= v2.y - v3.y; } _visible = true; addProperty('_x2', get_x2, set_x2); addProperty('_y2', get_y2, set_y2); addProperty('_xscale2', get_xscale2, set_xscale2); addProperty('_yscale2', get_yscale2, set_yscale2); addProperty('_rotation2', get_rotation2, set_rotation2); var oldScaleMode = stage.scaleMode; stage.scaleMode = 'exactFit'; var sW = Stage.width; var sH = Stage.height; stage.scaleMode = oldScaleMode; var bounds_obj = this.getBounds(this); var camH = Math.abs(bounds_obj.yMax - bounds_obj.yMin); var camW = Math.abs(bounds_obj.xMax - bounds_obj.xMin); var rp = {'x': this._x, 'y': this._y}; onEnterFrame = function () { camControl(); }; this.onUnload = reset; } instance hearts of movieClip 1507 { onClipEvent (load) { function takeHealth(takeFullHeart) { if (!halfHeart && !takeFullHeart) { halfHeart = true; activeHeart.play(); } else { if (_currentframe == 1) { if (_root.guy.youCanDie) { _root.Die(); _visible = false; } } prevFrame(); halfHeart = false; activeHeart.gotoAndStop(1); } } var halfHeart = false; } } } movieClip 1517 { frame 1 { stop(); } frame 500 { gotoAndStop(1); } frame 999 { gotoAndStop(1); } frame 1997 { gotoAndStop(1); } frame 2496 { gotoAndStop(1); } frame 2995 { gotoAndStop(1); } frame 3494 { gotoAndStop(1); } frame 3993 { gotoAndStop(1); } } instance tutorialText of movieClip 1517 { onClipEvent (load) { var camera = _root.camera; } } movieClip 1519 { frame 2 { stop(); } } movieClip 1521 { } movieClip 1526 { frame 1 { function onEnterFrame() { if (_root.rotationLocked) { nextFrame(); } } stop(); } frame 2 { function onEnterFrame() { if (!_root.rotationLocked) { prevFrame(); } } stop(); } } movieClip 1529 { frame 1 { function onEnterFrame() { if (!_root.gravityIndicatorEnabled) { nextFrame(); } } stop(); } frame 2 { function onEnterFrame() { if (_root.gravityIndicatorEnabled) { prevFrame(); } } stop(); } } movieClip 1533 { frame 1 { function onEnterFrame() { if (!_root.flagIndicatorEnabled) { nextFrame(); } } stop(); } frame 2 { function onEnterFrame() { if (_root.flagIndicatorEnabled) { prevFrame(); } } stop(); } } movieClip 1536 { frame 1 { function onEnterFrame() { if (!_root.backgroundsEnabled) { nextFrame(); } } stop(); } frame 2 { function onEnterFrame() { if (_root.backgroundsEnabled) { prevFrame(); } } stop(); } } movieClip 1539 { frame 1 { function onEnterFrame() { if (_root.gameMuted) { nextFrame(); } } stop(); } frame 2 { function onEnterFrame() { if (!_root.gameMuted) { prevFrame(); } } stop(); } } movieClip 1646 { frame 1 { stop(); } } movieClip 1648 { } movieClip 1651 { frame 1 { function onLoad() { var v2 = false; var v1 = false; } function onEnterFrame() { if ((Key.isDown(27) || Key.isDown(_root.controls.pause)) && !pauseHeld && !Key.isDown(16)) { pauseHeld = true; pauseGame(); } else { if (!Key.isDown(27) && !Key.isDown(_root.controls.pause) && pauseHeld) { pauseHeld = false; } } } function pauseGame() { if (_root.cutsceneTimer > 0) { _root.cutscenePaused = true; } _root.gamePaused = true; gotoAndStop(2); } function unpauseGame() { if (!_root.cutscenePaused) { _root.gamePaused = false; } else { _root.cutscenePaused = false; } gotoAndStop(1); } stop(); var downHeld = true; var upHeld = true; var spaceHeld = true; } frame 2 { function onEnterFrame() { if ((Key.isDown(27) || Key.isDown(_root.controls.pause)) && !pauseHeld) { pauseHeld = true; unpauseGame(); } else { if (!Key.isDown(27) && !Key.isDown(_root.controls.pause) && pauseHeld) { pauseHeld = false; } } if (Key.isDown(40) && !downHeld) { downHeld = true; nextFrame(); } else { if (!Key.isDown(40) && downHeld) { downHeld = false; } } if (Key.isDown(38) && !upHeld) { upHeld = true; if (this._currentframe != 2) { prevFrame(); } } else { if (!Key.isDown(38) && upHeld) { upHeld = false; } } if ((Key.isDown(32) || Key.isDown(13)) && !spaceHeld) { spaceHeld = true; toggleSetting(); } else { if (!Key.isDown(32) && !Key.isDown(13) && spaceHeld) { spaceHeld = false; } } } stop(); _root.saveGame(); } frame 2 { function toggleSetting() { _root.guy.weaponKeyHeld = true; unpauseGame(); } } frame 3 { function toggleSetting() { if (_root.rotationLocked) { _root.rotationLocked = false; } else { _root.rotationLocked = true; _root.gravityIndicatorEnabled = true; } } } frame 4 { function toggleSetting() { if (_root.gravityIndicatorEnabled) { _root.gravityIndicatorEnabled = false; manuallyToggledGravityIndicator = false; } else { _root.gravityIndicatorEnabled = true; manuallyToggledGravityIndicator = true; } } } frame 5 { function toggleSetting() { if (_root.flagIndicatorEnabled) { _root.flagIndicatorEnabled = false; } else { _root.flagIndicatorEnabled = true; } } } frame 6 { function toggleSetting() { _root.backgroundsEnabled = !_root.backgroundsEnabled; if (!_root.backgroundsEnabled) { _root.actionWindow.gotoAndStop(1); } else { _root.actionWindow.gotoAndStop(_root.stageBackground); } } } frame 7 { function toggleSetting() { _root.gameMuted = !_root.gameMuted; } } frame 8 { function onEnterFrame() { if ((Key.isDown(27) || Key.isDown(_root.controls.pause)) && !pauseHeld) { pauseHeld = true; unpauseGame(); } else { if (!Key.isDown(27) && !Key.isDown(_root.controls.pause) && pauseHeld) { pauseHeld = false; } } if (Key.isDown(40) && !downHeld) { downHeld = true; if (_currentframe != 8) { nextFrame(); } else { gotoAndStop(19); } } else { if (!Key.isDown(40) && downHeld) { downHeld = false; } } if (Key.isDown(38) && !upHeld) { upHeld = true; if (this._currentframe != 2) { prevFrame(); } } else { if (!Key.isDown(38) && upHeld) { upHeld = false; } } if (Key.isDown(32) || Key.isDown(13) && !spaceHeld) { spaceHeld = true; toggleSetting(); } else { if (!Key.isDown(32) && !Key.isDown(13) && spaceHeld) { spaceHeld = false; } } if (Key.isDown(82)) { _root.keyBindings = newBindings; _root.setControlsToBindings(); updateKeyTexts(); } } function updateKeyTexts() { keyBindings = _root.keyBindings; walkleft_keytext.gotoAndStop(keyBindings[0]); walkright_keytext.gotoAndStop(keyBindings[1]); jump_keytext.gotoAndStop(keyBindings[2]); plantseed_keytext.gotoAndStop(keyBindings[3]); usetool_keytext.gotoAndStop(keyBindings[4]); discardtool_keytext.gotoAndStop(keyBindings[5]); inventoryleft_keytext.gotoAndStop(keyBindings[6]); inventoryright_keytext.gotoAndStop(keyBindings[7]); pause_keytext.gotoAndStop(keyBindings[8]); } stop(); var keyBindings = _root.keyBindings; updateKeyTexts(); var newBindings = new Array(37, 39, 38, 40, 32, 90, 188, 190, 80); } frame 8 { function toggleSetting() { nextFrame(); } } frame 9 { function onEnterFrame() { if (lastKeyDown) { if (!Key.isDown(lastKey)) { lastKeyDown = false; } } else { if (Key.isDown(27)) { pauseHeld = true; gotoAndStop(2); } else { if (Key.getCode() != lastKey && Key.getCode() != 16) { var v1 = false; i = 0; while (i < currentBindingIndex) { if (newBindings[i] == Key.getCode()) { v1 = true; } ++i; } if (!v1) { selectedKeyText.gotoAndStop(Key.getCode()); lastKey = Key.getCode(); lastKeyDown = true; newBindings[currentBindingIndex] = Key.getCode(); ++currentBindingIndex; nextFrame(); } } } } } function toggleSetting() {} var lastKey = Key.getCode(); var lastKeyDown = true; var currentBindingIndex = 0; } frame 9 { var selectedKeyText = walkleft_keytext; walkleft_keytext.gotoAndStop(2); walkright_keytext.gotoAndStop(1); jump_keytext.gotoAndStop(1); plantseed_keytext.gotoAndStop(1); usetool_keytext.gotoAndStop(1); discardtool_keytext.gotoAndStop(1); inventoryleft_keytext.gotoAndStop(1); inventoryright_keytext.gotoAndStop(1); pause_keytext.gotoAndStop(1); } frame 10 { var selectedKeyText = walkright_keytext; selectedKeyText.gotoAndStop(2); } frame 11 { var selectedKeyText = jump_keytext; selectedKeyText.gotoAndStop(2); } frame 12 { var selectedKeyText = plantseed_keytext; selectedKeyText.gotoAndStop(2); } frame 13 { var selectedKeyText = usetool_keytext; selectedKeyText.gotoAndStop(2); } frame 14 { var selectedKeyText = discardtool_keytext; selectedKeyText.gotoAndStop(2); } frame 15 { var selectedKeyText = inventoryleft_keytext; selectedKeyText.gotoAndStop(2); } frame 16 { var selectedKeyText = inventoryright_keytext; selectedKeyText.gotoAndStop(2); } frame 17 { var selectedKeyText = pause_keytext; selectedKeyText.gotoAndStop(2); } frame 18 { _root.keyBindings = newBindings; _root.setControlsToBindings(); pauseHeld = true; gotoAndStop(2); } frame 19 { function onEnterFrame() { if ((Key.isDown(27) || Key.isDown(_root.controls.pause)) && !pauseHeld) { pauseHeld = true; unpauseGame(); } else { if (!Key.isDown(27) && !Key.isDown(_root.controls.pause) && pauseHeld) { pauseHeld = false; } } if (Key.isDown(40) && !downHeld) { downHeld = true; nextFrame(); } else { if (!Key.isDown(40) && downHeld) { downHeld = false; } } if (Key.isDown(38) && !upHeld) { upHeld = true; gotoAndStop(8); } else { if (!Key.isDown(38) && upHeld) { upHeld = false; } } if ((Key.isDown(32) || Key.isDown(13)) && !spaceHeld) { spaceHeld = true; toggleSetting(); } else { if (!Key.isDown(32) && !Key.isDown(13) && spaceHeld) { spaceHeld = false; } } } stop(); } frame 19 { function toggleSetting() { _root.nextLoadedScene = 'main'; _root.fader.gotoAndPlay('circleout'); unpauseGame(); } } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 8 { function checkOutOfBounds(inputX, inputY) { return boundary1.hitTest(inputX, inputY, true); } stop(); var nextLoadedScene = 'main'; var mainLevel = false; var stageBackground = 'redGalaxy'; } instance stageManager of movieClip 875 { onClipEvent (load) { this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); } } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } else { if (prevLabel == 'prevRedguySound') { prevRedguySound = newPrevNumber; } else { if (prevLabel == 'prevRedguyHurt') { prevRedguyHurt = newPrevNumber; } else { if (prevLabel == 'prevSleepSound') { prevSleepSound = newPrevNumber; } } } } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } else { if (prevLabel == 'prevRedguySound') { return prevRedguySound; } else { if (prevLabel == 'prevRedguyHurt') { return prevRedguyHurt; } else { if (prevLabel == 'prevSleepSound') { return prevSleepSound; } } } } } } } } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; var sporeSounds = new Array('sp-01', 'sp-02', 'sp-03', 'sp-04', 'sp-05', 'sp-06', 'sp-07', 'sp-08', 'sp-09', 'sp-10', 'sp-11', 'sp-12', 'sp-13', 'sp-14', 'sp-15', 'sp-16', 'sp-17', 'sp-18', 'sp-19', 'sp-20', 'sp-21', 'sp-22'); var spore2Sounds = new Array('sr-01', 'sr-02', 'sr-03', 'sr-04', 'sr-05', 'sr-06', 'sr-07', 'sr-08', 'sr-09', 'sr-10', 'sr-11', 'sr-12', 'sr-13', 'sr-14', 'sr-15', 'sr-16', 'sr-17', 'sr-18', 'sr-19', 'sr-20', 'sr-21', 'sr-22'); var sporeResetSounds = new Array('resetSpawn-01', 'resetSpawn-02', 'resetSpawn-03', 'resetSpawn-04'); var bugIdleSounds = new Array('bug-01.wav', 'bug-02.wav', 'bug-03.wav', 'bug-04.wav', 'bug-05.wav', 'bug-06.wav', 'bug-07.wav', 'bug-08.wav', 'bug-09.wav', 'bug-10.wav', 'bug-11.wav', 'bug-12.wav', 'bug-13.wav', 'bug-14.wav', 'bug-15.wav', 'bug-16.wav', 'bug-17.wav', 'bug-18.wav', 'bug-19.wav', 'bug-20.wav', 'bug-21.wav', 'bug-22.wav', 'bug-23.wav', 'bug-24.wav', 'bug-25.wav', 'bug-26.wav', 'bug-27.wav', 'bug-28.wav', 'bug-29.wav', 'bug-30.wav', 'bug-31.wav', 'bug-32.wav', 'bug-33.wav', 'bug-34.wav', 'bug-35.wav', 'bug-36.wav', 'bug-37.wav', 'bug-38.wav', 'bug-39.wav', 'bug-40.wav', 'bug-41.wav', 'bug-42.wav'); var bugHurtSounds = new Array('bugHurt-01.wav', 'bugHurt-02.wav', 'bugHurt-03.wav', 'bugHurt-04.wav', 'bugHurt-05.wav', 'bugHurt-06.wav'); var prevBugHurt = 0; var gatorSounds = new Array('gaderbite.wav', 'gaderbite2.wav', 'gaderbite3.wav'); var prevGatorSound = 0; var redguySounds = new Array('red-01.wav', 'red-02.wav', 'red-03.wav', 'red-04.wav', 'red-05.wav', 'red-06.wav', 'red-07.wav', 'red-08.wav', 'red-09.wav', 'red-10.wav', 'red-11.wav', 'red-12.wav', 'red-13.wav', 'red-14.wav', 'red-15.wav', 'red-16.wav', 'red-17.wav', 'red-18.wav', 'red-19.wav', 'red-20.wav', 'red-21.wav', 'red-22.wav'); var prevRedguySound = 0; var redguyHurtSounds = new Array('redhurt-01.wav', 'redhurt-02.wav', 'redhurt-03.wav', 'redhurt-04.wav', 'redhurt-05.wav'); var prevRedguyHurt = 0; var sleepSounds = new Array('sleep-03.wav', 'sleep-04.wav', 'sleep-05.wav', 'sleep-06.wav'); var prevSleepSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { rotation = 0; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop(_root.stageBackground); } } } movieClip 1653 { } movieClip 1654 { frame 1 { var attachPoint = terrainComposite.attachPoint; } } instance terrain of movieClip 1654 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } movieClip 1656 { } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 4; var myItem = 5; var watcher = false; var beeliner = true; var noclip = false; var fickle = false; } } instance linkspore1 of movieClip 1027 { onClipEvent (load) { var type = 1; var speed = 3; var spawnLimit = 3; } } instance of movieClip 1154 { onClipEvent (load) { var target1 = _root.linkspore2; var target2 = _root.linkspore1; } } instance linkspore2 of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 3; var spawnLimit = 3; } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(6); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(2); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'main'; var myWeapon = 3; } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.5) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } } } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function discardWeapon() { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var v2 = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); v2.power = weapon; v2.graphicMC.gotoAndStop(weapon); weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(v2); } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { if (controlArrestTimer <= 0) { controlArrested = true; controlArrestTimer = 5; } else { controlArrested = false; _x = _x + (Math.random() - 0.5); _y = _y + (Math.random() - 0.5); trace('jostle'); } } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var noShiftCounter = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7', 'gs8']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; if (!_root.mainLevel) { weapon = _root.heldWeapon; } var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.hud.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { if (Key.getCode() >= 65 && Key.getCode() <= 90) { _root.selectedLetter = Key.getCode() - 64; } if (!_root.releaseBuild) { if (Key.isDown(49)) { weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(50)) { weapon = 2; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(51)) { weapon = 3; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(52)) { weapon = 4; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(53)) { weapon = 5; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(57)) { _root.TriggerCutscene(100, this); } if (Key.isDown(17)) { _root.nextLoadedScene = 'level3'; _root.Die(); } } } if (weapon != 5) { if (invincibleTimer > 0) { --invincibleTimer; } if (invincibleTimer == 0 && invincible) { setVincible(); } } else { invincible = true; invincibleTimer = 0; guyMask.gotoAndStop('solid'); } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x, _y, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true) && !invincible) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true) && !invincible) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } audioManager.triggerNonrepeatingSound('prevPlatSound', 'platSound', audioManager.platSounds, 5); } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 3) { arm.gotoAndStop('spray'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } else { if (weapon == 3) { arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { discardWeapon(); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } var distanceFromCenter = _root.distanceBetweenPoints(_x, _y, 0, 0); if (weapon == 5) { if (distanceFromCenter > 5000) { _root.gameEnding = true; _root.actionWindow.gotoAndStop('static'); _root.Inventory._alpha -= 0.1; _root.hud._alpha -= 0.1; _root.beatenGameOnce = true; _root.saveGame(); com.newgrounds.API.unlockMedal('Pink Prison'); if (_root.hardcoreGame) { com.newgrounds.API.unlockMedal('Lucid Dreamer'); } } if (distanceFromCenter > 8000) { controlArrested = true; controlArrestTimer = 99999; runSpeed = 0; hitPush = 0; } if (distanceFromCenter > 12000) { if (_xscale < 1) { _root.flippedEndingGuy = true; } _root.animHookupFrame = anim._currentframe; trace(_root.animHookupFrame); _root.gotoAndPlay('ending'); } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3); var inventoryMax = 4; var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; var hasInfiniseed = false; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (!hasInfiniseed) { if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } } instance of movieClip 1483 { onClipEvent (load) { var targetCategory = 3; } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 10 { function checkOutOfBounds(inputX, inputY) { return boundary1.hitTest(inputX, inputY, true); } stop(); var nextLoadedScene = 'main'; var mainLevel = false; var stageBackground = 'redGalaxy'; } instance stageManager of movieClip 875 { onClipEvent (load) { this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); } } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } else { if (prevLabel == 'prevRedguySound') { prevRedguySound = newPrevNumber; } else { if (prevLabel == 'prevRedguyHurt') { prevRedguyHurt = newPrevNumber; } else { if (prevLabel == 'prevSleepSound') { prevSleepSound = newPrevNumber; } } } } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } else { if (prevLabel == 'prevRedguySound') { return prevRedguySound; } else { if (prevLabel == 'prevRedguyHurt') { return prevRedguyHurt; } else { if (prevLabel == 'prevSleepSound') { return prevSleepSound; } } } } } } } } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; var sporeSounds = new Array('sp-01', 'sp-02', 'sp-03', 'sp-04', 'sp-05', 'sp-06', 'sp-07', 'sp-08', 'sp-09', 'sp-10', 'sp-11', 'sp-12', 'sp-13', 'sp-14', 'sp-15', 'sp-16', 'sp-17', 'sp-18', 'sp-19', 'sp-20', 'sp-21', 'sp-22'); var spore2Sounds = new Array('sr-01', 'sr-02', 'sr-03', 'sr-04', 'sr-05', 'sr-06', 'sr-07', 'sr-08', 'sr-09', 'sr-10', 'sr-11', 'sr-12', 'sr-13', 'sr-14', 'sr-15', 'sr-16', 'sr-17', 'sr-18', 'sr-19', 'sr-20', 'sr-21', 'sr-22'); var sporeResetSounds = new Array('resetSpawn-01', 'resetSpawn-02', 'resetSpawn-03', 'resetSpawn-04'); var bugIdleSounds = new Array('bug-01.wav', 'bug-02.wav', 'bug-03.wav', 'bug-04.wav', 'bug-05.wav', 'bug-06.wav', 'bug-07.wav', 'bug-08.wav', 'bug-09.wav', 'bug-10.wav', 'bug-11.wav', 'bug-12.wav', 'bug-13.wav', 'bug-14.wav', 'bug-15.wav', 'bug-16.wav', 'bug-17.wav', 'bug-18.wav', 'bug-19.wav', 'bug-20.wav', 'bug-21.wav', 'bug-22.wav', 'bug-23.wav', 'bug-24.wav', 'bug-25.wav', 'bug-26.wav', 'bug-27.wav', 'bug-28.wav', 'bug-29.wav', 'bug-30.wav', 'bug-31.wav', 'bug-32.wav', 'bug-33.wav', 'bug-34.wav', 'bug-35.wav', 'bug-36.wav', 'bug-37.wav', 'bug-38.wav', 'bug-39.wav', 'bug-40.wav', 'bug-41.wav', 'bug-42.wav'); var bugHurtSounds = new Array('bugHurt-01.wav', 'bugHurt-02.wav', 'bugHurt-03.wav', 'bugHurt-04.wav', 'bugHurt-05.wav', 'bugHurt-06.wav'); var prevBugHurt = 0; var gatorSounds = new Array('gaderbite.wav', 'gaderbite2.wav', 'gaderbite3.wav'); var prevGatorSound = 0; var redguySounds = new Array('red-01.wav', 'red-02.wav', 'red-03.wav', 'red-04.wav', 'red-05.wav', 'red-06.wav', 'red-07.wav', 'red-08.wav', 'red-09.wav', 'red-10.wav', 'red-11.wav', 'red-12.wav', 'red-13.wav', 'red-14.wav', 'red-15.wav', 'red-16.wav', 'red-17.wav', 'red-18.wav', 'red-19.wav', 'red-20.wav', 'red-21.wav', 'red-22.wav'); var prevRedguySound = 0; var redguyHurtSounds = new Array('redhurt-01.wav', 'redhurt-02.wav', 'redhurt-03.wav', 'redhurt-04.wav', 'redhurt-05.wav'); var prevRedguyHurt = 0; var sleepSounds = new Array('sleep-03.wav', 'sleep-04.wav', 'sleep-05.wav', 'sleep-06.wav'); var prevSleepSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { rotation = 0; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop(_root.stageBackground); } } } movieClip 1659 { frame 1 { stop(); } } movieClip 1661 { } movieClip 1662 { } movieClip 1665 { frame 1 { stop(); } } movieClip 1666 { frame 1 { var attachPoint = terrainComposite.attachPoint; } instance hazardTerrain of movieClip 1665 { } } instance terrain of movieClip 1666 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } movieClip 1668 { } instance linkbug1 of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1154 { onClipEvent (load) { var target1 = _root.linkbug1; var target2 = _root.guy; var maxScale = 600; } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(2); } } movieClip 1671 { } movieClip 1673 { } movieClip 1674 { frame 2 { function destroyAllSpawns() { i = 0; while (i < _root.guy.spawnedObjects.length) { if (!_root.guy.spawnedObjects[i].animating) { _root.guy.spawnedObjects[i].gotoAndPlay('destroy'); } else { _root.guy.spawnedObjects[i].destroyImmediately = true; } ++i; } } stop(); onEnterFrame = function () { if (_root.guy.spawnedObjects.length > 0) { play(); } }; } frame 43 { stop(); onEnterFrame = function () { if (_root.distanceBetweenObjects(this, _root.guy) < 30) { play(); } }; } frame 50 { stop(); destroyAllSpawns(); onEnterFrame = function () { if (_root.distanceBetweenObjects(this, _root.guy) > 30) { play(); } }; } frame 51 { onEnterFrame = function () { if (_root.distanceBetweenObjects(this, _root.guy) < 30) { gotoAndPlay('readyFrame'); } }; } frame 79 { gotoAndStop('readyFrame'); } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'main'; var myWeapon = 4; } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(4); } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function discardWeapon() { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var v2 = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); v2.power = weapon; v2.graphicMC.gotoAndStop(weapon); weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(v2); } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { if (controlArrestTimer <= 0) { controlArrested = true; controlArrestTimer = 5; } else { controlArrested = false; _x = _x + (Math.random() - 0.5); _y = _y + (Math.random() - 0.5); trace('jostle'); } } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var noShiftCounter = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7', 'gs8']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; if (!_root.mainLevel) { weapon = _root.heldWeapon; } var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.hud.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { if (Key.getCode() >= 65 && Key.getCode() <= 90) { _root.selectedLetter = Key.getCode() - 64; } if (!_root.releaseBuild) { if (Key.isDown(49)) { weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(50)) { weapon = 2; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(51)) { weapon = 3; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(52)) { weapon = 4; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(53)) { weapon = 5; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(57)) { _root.TriggerCutscene(100, this); } if (Key.isDown(17)) { _root.nextLoadedScene = 'level3'; _root.Die(); } } } if (weapon != 5) { if (invincibleTimer > 0) { --invincibleTimer; } if (invincibleTimer == 0 && invincible) { setVincible(); } } else { invincible = true; invincibleTimer = 0; guyMask.gotoAndStop('solid'); } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x, _y, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true) && !invincible) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true) && !invincible) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } audioManager.triggerNonrepeatingSound('prevPlatSound', 'platSound', audioManager.platSounds, 5); } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 3) { arm.gotoAndStop('spray'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } else { if (weapon == 3) { arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { discardWeapon(); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } var distanceFromCenter = _root.distanceBetweenPoints(_x, _y, 0, 0); if (weapon == 5) { if (distanceFromCenter > 5000) { _root.gameEnding = true; _root.actionWindow.gotoAndStop('static'); _root.Inventory._alpha -= 0.1; _root.hud._alpha -= 0.1; _root.beatenGameOnce = true; _root.saveGame(); com.newgrounds.API.unlockMedal('Pink Prison'); if (_root.hardcoreGame) { com.newgrounds.API.unlockMedal('Lucid Dreamer'); } } if (distanceFromCenter > 8000) { controlArrested = true; controlArrestTimer = 99999; runSpeed = 0; hitPush = 0; } if (distanceFromCenter > 12000) { if (_xscale < 1) { _root.flippedEndingGuy = true; } _root.animHookupFrame = anim._currentframe; trace(_root.animHookupFrame); _root.gotoAndPlay('ending'); } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.5) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3); var inventoryMax = 4; var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; var hasInfiniseed = false; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (!hasInfiniseed) { if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 12 { function checkOutOfBounds(inputX, inputY) { return boundary1.hitTest(inputX, inputY, true); } stop(); var nextLoadedScene = 'main'; var mainLevel = false; var stageBackground = 'turmoil'; } instance stageManager of movieClip 875 { onClipEvent (load) { this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); } } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } else { if (prevLabel == 'prevRedguySound') { prevRedguySound = newPrevNumber; } else { if (prevLabel == 'prevRedguyHurt') { prevRedguyHurt = newPrevNumber; } else { if (prevLabel == 'prevSleepSound') { prevSleepSound = newPrevNumber; } } } } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } else { if (prevLabel == 'prevRedguySound') { return prevRedguySound; } else { if (prevLabel == 'prevRedguyHurt') { return prevRedguyHurt; } else { if (prevLabel == 'prevSleepSound') { return prevSleepSound; } } } } } } } } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; var sporeSounds = new Array('sp-01', 'sp-02', 'sp-03', 'sp-04', 'sp-05', 'sp-06', 'sp-07', 'sp-08', 'sp-09', 'sp-10', 'sp-11', 'sp-12', 'sp-13', 'sp-14', 'sp-15', 'sp-16', 'sp-17', 'sp-18', 'sp-19', 'sp-20', 'sp-21', 'sp-22'); var spore2Sounds = new Array('sr-01', 'sr-02', 'sr-03', 'sr-04', 'sr-05', 'sr-06', 'sr-07', 'sr-08', 'sr-09', 'sr-10', 'sr-11', 'sr-12', 'sr-13', 'sr-14', 'sr-15', 'sr-16', 'sr-17', 'sr-18', 'sr-19', 'sr-20', 'sr-21', 'sr-22'); var sporeResetSounds = new Array('resetSpawn-01', 'resetSpawn-02', 'resetSpawn-03', 'resetSpawn-04'); var bugIdleSounds = new Array('bug-01.wav', 'bug-02.wav', 'bug-03.wav', 'bug-04.wav', 'bug-05.wav', 'bug-06.wav', 'bug-07.wav', 'bug-08.wav', 'bug-09.wav', 'bug-10.wav', 'bug-11.wav', 'bug-12.wav', 'bug-13.wav', 'bug-14.wav', 'bug-15.wav', 'bug-16.wav', 'bug-17.wav', 'bug-18.wav', 'bug-19.wav', 'bug-20.wav', 'bug-21.wav', 'bug-22.wav', 'bug-23.wav', 'bug-24.wav', 'bug-25.wav', 'bug-26.wav', 'bug-27.wav', 'bug-28.wav', 'bug-29.wav', 'bug-30.wav', 'bug-31.wav', 'bug-32.wav', 'bug-33.wav', 'bug-34.wav', 'bug-35.wav', 'bug-36.wav', 'bug-37.wav', 'bug-38.wav', 'bug-39.wav', 'bug-40.wav', 'bug-41.wav', 'bug-42.wav'); var bugHurtSounds = new Array('bugHurt-01.wav', 'bugHurt-02.wav', 'bugHurt-03.wav', 'bugHurt-04.wav', 'bugHurt-05.wav', 'bugHurt-06.wav'); var prevBugHurt = 0; var gatorSounds = new Array('gaderbite.wav', 'gaderbite2.wav', 'gaderbite3.wav'); var prevGatorSound = 0; var redguySounds = new Array('red-01.wav', 'red-02.wav', 'red-03.wav', 'red-04.wav', 'red-05.wav', 'red-06.wav', 'red-07.wav', 'red-08.wav', 'red-09.wav', 'red-10.wav', 'red-11.wav', 'red-12.wav', 'red-13.wav', 'red-14.wav', 'red-15.wav', 'red-16.wav', 'red-17.wav', 'red-18.wav', 'red-19.wav', 'red-20.wav', 'red-21.wav', 'red-22.wav'); var prevRedguySound = 0; var redguyHurtSounds = new Array('redhurt-01.wav', 'redhurt-02.wav', 'redhurt-03.wav', 'redhurt-04.wav', 'redhurt-05.wav'); var prevRedguyHurt = 0; var sleepSounds = new Array('sleep-03.wav', 'sleep-04.wav', 'sleep-05.wav', 'sleep-06.wav'); var prevSleepSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { rotation = 0; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop(_root.stageBackground); } } } movieClip 1677 { frame 1 { stop(); } } movieClip 1679 { } movieClip 1680 { } movieClip 1681 { frame 1 { var attachPoint = terrainComposite.attachPoint; } instance hazardTerrain of movieClip 1680 { } } instance terrain of movieClip 1681 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 2; var myItem = 0; var watcher = false; var beeliner = false; var noclip = true; var fickle = true; var seekingDistance = 100; } } instance of movieClip 1144 { onClipEvent (load) { var targetCategory = 3; var myItem = 0; var watcher = true; var beeliner = false; var noclip = true; var fickle = false; var seekingDistance = 200; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } instance of movieClip 1027 { onClipEvent (load) { var type = 2; var speed = 4; var spawnLimit = 3; } } movieClip 1682 { instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } instance of movieClip 1025 { onClipEvent (load) { var myItem = 0; var bugType = 1; } } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(6); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(4); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(5); } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'main'; var myWeapon = 5; } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function discardWeapon() { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var v2 = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); v2.power = weapon; v2.graphicMC.gotoAndStop(weapon); weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(v2); } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { if (controlArrestTimer <= 0) { controlArrested = true; controlArrestTimer = 5; } else { controlArrested = false; _x = _x + (Math.random() - 0.5); _y = _y + (Math.random() - 0.5); trace('jostle'); } } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var noShiftCounter = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7', 'gs8']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; if (!_root.mainLevel) { weapon = _root.heldWeapon; } var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.hud.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { if (Key.getCode() >= 65 && Key.getCode() <= 90) { _root.selectedLetter = Key.getCode() - 64; } if (!_root.releaseBuild) { if (Key.isDown(49)) { weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(50)) { weapon = 2; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(51)) { weapon = 3; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(52)) { weapon = 4; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(53)) { weapon = 5; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(57)) { _root.TriggerCutscene(100, this); } if (Key.isDown(17)) { _root.nextLoadedScene = 'level3'; _root.Die(); } } } if (weapon != 5) { if (invincibleTimer > 0) { --invincibleTimer; } if (invincibleTimer == 0 && invincible) { setVincible(); } } else { invincible = true; invincibleTimer = 0; guyMask.gotoAndStop('solid'); } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x, _y, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true) && !invincible) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true) && !invincible) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } audioManager.triggerNonrepeatingSound('prevPlatSound', 'platSound', audioManager.platSounds, 5); } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 3) { arm.gotoAndStop('spray'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } else { if (weapon == 3) { arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { discardWeapon(); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } var distanceFromCenter = _root.distanceBetweenPoints(_x, _y, 0, 0); if (weapon == 5) { if (distanceFromCenter > 5000) { _root.gameEnding = true; _root.actionWindow.gotoAndStop('static'); _root.Inventory._alpha -= 0.1; _root.hud._alpha -= 0.1; _root.beatenGameOnce = true; _root.saveGame(); com.newgrounds.API.unlockMedal('Pink Prison'); if (_root.hardcoreGame) { com.newgrounds.API.unlockMedal('Lucid Dreamer'); } } if (distanceFromCenter > 8000) { controlArrested = true; controlArrestTimer = 99999; runSpeed = 0; hitPush = 0; } if (distanceFromCenter > 12000) { if (_xscale < 1) { _root.flippedEndingGuy = true; } _root.animHookupFrame = anim._currentframe; trace(_root.animHookupFrame); _root.gotoAndPlay('ending'); } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.5) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3); var inventoryMax = 4; var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; var hasInfiniseed = false; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (!hasInfiniseed) { if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 14 { function checkOutOfBounds(inputX, inputY) { return boundary1.hitTest(inputX, inputY, true); } stop(); var nextLoadedScene = 'main'; var mainLevel = false; var stageBackground = 'lightRed'; } instance stageManager of movieClip 875 { onClipEvent (load) { this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); } } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } else { if (prevLabel == 'prevRedguySound') { prevRedguySound = newPrevNumber; } else { if (prevLabel == 'prevRedguyHurt') { prevRedguyHurt = newPrevNumber; } else { if (prevLabel == 'prevSleepSound') { prevSleepSound = newPrevNumber; } } } } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } else { if (prevLabel == 'prevRedguySound') { return prevRedguySound; } else { if (prevLabel == 'prevRedguyHurt') { return prevRedguyHurt; } else { if (prevLabel == 'prevSleepSound') { return prevSleepSound; } } } } } } } } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; var sporeSounds = new Array('sp-01', 'sp-02', 'sp-03', 'sp-04', 'sp-05', 'sp-06', 'sp-07', 'sp-08', 'sp-09', 'sp-10', 'sp-11', 'sp-12', 'sp-13', 'sp-14', 'sp-15', 'sp-16', 'sp-17', 'sp-18', 'sp-19', 'sp-20', 'sp-21', 'sp-22'); var spore2Sounds = new Array('sr-01', 'sr-02', 'sr-03', 'sr-04', 'sr-05', 'sr-06', 'sr-07', 'sr-08', 'sr-09', 'sr-10', 'sr-11', 'sr-12', 'sr-13', 'sr-14', 'sr-15', 'sr-16', 'sr-17', 'sr-18', 'sr-19', 'sr-20', 'sr-21', 'sr-22'); var sporeResetSounds = new Array('resetSpawn-01', 'resetSpawn-02', 'resetSpawn-03', 'resetSpawn-04'); var bugIdleSounds = new Array('bug-01.wav', 'bug-02.wav', 'bug-03.wav', 'bug-04.wav', 'bug-05.wav', 'bug-06.wav', 'bug-07.wav', 'bug-08.wav', 'bug-09.wav', 'bug-10.wav', 'bug-11.wav', 'bug-12.wav', 'bug-13.wav', 'bug-14.wav', 'bug-15.wav', 'bug-16.wav', 'bug-17.wav', 'bug-18.wav', 'bug-19.wav', 'bug-20.wav', 'bug-21.wav', 'bug-22.wav', 'bug-23.wav', 'bug-24.wav', 'bug-25.wav', 'bug-26.wav', 'bug-27.wav', 'bug-28.wav', 'bug-29.wav', 'bug-30.wav', 'bug-31.wav', 'bug-32.wav', 'bug-33.wav', 'bug-34.wav', 'bug-35.wav', 'bug-36.wav', 'bug-37.wav', 'bug-38.wav', 'bug-39.wav', 'bug-40.wav', 'bug-41.wav', 'bug-42.wav'); var bugHurtSounds = new Array('bugHurt-01.wav', 'bugHurt-02.wav', 'bugHurt-03.wav', 'bugHurt-04.wav', 'bugHurt-05.wav', 'bugHurt-06.wav'); var prevBugHurt = 0; var gatorSounds = new Array('gaderbite.wav', 'gaderbite2.wav', 'gaderbite3.wav'); var prevGatorSound = 0; var redguySounds = new Array('red-01.wav', 'red-02.wav', 'red-03.wav', 'red-04.wav', 'red-05.wav', 'red-06.wav', 'red-07.wav', 'red-08.wav', 'red-09.wav', 'red-10.wav', 'red-11.wav', 'red-12.wav', 'red-13.wav', 'red-14.wav', 'red-15.wav', 'red-16.wav', 'red-17.wav', 'red-18.wav', 'red-19.wav', 'red-20.wav', 'red-21.wav', 'red-22.wav'); var prevRedguySound = 0; var redguyHurtSounds = new Array('redhurt-01.wav', 'redhurt-02.wav', 'redhurt-03.wav', 'redhurt-04.wav', 'redhurt-05.wav'); var prevRedguyHurt = 0; var sleepSounds = new Array('sleep-03.wav', 'sleep-04.wav', 'sleep-05.wav', 'sleep-06.wav'); var prevSleepSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { rotation = 0; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop(_root.stageBackground); } } } movieClip 1685 { frame 1 { stop(); } } movieClip 1686 { frame 1 { var attachPoint = terrainComposite.attachPoint; } } instance terrain of movieClip 1686 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } movieClip 1688 { } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(2); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(3); } } instance of movieClip 714 AllSeed { onClipEvent (load) { var active = true; this.gotoAndStop(2); } } instance of movieClip 1165 { onClipEvent (load) { var myLevel = 'main'; var myWeapon = 2; } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function discardWeapon() { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var v2 = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); v2.power = weapon; v2.graphicMC.gotoAndStop(weapon); weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(v2); } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { if (controlArrestTimer <= 0) { controlArrested = true; controlArrestTimer = 5; } else { controlArrested = false; _x = _x + (Math.random() - 0.5); _y = _y + (Math.random() - 0.5); trace('jostle'); } } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && v1 < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var noShiftCounter = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7', 'gs8']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; if (!_root.mainLevel) { weapon = _root.heldWeapon; } var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.hud.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { if (Key.getCode() >= 65 && Key.getCode() <= 90) { _root.selectedLetter = Key.getCode() - 64; } if (!_root.releaseBuild) { if (Key.isDown(49)) { weapon = 1; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(50)) { weapon = 2; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(51)) { weapon = 3; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(52)) { weapon = 4; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(53)) { weapon = 5; _root.heldWeapon = weapon; _root.updateWeaponInventory(weapon); } if (Key.isDown(57)) { _root.TriggerCutscene(100, this); } if (Key.isDown(17)) { _root.nextLoadedScene = 'level3'; _root.Die(); } } } if (weapon != 5) { if (invincibleTimer > 0) { --invincibleTimer; } if (invincibleTimer == 0 && invincible) { setVincible(); } } else { invincible = true; invincibleTimer = 0; guyMask.gotoAndStop('solid'); } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x, _y, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true) && !invincible) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true) && !invincible) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } audioManager.triggerNonrepeatingSound('prevPlatSound', 'platSound', audioManager.platSounds, 5); } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 3) { arm.gotoAndStop('spray'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } else { if (weapon == 3) { arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { discardWeapon(); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } var distanceFromCenter = _root.distanceBetweenPoints(_x, _y, 0, 0); if (weapon == 5) { if (distanceFromCenter > 5000) { _root.gameEnding = true; _root.actionWindow.gotoAndStop('static'); _root.Inventory._alpha -= 0.1; _root.hud._alpha -= 0.1; _root.beatenGameOnce = true; _root.saveGame(); com.newgrounds.API.unlockMedal('Pink Prison'); if (_root.hardcoreGame) { com.newgrounds.API.unlockMedal('Lucid Dreamer'); } } if (distanceFromCenter > 8000) { controlArrested = true; controlArrestTimer = 99999; runSpeed = 0; hitPush = 0; } if (distanceFromCenter > 12000) { if (_xscale < 1) { _root.flippedEndingGuy = true; } _root.animHookupFrame = anim._currentframe; trace(_root.animHookupFrame); _root.gotoAndPlay('ending'); } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.5) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3); var inventoryMax = 4; var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; var hasInfiniseed = false; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (!hasInfiniseed) { if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 18 { function checkOutOfBounds(inputX, inputY) { return !terrain.hitTest(_root.guy); } stop(); var nextLoadedScene = 'main'; var mainLevel = false; var introPlaying = false; gravityIndicatorEnabled = false; } instance stageManager of movieClip 875 { onClipEvent (load) { this._alpha = 0; var activeBugs = new Array(); var sleepables = new Array(); var spores = new Array(); var seeds = new Array(); var powerups = new Array(); } } instance audioManager of movieClip 877 { onClipEvent (load) { function setPrevSound(prevLabel, newPrevNumber) { if (prevLabel == 'prevPickaxeHit') { prevPickaxeHit = newPrevNumber; } else { if (prevLabel == 'prevJumpSound') { prevJumpSound = newPrevNumber; } else { if (prevLabel == 'prevBugHurt') { prevBugHurt = newPrevNumber; } else { if (prevLabel == 'prevOuchSound') { prevOuchSound = newPrevNumber; } else { if (prevLabel == 'prevGatorSound') { prevGatorSound = newPrevNumber; } } } } } } function getPrevSound(prevLabel) { if (prevLabel == 'prevPickaxeHit') { return prevPickaxeHit; } else { if (prevLabel == 'prevJumpSound') { return prevJumpSound; } else { if (prevLabel == 'prevBugHurt') { return prevBugHurt; } else { if (prevLabel == 'prevOuchSound') { return prevOuchSound; } else { if (prevLabel == 'prevGatorSound') { return prevGatorSound; } } } } } } function fadeOut() { _root.fader.gotoAndPlay('fadeout'); } function playIntro() { if (!startedPlayingIntro) { introvox.start(); startedPlayingIntro = true; } } function newBGM(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'bgmmc' + bgms.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; bgms.push(v5); } function newWalk(asLinkage, startingVolume) { var v3 = this.attachMovie('soundEmpty', 'walkmc' + walkTracks.length, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v2 = new Sound(v3); v2.attachSound(asLinkage); v2.setVolume(startingVolume); v2.start(0, 9999); var v5 = {'sound': v2, 'targetVolume': startingVolume, 'floatVolume': startingVolume}; walkTracks.push(v5); } function triggerNonrepeatingSound(prevTrackerLabel, soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); v4.setVolume(soundVolume); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } function triggerSound(soundName, soundArray, soundVolume) { if (!_root.gameMuted) { var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); v3.setVolume(soundVolume); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } function triggerProximitySound(soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v5 = _root.distanceBetweenObjects(guy, object); if (v5 < range) { var v6 = {'x': 0, 'y': 0}; object.localToGlobal(v6); var v7 = v6.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v3 = new Sound(emptymc); v3.attachSound(chooseRandomSound(soundArray)); var v4 = maxVolume * (range - v5) / range; v4 = Math.max(Math.min(v4, maxVolume), 0); v3.setVolume(v4); v3.setPan(Math.min(Math.max(v7 * 200 - 100, -100), 100)); v3.start(); v3.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v3; } } } function triggerNonrepeatingProximitySound(prevTrackerLabel, soundName, soundArray, maxVolume, range, object) { if (!_root.gameMuted) { var v6 = _root.distanceBetweenObjects(guy, object); if (v6 < range) { var v7 = {'x': 0, 'y': 0}; object.localToGlobal(v7); var v9 = v7.x / screenWidth; var emptymc = this.attachMovie('soundEmpty', soundName, this.getNextHighestDepth(), {'_x': 0, '_y': 0}); var v4 = new Sound(emptymc); var v3 = _root.randomInt(0, soundArray.length - 1); if (v3 == getPrevSound(prevTrackerLabel)) { ++v3; if (v3 == soundArray.length) { v3 = 0; } } setPrevSound(prevTrackerLabel, v3); v4.attachSound(soundArray[v3]); var v5 = maxVolume * (range - v6) / range; v5 = Math.max(Math.min(v5, maxVolume), 0); v4.setVolume(v5); v4.setPan(Math.min(Math.max(v9 * 200 - 100, -100), 100)); v4.start(); v4.onSoundComplete = function () { emptymc.removeMovieClip(); }; return v4; } } } function stopSound(sound) { stoppingSounds.push(sound); } function chooseRandomSound(soundArray) { var v2 = _root.randomInt(0, soundArray.length - 1); return soundArray[v2]; } _visible = false; var guy = _root.guy; var screenWidth = Stage.width; var volumeLerpSpeed = 0.1; var bgms = new Array(); var walkVolumeLerpSpeed = 0.5; var walkTracks = new Array(); var stoppingSounds = new Array(); var pickaxeSounds = new Array('au_pick1', 'au_pick2', 'au_pick3', 'au_pick4', 'au_pick5', 'au_pick6', 'au_pick7', 'au_pick8'); var pickaxeHits = new Array('pickHit-01', 'pickHit-02', 'pickHit-03', 'pickHit-04', 'pickHit-05', 'pickHit-06'); var prevPickaxeHit = 0; var jumpSounds = new Array('au_jump-01', 'au_jump-02', 'au_jump-03', 'au_jump-04', 'au_jump-05', 'au_jump-06', 'au_jump-07'); var prevJumpSound = 0; var fallSounds = new Array('falling_1', 'falling_2', 'falling_3'); var playingFallSound = undefined; var fallSoundDucking = 0; var softLandSounds = new Array('softland-01', 'softland-02', 'softland-03', 'softland-04'); var hardLandSounds = new Array('hardland-01', 'hardland-02', 'hardland-03', 'hardland-04'); var ouchSounds = new Array('ouch-01.wav', 'ouch-02.wav', 'ouch-03.wav', 'ouch-04.wav', 'ouch-05.wav', 'ouch-06.wav'); var prevOuchSound = 0; newBGM('main1', 10); newBGM('main2', 1); newBGM('main3', 0); newBGM('main4', 10); newWalk('walk1', 0); newWalk('walkPlatform', 0); var startedPlayingIntro = false; var introvox = new Sound(this); introvox.attachSound('introVoice'); introvox.setVolume(70); introvox.onSoundComplete = fadeOut; } onClipEvent (enterFrame) { var faTriggerDistance = 1750; var finalAreaNearness = (faTriggerDistance - Math.min(_root.distanceBetweenObjects(_root.guy, _root.finalLevel), faTriggerDistance)) / faTriggerDistance; bgms[0].targetVolume = 10 * (1 - finalAreaNearness); bgms[3].targetVolume = (10 * (_root.camera.hearts._currentframe - 1) / 2) * (1 - finalAreaNearness); bgms[1].targetVolume = 20 * (_root.distanceBetweenObjects(_root.guy, _root.boundary) / _root.boundary.boundaryDistance[1]) * (1 - finalAreaNearness); bgms[2].targetVolume = 14 * finalAreaNearness; if (guy.runSpeed != 0 && guy.grounded && !_root.gamePaused) { walkTracks[0].targetVolume = 2; if (guy.onPlatform) { if (!startedPlayingIntro) { walkTracks[1].targetVolume = 30; } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[1].targetVolume = 0; } } else { walkTracks[0].targetVolume = 0; walkTracks[1].targetVolume = 0; } if (guy.fallTime > 50) { var fallVolume = 15; if (playingFallSound == undefined) { playingFallSound = triggerSound('fallingSound', fallSounds, fallVolume); playingFallSound.onSoundComplete = function () { playingFallSound.start(5.386); playingFallSound.setVolume(4); }; } var currentVolume = playingFallSound.getVolume(); if (currentVolume != fallVolume) { playingFallSound.setVolume(currentVolume + (fallVolume - currentVolume) * 0.2); } fallSoundDucking = Math.min((guy.fallTime - 50) / 200, 1); var i = 0; while (i < bgms.length) { bgms[i].floatVolume *= 1 - fallSoundDucking; ++i; } } else { if (playingFallSound != undefined) { stopSound(playingFallSound); playingFallSound = undefined; } } if (_root.gameMuted) { var i = 0; while (i < bgms.length) { bgms[i].targetVolume = 0; ++i; } var i = 0; while (i < walkTracks.length) { walkTracks[i].targetVolume = 0; ++i; } } var i = 0; while (i < bgms.length) { if (bgms[i].floatVolume != bgms[i].targetVolume) { bgms[i].floatVolume += (bgms[i].targetVolume - bgms[i].floatVolume) * volumeLerpSpeed; bgms[i].sound.setVolume(bgms[i].floatVolume); } ++i; } var i = 0; while (i < walkTracks.length) { if (walkTracks[i].floatVolume != walkTracks[i].targetVolume) { walkTracks[i].floatVolume += (walkTracks[i].targetVolume - walkTracks[i].floatVolume) * walkVolumeLerpSpeed; walkTracks[i].sound.setVolume(walkTracks[i].floatVolume); } ++i; } var i = 0; while (i < stoppingSounds.length) { var thisVolume = stoppingSounds[i].getVolume(); if (thisVolume <= 0 || stoppingSounds[i] == undefined) { stoppingSounds[i].stop(); stoppingSounds.splice(i, 1); --i; } else { stoppingSounds[i].setVolume(Math.max(thisVolume - 2, 0)); } ++i; } } } instance camera of movieClip 879 { onClipEvent (load) { if (target == undefined) { var target = _root.guy; } var positionSmoothing = 0.1; var rotationSmoothing = 0.03; var maxRotationDiff = 1; var maxMaxRotationDiff = 180; var maxRotationAccel = 15; } onClipEvent (enterFrame) { if (!_root.gamePaused || _root.cutsceneTimer > 0) { xDiff = target._x - _x; yDiff = target._y - _y; rotationDiff = (target._rotation - _rotation + 360 + 180) % 360 - 180; if (Math.abs(rotationDiff) > maxRotationDiff) { maxRotationDiff = Math.min(maxRotationDiff + maxRotationAccel, maxMaxRotationDiff); rotationDiff = Math.max(Math.min(rotationDiff, maxRotationDiff), -maxRotationDiff); } else { while (Math.abs(rotationDiff) + maxRotationAccel < maxRotationDiff) { maxRotationDiff -= maxRotationAccel; } } _x = _x + xDiff * positionSmoothing; _y = _y + yDiff * positionSmoothing; if (!_root.rotationLocked) { _rotation = _rotation + rotationDiff * rotationSmoothing; } else { rotation = 0; } } } } instance actionWindow of movieClip 977 { onClipEvent (load) { var camera = _root.camera; if (_root.backgroundsEnabled) { gotoAndStop('intro'); } } } movieClip 1689 { } movieClip 1690 { } movieClip 1693 { } movieClip 1694 { frame 1 { stop(); } frame 165 { stop(); } } movieClip 1695 { frame 1 { stop(); } } movieClip 1696 { frame 1 { var attachPoint = terrainComposite.attachPoint; } } instance terrain of movieClip 1696 { onClipEvent (load) { function hitTest2(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } if (hazardTerrain.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTest3(x, y, shapeFlag) { if (safetyAttachPoint.hitTest(x, y, shapeFlag)) { return true; } if (mainTerrain.hitTest(x, y, shapeFlag) || hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } else { return false; } } function hitTestHazard(x, y, shapeFlag) { if (hazardTerrain.hitTest(x, y, shapeFlag)) { if (neg.hitTest(x, y, shapeFlag)) { return false; } return true; } return false; } var mainTerrain = this.mainTerrain; var hazardTerrain = this.hazardTerrain; var safetyAttachPoint = _root.safetyAttachPoint; } } movieClip 1697 { frame 1 { stop(); } frame 73 { _root.audioManager.playIntro(); _root.terrain.mainTerrain.mc.play(); trace(_root.terrain.mainTerrain.mc); } frame 74 { stop(); } } instance of movieClip 1697 { onClipEvent (load) { var wentin = false; var distanceToTrigger = 50; } onClipEvent (enterFrame) { if (!wentin) { if (_root.distanceBetweenObjects(this, _root.guy) < distanceToTrigger) { wentin = true; _root.textPopupColliders.nextFrame(); _root.audioManager.triggerSound('zoop sound', new Array('zoop'), 3); _root.actionWindow.overlay.play(); _root.introPlaying = true; play(); } } else { if (Key.isDown(8)) { _root.fader.gotoAndPlay('fadeout'); } } } } movieClip 1703 { } movieClip 1704 { frame 391 { stop(); } } movieClip 1706 { frame 1 { stop(); } } movieClip 1707 { frame 1 { var targetFrame = 1; var defaultFrame = 5; var textAlpha = 100; onEnterFrame = function () { if (text._currentframe != targetFrame) { --text._alpha; if (text._alpha <= 0) { text.gotoAndStop(targetFrame); } } else { if (text._alpha <= 100) { if (text._currentframe != defaultFrame) { ++text._alpha; } } } }; } } instance tutorialText of movieClip 1707 { onClipEvent (load) { var camera = _root.camera; } } movieClip 1709 { } movieClip 1710 { frame 1 { stop(); } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 2; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 1; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { if (!_root.introPlaying) { _root.tutorialText.targetFrame = 3; } } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { if (_root.Inventory._currentframe == 22 && !_root.introPlaying) { _root.tutorialText.targetFrame = 4; } } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.gravityIndicatorEnabled = true; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 7; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.Inventory._currentframe != 22) { var stillMustTeach = true; } if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { if (_root.Inventory._currentframe == 22 && stillMustTeach) { _root.tutorialText.targetFrame = 4; } } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 6; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 6; } } } instance of movieClip 1709 { onClipEvent (enterFrame) { if (_root.distanceBetweenObjects(this, _root.guy) < this._width / 2) { _root.tutorialText.targetFrame = 7; } } } } instance textPopupColliders of movieClip 1710 { onClipEvent (enterFrame) { if (!this.hitTest(_root.guy._x, _root.guy._y, true)) { _root.tutorialText.targetFrame = _root.tutorialText.defaultFrame; } } } instance of movieClip 714 AllSeed { onClipEvent (load) { function specialGetFunction() { trace('specialget'); } var infiniseed = true; var active = true; this.gotoAndStop(12); } } instance guy of movieClip 1281 { onClipEvent (load) { function resetToSpawnPoint() { trace('reset to spawn (should only happen on tether level)'); if (!_root.mainLevel) { lastGroundedPosition = spawnPoint; lastGroundedRotation = spawnRotation; respawn(); } } function respawn() { _x = lastGroundedPosition.x; _y = lastGroundedPosition.y; rotateGuy(lastGroundedRotation); upNormal = rotatePointAroundOrigin(0, -1, _rotation); gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; onscreenSinceLastRespawn = false; if (!cancelSafety) { var v1 = 0; var v3 = 100; var v4 = 10; var v2 = true; while (v1 < v3) { v1 += v4; if (terrain.hitTest2(_x + llCor.x - upNormal.x * v1, _y + llCor.y - upNormal.y * v1, true) || spawnedObjects[i].hitTest2(_x + lrCor.x - upNormal.x * v1, _y + lrCor.y - upNormal.y * v1, true)) { v2 = false; break; } } if (v2) { var v5 = terrain.safetyAttachPoint.attachMovie('safety', 'spawn' + spawnedObjects.length, 1, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); spawnedObjects.push(v5); v5.spawnNumber = spawnedObjects.length - 1; } } else { cancelSafety = false; } if (!invincible) { hearts.takeHealth(false); } setInvincible(hitInvincibleTime); } function toggleStopwatch() { _root.itemsAttachPoint.attachMovie('TimestopFX', 'time stop fx', _root.itemsAttachPoint.getNextHighestDepth(), {'_x': this._x, '_y': this._y}); var v6 = _root.stageManager.activeBugs; var v3 = 0; while (v3 < v6.length) { if (_root.distanceBetweenPoints(_x, _y, v6[v3]._x, v6[v3]._y) < 110) { v6[v3].timeStopped = !v6[v3].timeStopped; } ++v3; } var v4 = _root.stageManager.sleepables; v3 = 0; while (v3 < v4.length) { if (_root.distanceBetweenPoints(_x, _y, v4[v3]._x, v4[v3]._y) < 150) { v4[v3].timeStopped = !v4[v3].timeStopped; if (v4[v3].timeStopped) { v4[v3].cloud3.stop(); } else { v4[v3].cloud3.play(); } } ++v3; } var v7 = _root.stageManager.spores; v3 = 0; while (v3 < v7.length) { if (_root.distanceBetweenPoints(_x, _y, v7[v3]._x, v7[v3]._y) < 105) { v7[v3].timeStopped = !v7[v3].timeStopped; } ++v3; } var v5 = _root.stageManager.powerups; v3 = 0; while (v3 < v5.length) { if (_root.distanceBetweenPoints(_x, _y, v5[v3]._x, v5[v3]._y) < 110) { v5[v3].timeStopped = !v5[v3].timeStopped; } ++v3; } if (_root.distanceBetweenPoints(_x, _y, _root.soccerball._x, _root.soccerball._y) < 110) { _root.soccerball.timeStopped = !_root.soccerball.timeStopped; } v3 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v3 < spawnedObjects.length) { if (spawnedObjects[v3].timeStopped) { var v8 = 5; if (spawnedObjects[v3].nega) { v8 *= -1; } if (spawnedObjects[v3].hitTest(_x - upNormal.x * v8, _y - upNormal.y * v8, true)) { spawnedObjects[v3].play(); spawnedObjects[v3].animating = true; spawnedObjects[v3].timeStopped = false; } } else { if (spawnedObjects[v3].animating) { spawnedObjects[v3].stop(); spawnedObjects[v3].animating = false; spawnedObjects[v3].timeStopped = true; spawnedObjects[v3].destroyImmediately = false; } } ++v3; } } function getHit(colX, colY) { if (!invincible) { hearts.takeHealth(false); setInvincible(hitInvincibleTime); controlArrested = true; controlArrestTimer = controlArrestTime; audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } else { controlArrested = true; controlArrestTimer = 5; } setUngrounded(); downForce = hitJumpStrength; var v3 = {'x': colX, 'y': colY}; _root.localToGlobal(v3); this.globalToLocal(v3); if (v3.x < 0) { if (facingLeft) { faceRight(); } else { faceLeft(); } } if (v3.y < -0.5 && !grounded) { downForce = 0; } hitPushActive = true; _x = _x + (_x - colX); _y = _y + (_y - colY); arm.gotoAndStop(1); reclaimCharged = false; reclaimSwinging = false; reclaimCharging = false; fallTime = 0; gotoAndStop('hit'); if (invincible) { gotoAndStop('reHit'); } } function setInvincible(setTime) { invincible = true; if (invincibleTimer < setTime) { invincibleTimer = setTime; } guyMask.gotoAndStop('blinking'); } function setVincible() { invincible = false; guyMask.gotoAndStop('solid'); } function setSeed() {} function DestroyCheck(cX, cY) { if (spawnedObjects.length > maxObjectsToCheck) { trace('max spawn count reached. problems incoming'); } var v1 = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (v1 < spawnedObjects.length) { if (!spawnedObjects[v1].animating) { if (spawnedObjects[v1].hitTest(cX, cY, true)) { if (!spawnedObjects[v1].timeStopped && !spawnedObjects[v1].animating) { spawnedObjects[v1].gotoAndPlay('destroy'); } else { spawnedObjects[v1].timeStopped = false; spawnedObjects[v1].animating = true; spawnedObjects[v1].play(); } audioManager.triggerNonrepeatingSound('prevPickaxeHit', 'pickaxeHitSound', audioManager.pickaxeHits, 11); return true; break; } } ++v1; } } function HitHittablesCheck(cX, cY) { var v8 = false; var v4 = _root.stageManager.activeBugs; var v2 = 0; while (v2 < v4.length) { if (_root.distanceBetweenPoints(cX, cY, v4[v2]._x, v4[v2]._y) < 28) { v4[v2].getHit(_x, _y); v8 = true; } ++v2; } var v5 = _root.stageManager.sleepables; v2 = 0; while (v2 < v5.length) { if (_root.distanceBetweenPoints(cX, cY, v5[v2]._x, v5[v2]._y) < 40) { v5[v2].getHit(cX, cY); v8 = true; } ++v2; } var v3 = _root.stageManager.powerups; v2 = 0; while (v2 < v3.length) { if (_root.distanceBetweenPoints(cX, cY, v3[v2]._x, v3[v2]._y) < 30) { v3[v2].getHit(_x, _y); v8 = true; } ++v2; } if (_root.distanceBetweenPoints(cX, cY, _root.soccerball._x, _root.soccerball._y) < 30) { _root.soccerball.getHit(_root.guy._x, _root.guy._y, 9); v8 = true; } return v8; } function fireBullet(type) { var v5 = _rotation; if (facingLeft) { v5 += 180; } var v4 = 1; if (facingLeft) { v4 = -1; } var v3 = rotatePointAroundOrigin(hitWidth + 4, (-hitHeight / 2) * v4, v5); if (weapon == 3) { var v7 = _root.scramblantAttachPoint.attachMovie(type, 'whatever', _root.scramblantAttachPoint.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); v7.forwardSpeed = 4 + Math.abs(runSpeed); } else { var v7 = _parent.attachMovie(type, 'whatever', _parent.getNextHighestDepth(), {'_x': _x + v3.x, '_y': _y + v3.y, '_rotation': v5, '_yscale': 100 * v4}); } } function faceLeft() { facingLeft = true; this._xscale = -100; hitPush = -absHitPush; } function faceRight() { facingLeft = false; this._xscale = 100; hitPush = absHitPush; } function nudgeOutFromLand(collidedCor) { if (prevGrounded) { _x = prevX; _y = prevY; rotateGuy(_rotation + 180); _x = _x + gravityNormal.x * hitWidth; _y = _y + gravityNormal.y * hitHeight; gravityNormal = {'x': -gravityNormal.x, 'y': -gravityNormal.y}; } else { var v1 = 0; while (terrain.hitTest2(_x + collidedCor.x, _y + collidedCor.y, true)) { _x = _x - incomingNormal.x; _y = _y - incomingNormal.y; ++v1; if (v1 > 25) { if (tryPerpNudge(5)) { break; } else { if (tryPerpNudge(10)) { break; } else { if (tryPerpNudge(15)) { break; } else { if (tryPerpNudge(20)) { break; } else { if (tryPerpNudge(30)) { break; } else { respawnThisFrame = true; cancelSafety = true; trace('hurty bust'); } } } } } break; } } } } function tryPerpNudge(perpCheckDist) { if (!terrain.hitTest2(_x + collidedCor.x - incomingNormal.y * perpCheckDist, _y + collidedCor.y + incomingNormal.x * perpCheckDist, true)) { _x = _x - incomingNormal.y * perpCheckDist; _y = _y + incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } else { if (!terrain.hitTest2(_x + collidedCor.x + incomingNormal.y * perpCheckDist, _y + collidedCor.y - incomingNormal.x * perpCheckDist, true)) { _x = _x + incomingNormal.y * perpCheckDist; _y = _y - incomingNormal.x * perpCheckDist; trace('perp bust: ' + perpCheckDist); return true; } } } function setGrounded() { grounded = true; shortHopping = false; hitGroundSinceRespawn = true; hitPushActive = false; if (fallTime < 50 || downForce > -9) { if (runSpeed == 0) { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 10); } else { audioManager.triggerSound('softLandSound', audioManager.softLandSounds, 5); } } else { audioManager.triggerSound('hardLandSound', audioManager.hardLandSounds, 30); } fallTime = 0; downForce = 0; } function setUngrounded() { grounded = false; gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); } function setLastGroundedPosition() { if (!_root.checkOutOfBounds(_x, _y)) { lastGroundedPosition = {'x': prevX, 'y': prevY}; lastGroundedRotation = _rotation; } } function rotatePointAroundOrigin(xInput, yInput, degrees) { var v2 = Math.cos(degrees * deg2Rad); var v1 = Math.sin(degrees * deg2Rad); var v4 = xInput * v2 - yInput * v1; var v3 = xInput * v1 + yInput * v2; return {'x': v4, 'y': v3}; } function rotatePointAroundPoint(moverX, moverY, pivotX, pivotY, degrees) { moverX -= pivotX; moverY -= pivotY; var v1 = rotatePointAroundOrigin(moverX, moverY, degrees); return {'x': v1.x + pivotX, 'y': v1.y + pivotY}; } function normalizeVector(inputX, inputY) { var v1 = Math.sqrt(inputX * inputX + inputY * inputY); return {'x': inputX / v1, 'y': inputY / v1}; } function rotateGuy(targetDegrees) { _rotation = targetDegrees; llCor = rotatePointAroundOrigin(-hitWidth / 2, 0, _rotation); lrCor = rotatePointAroundOrigin(hitWidth / 2, 0, _rotation); ulCor = rotatePointAroundOrigin(-hitWidth / 2, -hitHeight, _rotation); urCor = rotatePointAroundOrigin(hitWidth / 2, -hitHeight, _rotation); } function rotatellCorIntoPosition() { var v1 = 0; for (;;) { if (!(!terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, -slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } v1 = 0; for (;;) { if (!(terrain.hitTest3(_x + llCor.x, _y + llCor.y, true) && v1 < 360 / slopeCheckStep)) break; llCor = rotatePointAroundPoint(llCor.x, llCor.y, lrCor.x, lrCor.y, slopeCheckStep); ++v1; } if (v1 >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function rotatelrCorIntoPosition() { i = 0; for (;;) { if (!(!terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, slopeCheckStep); ++i; } if (i >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } i = 0; for (;;) { if (!(terrain.hitTest3(_x + lrCor.x, _y + lrCor.y, true) && i < 360 / slopeCheckStep)) break; lrCor = rotatePointAroundPoint(lrCor.x, lrCor.y, llCor.x, llCor.y, -slopeCheckStep); ++i; } if (i >= 360 / slopeCheckStep - 1) { respawnThisFrame = true; trace('guy stuck?'); } } function resolveLanding(cornerPoint) { nudgeOutFromLand(cornerPoint); rotateClosestCornerIntoPosition(cornerPoint); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; rotateGuy(Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg); setGrounded(); } function rotateClosestCornerIntoPosition(pivotCorner) { var v2; var v3; if (pivotCorner == llCor) { v2 = lrCor; v3 = ulCor; } else { if (pivotCorner == lrCor) { v2 = urCor; v3 = llCor; } else { if (pivotCorner == ulCor) { v2 = llCor; v3 = urCor; } else { if (pivotCorner == urCor) { v2 = ulCor; v3 = lrCor; } } } } var v4 = false; var v5 = 0; var v7 = false; var v6 = false; if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v7 = true; } else { if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v6 = true; } } for (;;) { if (!(!v4 && v5 < 360 / slopeCheckStep)) break; if (!v7) { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); } } else { v2 = rotatePointAroundPoint(v2.x, v2.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (!terrain.hitTest2(_x + v2.x, _y + v2.y, true)) { v4 = true; llCor = pivotCorner; lrCor = v2; } } if (!v6) { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, -slopeCheckStep); if (terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); } } else { v3 = rotatePointAroundPoint(v3.x, v3.y, pivotCorner.x, pivotCorner.y, slopeCheckStep); if (!terrain.hitTest2(_x + v3.x, _y + v3.y, true)) { v4 = true; llCor = v3; lrCor = pivotCorner; } } ++v5; } if (v5 >= 360 / slopeCheckStep) { trace('problem finding slope on landing'); } } var youCanDie = true; var terrain = _parent.terrain; var Inventory = _root.Inventory; var audioManager = _root.audioManager; var pickaxeSound = undefined; var jumpSound = undefined; var controls = _root.controls; var jumpKeyHeld = false; var spawnKeyHeld = false; var runSpeed = 0; var maxRunSpeed = 4; var runAccel = 1; var grounded = false; var gravityNormal = {'x': 0, 'y': -1}; var gravityStrength = 0.6; var jumpStrength = 13; var downForce = 0; var maxDownForce = 10; var fallTime = 0; var gravityLerping = true; var glerpRotation = _rotation; var glerpMax = 1; var idleGlerpMax = 1; var walkingGlerpMax = 8; var hitJumpStrength = 8; var hitPush = -2; var absHitPush = -2; var lastGroundedPosition = {'x': _x, 'y': _y}; var lastGroundedRotation = _rotation; var shortHopping = false; var slopeCheckDistance = 15; var slopeCheckStep = 0.5; var rad2Deg = 57.29577951308232; var deg2Rad = 0.0174532925199433; var hitWidth = slopeCheckDistance * 2; var hitHeight = slopeCheckDistance * 2; var llCor = {'x': -hitWidth / 2, 'y': 0}; var lrCor = {'x': hitWidth / 2, 'y': 0}; var ulCor = {'x': -hitWidth / 2, 'y': -hitHeight}; var urCor = {'x': hitWidth / 2, 'y': -hitHeight}; var onPlatform = false; var onShiftingTerrain = false; var shiftingTerrainDistanceCheck = 10; var shiftingTerrainTimer = 0; var respawnThisFrame = false; var spawnPoint = {'x': _x, 'y': _y}; var spawnRotation = _rotation; var vcamSavedXScale; var vcamSavedYScale; var vcamSavedX; var vcamSavedY; var vcamSavedRotation; var usingBoundary = true; var offscreenTimer = 0; var maxOffscreenTime = 60; var onscreenSinceLastRespawn = true; var spawnedObjects = new Array(); var seeds = ['gs2', 'gs3', 'gs4', 'ns5', 'gs6', 'ns7']; var selectedSeed = 0; var cancelSafety = false; var weapon = 1; var weaponKeyHeld = false; var discardKeyHeld = false; var discardKeycode = 90; var reclaimCharged = false; var reclaimSwinging = false; var reclaimCharging = false; var framesWeaponHeld = 0; var platformsStopped = false; _root.updateWeaponInventory(weapon); var hearts = _root.camera.hearts; var startingHealth = 3; hearts.gotoAndStop(startingHealth); var hasDied = false; var invincible = true; var invincibleTimer = 80; var hitInvincibleTime = 120; var controlArrested = false; var controlArrestTimer = 0; var controlArrestTime = 30; var hitPushActive = false; var prevTouchingHazardTerrain = false; var facingLeft = false; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (Key.isDown(16)) { } if (invincibleTimer > 0) { --invincibleTimer; if (invincibleTimer == 0) { setVincible(); } } if (controlArrestTimer > 0) { --controlArrestTimer; if (controlArrestTimer == 0) { controlArrested = false; } } var prevX = _x; var prevY = _y; var prevGrounded = grounded; var prevRot = _rotation; var prevLLCor = llCor; var prevLRCor = lrCor; respawnThisFrame = false; if (Key.isDown(controls.jump) && !jumpKeyHeld) { if (grounded) { jumpKeyHeld = true; setUngrounded(); downForce = jumpStrength; gotoAndStop('jump'); jumpSound = audioManager.triggerNonrepeatingSound('prevJumpSound', 'jumpSound', audioManager.jumpSounds, 5); } } else { if (!Key.isDown(controls.jump) && jumpKeyHeld) { jumpKeyHeld = false; if (!grounded) { if (!shortHopping) { if (downForce > 0) { shortHopping = true; downForce = 0; audioManager.stopSound(jumpSound); } } } } } if (controlArrested) { runSpeed = hitPush; } else { if (!reclaimSwinging) { if (Key.isDown(controls.walkleft)) { if (runSpeed > 0) { runSpeed = 0; } runSpeed -= runAccel; if (runSpeed < -maxRunSpeed) { runSpeed = -maxRunSpeed; } if (!facingLeft) { faceLeft(); } hitPushActive = false; glerpMax = walkingGlerpMax; } else { if (Key.isDown(controls.walkright)) { if (runSpeed < 0) { runSpeed = 0; } runSpeed += runAccel; if (runSpeed > maxRunSpeed) { runSpeed = maxRunSpeed; } if (facingLeft) { faceRight(); } hitPushActive = false; } else { if (runSpeed != 0 && !hitPushActive) { runSpeed = 0; glerpMax = idleGlerpMax; } } } } else { if (grounded) { runSpeed = 0; } } } if (runSpeed != 0) { var moveVector = {'x': runSpeed, 'y': 0}; moveVector = rotatePointAroundOrigin(moveVector.x, moveVector.y, _rotation); _x = _x + moveVector.x; _y = _y + moveVector.y; if (grounded) { if (!controlArrested) { gotoAndStop('walking'); } } } else { if (grounded) { gotoAndStop('idle'); } } if (!grounded) { downForce -= gravityStrength; if (downForce < -maxDownForce) { downForce = -maxDownForce; ++fallTime; if (fallTime == 50) { if (invincibleTimer == 0) { gotoAndStop('falling'); } } } _x = _x + downForce * gravityNormal.x; _y = _y + downForce * gravityNormal.y; var incomingNormal = {'x': _x - prevX, 'y': _y - prevY}; incomingNormal = normalizeVector(incomingNormal.x, incomingNormal.y); if (terrain.hitTest2(_x + ulCor.x, _y + ulCor.y, true)) { resolveLanding(ulCor); } else { if (terrain.hitTest2(_x + urCor.x, _y + urCor.y, true)) { resolveLanding(urCor); } else { if (terrain.hitTest2(_x + llCor.x, _y + llCor.y, true)) { resolveLanding(llCor); } else { if (terrain.hitTest2(_x + lrCor.x, _y + lrCor.y, true)) { resolveLanding(lrCor); } } } } } if (grounded) { glerpRotation = (glerpRotation + _root.clamp(_root.getRotationDiff(glerpRotation, _rotation), -glerpMax, glerpMax)) % 360; var upNormal = rotatePointAroundOrigin(0, -1, _rotation); var spaceBelowFeet = 0; var maxObjectsToCheck = 1000; onPlatform = false; var onNega = false; var i = Math.max(0, spawnedObjects.length - maxObjectsToCheck); while (i < spawnedObjects.length) { var thisDistanceCheck = shiftingTerrainDistanceCheck; if (spawnedObjects[i].nega) { thisDistanceCheck *= -1; } if (spawnedObjects[i].hitTest(_x + llCor.x - upNormal.x * thisDistanceCheck, _y + llCor.y - upNormal.y * thisDistanceCheck, true) || spawnedObjects[i].hitTest(_x + lrCor.x - upNormal.x * thisDistanceCheck, _y + lrCor.y - upNormal.y * thisDistanceCheck, true)) { if (spawnedObjects[i].animating) { onShiftingTerrain = true; shiftingTerrainTimer = 7; } onPlatform = true; if (spawnedObjects[i].nega) { onNega = true; } } ++i; } if (onShiftingTerrain) { for (;;) { if (!(spaceBelowFeet < 15 && (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)))) break; ++spaceBelowFeet; } if (spaceBelowFeet > 3) { if (!terrain.hitTest2(_x + llCor.x - upNormal.x * spaceBelowFeet, _y + llCor.y - upNormal.y * spaceBelowFeet, true) || !terrain.hitTest2(_x + lrCor.x - upNormal.x * spaceBelowFeet, _y + lrCor.y - upNormal.y * spaceBelowFeet, true)) { rotateGuy(glerpRotation); setUngrounded(); gotoAndStop('fall'); } } --shiftingTerrainTimer; if (shiftingTerrainTimer == 0) { onShiftingTerrain = false; glerpRotation = _rotation; } } else { if (!onNega) { setLastGroundedPosition(); } } if (grounded) { if (prevX != _x || prevY != _y || spaceBelowFeet > 0 || onShiftingTerrain) { rotatellCorIntoPosition(); rotatelrCorIntoPosition(); _x = (_x + llCor.x + _x + lrCor.x) / 2; _y = (_y + llCor.y + _y + lrCor.y) / 2; var newRotation = Math.atan2(lrCor.y - llCor.y, lrCor.x - llCor.x) * rad2Deg; rotateGuy(newRotation); if (prevGrounded) { var rotationDiff = Math.abs((newRotation - prevRot + 360 + 180) % 360 - 180); if (rotationDiff > 8) { } } } } } _parent.lp._x = _x + llCor.x; _parent.lp._y = _y + llCor.y; _parent.rp._x = _x + lrCor.x; _parent.rp._y = _y + lrCor.y; var hitCorner = undefined; if (terrain.hitTestHazard(_x + llCor.x * 1.02, _y + llCor.y * 1.02, true)) { getHit(_x + llCor.x, _y + llCor.y); hitCorner = llCor; } else { if (terrain.hitTestHazard(_x + lrCor.x * 1.02, _y + lrCor.y * 1.02, true)) { getHit(_x + lrCor.x, _y + lrCor.y); hitCorner = lrCor; } else { if (terrain.hitTestHazard(_x + ulCor.x * 1.02, _y + ulCor.y * 1.02, true)) { getHit(_x + ulCor.x, _y + ulCor.y); hitCorner = ulCor; } else { if (terrain.hitTestHazard(_x + urCor.x * 1.02, _y + urCor.y * 1.02, true)) { getHit(_x + urCor.x, _y + urCor.y); hitCorner = urCor; } } } } if (hitCorner != undefined) { _x = prevX; _y = prevY; } if (grounded && !controlArrested) { if (Key.isDown(controls.plantseed) && !spawnKeyHeld) { spawnKeyHeld = true; if (Inventory.inventory.length != 0) { var seedType = Inventory.inventory[0]; if (seedType == 5 || seedType == 7) { var mc = terrain.neg.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } else { var mc = terrain.mainTerrain.attachPoint.attachMovie(seeds[Inventory.inventory[0] - 2], 'spawn' + spawnedObjects.length, -spawnedObjects.length, {'_x': _x - terrain._x, '_y': _y - terrain._y, '_rotation': _rotation}); } spawnedObjects.push(mc); mc.spawnNumber = spawnedObjects.length - 1; if (!Inventory.hasInfiniseed) { Inventory.inventory.shift(); Inventory.updateInventoryDisplay(); if (Inventory.inventory.length != 0) { Inventory.gotoAndPlay('shiftLeft'); } } } } else { if (!Key.isDown(controls.plantseed) && spawnKeyHeld) { spawnKeyHeld = false; } } } if (Key.isDown(controls.usetool) && !weaponKeyHeld) { weaponKeyHeld = true; if (!reclaimSwinging) { if (weapon == 1) { this.arm.gotoAndStop('reclaimCharge'); reclaimCharging = true; pickaxeSound = audioManager.triggerSound('pickaxeSound', audioManager.pickaxeSounds, 40); } else { if (weapon == 2) { this.arm.gotoAndStop('retriever'); gotoAndStop('useItem'); fireBullet('Retriever'); } else { if (weapon == 4) { toggleStopwatch(); } } } } } else { if (!Key.isDown(controls.usetool) && weaponKeyHeld) { weaponKeyHeld = false; if (weapon == 1) { audioManager.stopSound(pickaxeSound); if (reclaimCharged) { this.arm.gotoAndStop('reclaimSwing'); reclaimCharged = false; reclaimSwinging = true; reclaimCharging = false; gotoAndStop('useItem'); } else { this.arm.gotoAndStop(1); } } } else { if (weaponKeyHeld) { if (weapon == 3) { ++framesWeaponHeld; if (framesWeaponHeld == 2) { framesWeaponHeld = 0; fireBullet('Scramblant Particle'); } } } } } if (Key.isDown(controls.discardtool) && !discardKeyHeld) { discardKeyHeld = true; if (!_root.checkOutOfBounds(_x + llCor.x, _y + llCor.y) && !_root.checkOutOfBounds(_x + lrCor.x, _y + lrCor.y)) { if (weapon != 1) { gravityNormal = rotatePointAroundOrigin(0, -1, _rotation); var spawnedPowerup = _root.itemsAttachPoint.attachMovie('powerup', 'power' + weapon, _root.itemsAttachPoint.getNextHighestDepth(), {'_x': _x + gravityNormal.x * 30, '_y': _y + gravityNormal.y * 30, '_rotation': _rotation}); spawnedPowerup.power = weapon; spawnedPowerup.graphicMC.gotoAndStop(weapon); weapon = 1; _root.updateWeaponInventory(1); _root.flagIndicator.startTrackingPowerup(spawnedPowerup); } else { if (grounded) { _root.flag.placeFlag(_x, _y, _rotation); _root.flagIndicator.startTrackingFlag(); } } } } else { if (!Key.isDown(controls.discardtool) && discardKeyHeld) { discardKeyHeld = false; } } if (usingBoundary) { if (!invincible) { if (!respawnThisFrame) { respawnThisFrame = _root.checkOutOfBounds(_x, _y); } } } else { if (!terrain.hitTest(_parent.camera)) { if (onscreenSinceLastRespawn) { ++offscreenTimer; if (offscreenTimer > maxOffscreenTime) { respawnThisFrame = true; offScreenTimer = 0; } } } else { if (offscreenTimer != 0) { offscreenTimer = 0; } if (!onscreenSinceLastRespawn) { onscreenSinceLastRespawn = true; } } } if (respawnThisFrame) { respawn(); audioManager.triggerNonrepeatingSound('prevOuchSound', 'ouchSound', audioManager.ouchSounds, 3); } if (hasDied && grounded) { gotoAndStop('die'); arm.gotoAndStop(1); _root.TriggerCutscene(800, this); } } } } instance of movieClip 1181 { onClipEvent (load) { var guy = _parent.guy; } onClipEvent (enterFrame) { if (!_root.gamePaused) { if (_root.gravityIndicatorEnabled) { _x = guy._x; _y = guy._y; if (Math.abs(_rotation - guy._rotation) > 0.5) { gotoAndPlay('transparent'); } _rotation = guy._rotation; } else { gotoAndStop('transparent'); } } } } instance Inventory of movieClip 1287 { onClipEvent (load) { function updateInventoryDisplay() { var v1 = 0; while (v1 < inventorySlots.length) { if (v1 < inventory.length) { inventorySlots[v1].gotoAndStop(inventory[v1]); } else { inventorySlots[v1].gotoAndStop(1); } ++v1; } } function addSeed(seedType) { inventory.unshift(seedType); updateInventoryDisplay(); } function addSeedToEnd(seedType) { inventory.push(seedType); updateInventoryDisplay(); } var inventory = new Array(); var inventorySlots = new Array(this.i0, this.i1, this.i2, this.i3, this.i4, this.i5, this.i6); var leftCarHeld = false; var rightCarHeld = false; var guy = _root.guy; var target = _root.camera; updateInventoryDisplay(); } onClipEvent (enterFrame) { var offsetRotation = target._rotation + _root.getRotationDiff(target._rotation, guy._rotation) * 0.5; var markerPosition = {'x': guy.anim.seedMarker._x, 'y': guy.anim.seedMarker._y}; markerPosition.x *= guy.anim._xscale / 100; markerPosition.x -= guy.anim._x; markerPosition.y *= guy.anim._yscale / 100; markerPosition.y -= guy.anim._y; var offset = _root.rotatePointAroundOrigin(markerPosition.x, markerPosition.y, offsetRotation); _x = _x + (guy._x + offset.x - _x) * 0.3; _y = _y + (guy._y + offset.y - _y) * 0.3; _rotation = target._rotation; if (Key.isDown(190)) { if (!rightCarHeld) { rightCarHeld = true; if (inventory.length > 0) { inventory.push(inventory.shift()); updateInventoryDisplay(); } this.gotoAndPlay('shiftLeft'); } } else { if (rightCarHeld) { rightCarHeld = false; } } if (Key.isDown(188)) { if (!leftCarHeld) { leftCarHeld = true; if (inventory.length > 0) { inventory.unshift(inventory.pop()); updateInventoryDisplay(); } this.gotoAndPlay('shiftRight'); } } else { if (leftCarHeld) { leftCarHeld = false; } } } } instance of movieClip 1651 { onClipEvent (load) { var target = _parent.camera; } onClipEvent (enterFrame) { if (!_root.gamePaused) { _x = target._x; _y = target._y; _rotation = target._rotation; _xscale = target._xscale; _yscale = target._yscale; } } } frame 20 { actionWindow.gotoAndStop('staticSwitch'); stopAllSounds(); _root._xscale = 100; _root._yscale = 100; _root._x = 0; _root._y = 0; _root._rotation = 0; _root._visible = true; _root._alpha = 100; } instance actionWindow of movieClip 977 { onClipEvent (load) { gotoAndStop('static'); } } movieClip 1711 { frame 116 { stop(); } } instance of movieClip 1711 { onClipEvent (load) { if (_root.flippedEndingGuy) { _xscale = _xscale * -1; } endingGuy.gotoAndPlay(_root.animHookupFrame); trace(_root.animHookupFrame); } } frame 21 { stop(); } // unknown tag 88 length 96 movieClip 1714 { frame 1201 { _root.play(); } frame 1600 { updateVisualizer(); } frame 2000 { updateVisualizer(); } frame 2400 { updateVisualizer(); } frame 2800 { updateVisualizer(); } frame 3198 { updateVisualizer(); } frame 3598 { updateVisualizer(); } frame 3998 { updateVisualizer(); } frame 4193 { updateVisualizer(); } frame 4397 { updateVisualizer(); } frame 4596 { updateVisualizer(); } frame 4996 { updateVisualizer(); } frame 6000 { updateVisualizer(); } frame 6596 { updateVisualizer(); } frame 6992 { updateVisualizer(); } frame 7394 { updateVisualizer(); } frame 7790 { updateVisualizer(); } frame 8192 { updateVisualizer(); } frame 8391 { updateVisualizer(); } frame 8593 { updateVisualizer(); } frame 8791 { updateVisualizer(); } frame 8990 { updateVisualizer(); } frame 9191 { updateVisualizer(); } frame 9388 { updateVisualizer(); } frame 9589 { updateVisualizer(); } frame 9781 { updateVisualizer(); } frame 9987 { updateVisualizer(); } frame 10182 { updateVisualizer(); } frame 10590 { updateVisualizer(); } frame 10990 { updateVisualizer(); } frame 11390 { updateVisualizer(); } frame 11790 { updateVisualizer(); } frame 12190 { updateVisualizer(); } frame 13188 { updateVisualizer(); } } instance of movieClip 1714 { onClipEvent (load) { function updateVisualizer() { _root.bigfilter.nextFrame(); if (_root.sunrayRandom) { _root.sunrayRandom = false; } _root.rippleModulation = !_root.rippleModulation; selectEffect = Math.floor(Math.random() * 6) + 1; if (selectEffect == 1) { updateRadials(); _root.sunrayLoop = false; _root.sunrayRandom = true; } else { if (selectEffect == 2) { _root.sunrayLoop = false; _root.raysZoom.raysColors.nextFrame(); } else { if (selectEffect == 3) { _root.concentrics.play(); _root.whitepulse.nextFrame(); _root.spindust.nextFrame(); } else { if (selectEffect == 4) { _root.shapeTextures.gotoAndStop(Math.floor(Math.random() * 4 + 2)); _root.whitepulse.nextFrame(); updateRadials(); } else { if (selectEffect == 5) { _root.whitepulse.nextFrame(); _root.spindust.nextFrame(); _root.radialColors.nextFrame(); _root.sunrayLoop = false; } else { if (selectEffect == 6) { _root.raysZoom.raysColors.rays.play(); _root.sunrayLoop = true; _root.raysZoom.raysColors.nextFrame(); } } } } } } _root.whitepulse.pulser.gotoAndPlay(1); } function updateRadials() { ++radialPattern; switch (radialPattern) { case 2: _root.radialColors.pattern.gotoAndPlay('pattern2'); break; case 3: _root.radialColors.pattern.gotoAndPlay('pattern3'); break; case 4: _root.radialColors.pattern.gotoAndPlay('pattern4'); break; case 5: _root.radialColors.pattern.gotoAndPlay('pattern5'); break; default: radialPattern = 1; _root.radialColors.pattern.gotoAndPlay('pattern1'); } } var radialPattern = 1; } } frame 22 { sunrayResetVariance = 5; maxSunrayResetVariance = 29; sunrayLoop = true; sunrayRandom = false; rippleModulation = false; _quality = 'LOW'; } movieClip 1787 { frame 64 { if (_root.sunrayLoop) { if (!_root.sunrayRandom) { gotoAndPlay(1); } else { gotoAndPlay(Math.floor(Math.random() * 20) + 1); } } else { if (!_root.sunrayRandom) { if (!_root.rippleModulation) { gotoAndPlay(65 + Math.ceil((_rotation + 180) * 0.25)); } else { if (_parent._parent._parent._currentframe % 2 == 0) { gotoAndPlay(65 + Math.ceil((_rotation + 180) * 0.25)); } else { gotoAndPlay(65 + Math.ceil((_rotation + 180) * 0.125)); } } } else { gotoAndPlay(Math.floor(Math.random() * 100) + 1); } } } } movieClip 1788 { frame 64 { stop(); } frame 423 { stop(); } frame 848 { stop(); } frame 1121 { stop(); } } movieClip 1789 { frame 1 { stop(); } frame 16 { gotoAndStop(1); } } movieClip 1790 { } frame 134 { stop(); } movieClip 1807 { } movieClip 1808 { } movieClip 1814 { frame 51 { gotoAndPlay('pattern1'); } frame 110 { gotoAndPlay('pattern2'); } frame 160 { gotoAndPlay('pattern3'); } frame 286 { gotoAndPlay('pattern4'); } frame 347 { gotoAndPlay('pattern5'); } } movieClip 1815 { frame 1 { stop(); } frame 12 { gotoAndStop(1); } } movieClip 1892 { frame 1844 { stop(); } } movieClip 1893 { frame 46 { stop(); } } movieClip 1894 { frame 1 { gotoAndStop(Math.floor(Math.random() * 5) + 1); } } movieClip 1895 { frame 1 { stop(); } } movieClip 1938 { frame 2533 { stop(); } } movieClip 1943 { } movieClip 1947 { } movieClip 1948 { } movieClip 1949 { frame 1 { stop(); } } movieClip 1950 { } movieClip 1951 { frame 1 { stop(); } frame 15 { gotoAndStop(1); } } movieClip 1955 { } movieClip 1956 { frame 1 { stop(); } frame 9 { gotoAndStop(3); } } movieClip 1960 { } movieClip 1961 { } movieClip 1963 { } movieClip 1964 { } movieClip 1965 { } movieClip 1966 { } movieClip 1967 { } movieClip 1968 { } movieClip 1969 { } movieClip 1970 { frame 1 { stop(); } frame 10 { gotoAndStop(2); } } movieClip 1974 { frame 1 { stop(); } } movieClip 1975 { frame 8185 { stop(); } } frame 135 { prevFrame(); }




https://swfchan.com/53/262824/info.shtml
Created: 21/2 -2026 20:49:07 Last modified: 21/2 -2026 20:49:07 Server time: 22/02 -2026 22:53:45