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

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

Destructible Terrain.swf

This is the info page for
Flash #71320

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


Text
destructible terrain engine by ArtBIT

[ regenerate terrain ]

click, drag, release to throw the bomb...

ActionScript [AS1/AS2]

Frame 1
function Shake() { var _local3 = -this._x; var _local2 = -this._y; var _local5 = this._x - shakeLastPos.x; var _local4 = this._y - shakeLastPos.y; shakeLastPos.x = this._x; shakeLastPos.y = this._y; this._x = this._x + ((_local3 * shake_force) + (_local5 * shake_dur)); this._y = this._y + ((_local2 * shake_force) + (_local4 * shake_dur)); } function drawCircle(mc, x, y, r) { mc.moveTo(x + r, y); var _local5 = 0.392699081698724; var _local2 = (Math.PI/4); var _local6 = (ny = 0); var _local4 = (wy = 0); var _local1 = 0; while (_local1 < 8) { _local4 = x + ((r * Math.cos((_local1 * _local2) + _local5)) * 1.08); wy = y + ((r * Math.sin((_local1 * _local2) + _local5)) * 1.08); _local6 = x + (r * Math.cos((_local1 * _local2) + _local2)); ny = y + (r * Math.sin((_local1 * _local2) + _local2)); mc.curveTo(_local4, wy, _local6, ny); _local1++; } } function generateTerrain() { var _local1 = new Array(); _local1.push(ptTerrainLeft); FractalLine(ptTerrainLeft, ptTerrainRight, 0.5, 0.35, _local1); _local1.push(ptTerrainRight); return(_local1); } function drawSceneRectangle(mc) { with (mc) { lineStyle(0, 16711680, 0); beginFill(0, 100); moveTo(ptTerrainLeft.x, 0); lineTo(ptTerrainRight.x, 0); lineTo(ptTerrainRight.x, 400 + shake_str); lineTo(-shake_str, 400 + shake_str); lineTo(ptTerrainLeft.x, 0); endFill(); } } function eraseTerrain(mc) { with (mc) { lineStyle(0, 16711680, 0); beginFill(16711680, 100); var len = aTerrain.length; moveTo(aTerrain[0].x, aTerrain[0].y); var i = 1; while (i < len) { lineTo(aTerrain[i].x, aTerrain[i].y); i++; } lineTo(ptTerrainRight.x, 0); lineTo(ptTerrainLeft.x, 0); lineTo(aTerrain[0].x, aTerrain[0].y); endFill(); } } function drawHole(mc, x, y, size) { mc.lineStyle(0, 0, 0); mc.beginFill(16711680, 100); drawCircle(mc, x, y, size); mc.endFill(); } function drawFrame() { with (this) { beginFill(0); moveTo(-2 * shake_str, -2 * shake_str); lineTo(550 + (2 * shake_str), -2 * shake_str); lineTo(550 + (2 * shake_str), 400 + (2 * shake_str)); lineTo(-2 * shake_str, 400 + (2 * shake_str)); lineTo(-2 * shake_str, -2 * shake_str); moveTo(-shake_str, -shake_str); lineTo(550 + shake_str, -shake_str); lineTo(550 + shake_str, 400 + shake_str); lineTo(-shake_str, 400 + shake_str); lineTo(-shake_str, -shake_str); endFill(); } } function Init() { container.terrain.clear(); container.trnMask.clear(); aTerrain = generateTerrain(); drawSceneRectangle(container.terrain); eraseTerrain(container.trnMask); container.trnMask.blendMode = "erase"; container.blendMode = "layer"; } var isBombFalling = false; var showInfo = true; var shakeLastPos = {x:0, y:0}; var shake_force = 0.9; var shake_dur = 0.7; var shake_str = 5; var ptTerrainLeft = {x:-shake_str, y:200}; var ptTerrainRight = {x:550 + shake_str, y:200}; var ptDirVectorStart = {x:0, y:0}; var ptDirvectorEnd = {x:0, y:0}; var time = 0; this.createEmptyMovieClip("container", 1); container.createEmptyMovieClip("terrain", 2); container.createEmptyMovieClip("trnMask", 3); container.createEmptyMovieClip("bomb", 4); container.createEmptyMovieClip("dir", 7); container.terrain.attachMovie("mc:Avatar", "Avatar", 1); container.terrain.Avatar._x = 530; container.terrain.Avatar._y = 380; container.bomb._y = -500; container.bomb.vy = 0; container.bomb.vx = 0; container.bomb.g = 0.4; container.bomb.beginFill(0); drawCircle(container.bomb, 0, 0, 10); container.bomb.endFill(); this.attachMovie("mc:Regenerate", "reinit", 5); reinit.onPress = function () { delete onMouseMove; Mouse.show(); onMouseUp = function () { onMouseUp = mouseClick; }; Init(); }; Distance = function (A, B) { return(Math.sqrt(Math.pow(B.x - A.x, 2) + Math.pow(B.y - A.y, 2))); }; FractalLine = function (A, B, Width, roughness, terrainLine) { var _local4 = Math.atan2(B.y - A.y, B.x - A.x); var _local1 = Distance(A, B); var _local8 = {x:A.x + ((_local1 / 2) * Math.cos(_local4)), y:A.y + ((_local1 / 2) * Math.sin(_local4))}; var _local9 = ((((_local1 / 2) * roughness) * 2) * Math.random()) - (((_local1 / 2) * roughness) + 0.1); var _local6 = _local4 - (Math.PI/2); var _local3 = {x:_local8.x + (_local9 * Math.cos(_local6)), y:_local8.y + (_local9 * Math.sin(_local6))}; if (_local1 > 10) { FractalLine(A, _local3, Width, roughness, terrainLine); FractalLine(_local3, B, Width, roughness, terrainLine); } else { terrainLine.push(_local3); } }; var aTerrain; startDirectionVector = function () { ptDirVectorStart = {x:_xmouse, y:_ymouse}; Mouse.hide(); onMouseMove = drawDirectionVector; }; onMouseDown = startDirectionVector; drawDirectionVector = function () { ptDirVectorEnd = {x:_xmouse, y:_ymouse}; var arX = (((ptDirVectorEnd.x - ptDirVectorStart.x) * 0.9) + ptDirVectorStart.x); var arY = (((ptDirVectorEnd.y - ptDirVectorStart.y) * 0.9) + ptDirVectorStart.y); var ptArrow = {x:arX, y:arY}; arX = ptArrow.x + (ptDirVectorEnd.y - ptArrow.y); arY = ptArrow.y - (ptDirVectorEnd.x - ptArrow.x); var ptArrowL = {x:arX, y:arY}; arX = ptArrow.x - (ptDirVectorEnd.y - ptArrow.y); arY = ptArrow.y + (ptDirVectorEnd.x - ptArrow.x); var ptArrowR = {x:arX, y:arY}; with (container.dir) { clear(); lineStyle(2, 0, 10); moveTo(ptDirVectorStart.x, ptDirVectorStart.y); lineTo(ptDirVectorEnd.x, ptDirVectorEnd.y); lineTo(ptArrowL.x, ptArrowL.y); moveTo(ptDirVectorEnd.x, ptDirVectorEnd.y); lineTo(ptArrowR.x, ptArrowR.y); ptArrowL.x = ptArrowL.x - ptArrow.x; ptArrowL.x = ptArrowL.x + ptDirVectorStart.x; ptArrowL.y = ptArrowL.y - ptArrow.y; ptArrowL.y = ptArrowL.y + ptDirVectorStart.y; ptArrowR.x = ptArrowR.x - ptArrow.x; ptArrowR.x = ptArrowR.x + ptDirVectorStart.x; ptArrowR.y = ptArrowR.y - ptArrow.y; ptArrowR.y = ptArrowR.y + ptDirVectorStart.y; moveTo(ptDirVectorStart.x, ptDirVectorStart.y); lineTo(ptArrowL.x, ptArrowL.y); moveTo(ptDirVectorStart.x, ptDirVectorStart.y); lineTo(ptArrowR.x, ptArrowR.y); } }; mouseClick = function () { delete onMouseMove; Mouse.show(); container.dir.clear(); time = getTimer(); if (showInfo) { showInfo = false; info.play(); } if (!isBombFalling) { if (container.trnMask.hitTest(_xmouse, _ymouse, true)) { container.bomb._x = _xmouse; container.bomb._y = _ymouse; container.bomb.vx = 0; ptDirVectorEnd = {x:_xmouse, y:_ymouse}; var _local2 = ptDirVectorEnd.x - ptDirVectorStart.x; var _local1 = ptDirVectorEnd.y - ptDirVectorStart.y; container.bomb.vx = _local2 / 10; container.bomb.vy = _local1 / 10; isBombFalling = true; container.bomb.onEnterFrame = bombDrop; } } }; time = getTimer(); bombDrop = function () { var _local3 = getTimer(); timepassed = (_local3 - time) / 50; time = _local3; this.vy = this.vy + this.g; this._y = this._y + (this.vy * timepassed); this._x = this._x + (this.vx * timepassed); if (!container.trnMask.hitTest(this._x, this._y, true)) { var _local2 = container.bomb; var _local4 = 2 * Math.sqrt((_local2.vx * _local2.vx) + (_local2.vy * _local2.vy)); drawHole(container.trnMask, this._x, this._y, _local4); this._y = -500; delete this.onEnterFrame; isBombFalling = false; container._x = (_local2.vx * shake_str) / 20; container._y = (_local2.vy * shake_str) / 20; container.onEnterFrame = Shake; } }; drawFrame(); Init(); onMouseUp = mouseClick; stop();
Symbol 5 MovieClip [mc:Avatar] Frame 1
this.onRelease = function () { getURL ("http://artbit.deviantart.com/gallery", "_blank"); }; stop();
Symbol 9 MovieClip Frame 1
stop();
Symbol 9 MovieClip Frame 60
stop();

Library Items

Symbol 1 Bitmap [bg.gif]
Symbol 2 GraphicUsed by:5
Symbol 3 FontUsed by:4 6 8
Symbol 4 TextUses:3Used by:5
Symbol 5 MovieClip [mc:Avatar]Uses:2 4
Symbol 6 TextUses:3Used by:7
Symbol 7 MovieClip [mc:Regenerate]Uses:6
Symbol 8 TextUses:3Used by:9
Symbol 9 MovieClipUses:8Used by:Timeline

Instance Names

"info"Frame 1Symbol 9 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS1/AS2.
ExportAssets (56)Timeline Frame 1Symbol 1 as "bg.gif"
ExportAssets (56)Timeline Frame 1Symbol 5 as "mc:Avatar"
ExportAssets (56)Timeline Frame 1Symbol 7 as "mc:Regenerate"




http://swfchan.com/15/71320/info.shtml
Created: 9/4 -2019 09:38:14 Last modified: 9/4 -2019 09:38:14 Server time: 05/11 -2024 16:33:11