In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

Footprint

Get Adobe Flash player
by miyaoka 16 Sep 2009
    Embed
/**
 * Copyright miyaoka ( http://wonderfl.net/user/miyaoka )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/1VO7
 */

package 
{
	import flash.display.*;
	import flash.events.*;
	import flash.geom.*;
	import caurina.transitions.Tweener;
    import org.si.sion.*;
	
	[SWF(width = "465", height = "465", backgroundColor = 0xffffff, frameRate = "60")]
	
	public class Footprint extends Sprite 
	{
        public var driver:SiONDriver = new SiONDriver();
        public var sounds:SuperMarioSound = new SuperMarioSound();
		public var scale:Number = 1;
		public function Footprint() 
		{
			var swh:Number = stage.stageWidth / 2;
			var shh:Number = stage.stageHeight / 2;
			var fpContainer:Sprite = new Sprite();
			var scrollDist:Number = 0;
			var zeroPt:Point = new Point();
			var isJump:Boolean = false;
			var fpShapeBase:FpShape = new FpShape();
			var angle:Number = 0;
			var shoulderWidth:Number = 10;
			var shoulderAngle:Number = 1;
						
			var bmd:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
			bmd.perlinNoise(bmd.width/8, bmd.height/8, 4, Math.random()*int.MAX_VALUE, true, false, 1);
			
			var redArray:Array = [];
			var i:int;
			for(i = 0; i < 0x24; i++) {
				redArray[i] = 0x5c79ea; //sea
			}
			for (i = 0x24; i < 0x30; i++) {
				redArray[i] = 0xe4d177; //sand
			}			
			for (i = 0x30; i < 0x78; i++) {
				redArray[i] = 0x7ac300; //field
			}			
			for (i = 0x78; i < 0x9c; i++) {
				redArray[i] = 0x378507; //forest
			}			
			for (i = 0x9c; i < 0x100; i++) {
				redArray[i] = 0x6e804b; //rock
			}			
			bmd.paletteMap(bmd, bmd.rect, bmd.rect.topLeft, redArray);

			
			var bg:Shape = new Shape();
			var g:Graphics = bg.graphics;
			var bgMul:Number = 16;
			var repeatWidth:Number = bmd.width * bgMul;
			var repeatHeight:Number = bmd.height * bgMul;
			g.beginBitmapFill(bmd, new Matrix(bgMul,0,0,bgMul), true);
			g.drawRect(0, 0, repeatWidth * 2, repeatHeight * 2);
			
			var container:Sprite = new Sprite();
			container.addChild(bg);
			container.addChild(fpContainer);
			addChild(container);
			
			addEventListener(Event.ENTER_FRAME, function ():void 
			{
				var scrollPt:Point = new Point((mouseX - swh) * -0.08, (mouseY - shh) * -0.08);
				fpContainer.x += scrollPt.x;
				fpContainer.y += scrollPt.y;
				bg.x = ((fpContainer.x % repeatWidth) - repeatWidth) % repeatWidth;
				bg.y = ((fpContainer.y % repeatHeight) - repeatHeight) % repeatHeight;
				container.scaleX = container.scaleY = scale;
				
				if(isJump) return;
				angle = Math.atan2( scrollPt.y, -scrollPt.x);
				var dist:Number = Point.distance(zeroPt, scrollPt);
				scrollDist += dist;
				while (scrollDist > 40)
				{
					scrollDist -= Math.random() * 10 + 40;
					var fpPoint:Point = Point.interpolate(scrollPt, zeroPt, 1 - scrollDist / dist);
					addFp(new Point(fpPoint.x - fpContainer.x + swh,fpPoint.y - fpContainer.y + shh));
				}
			});			

			//snd
            driver.bpm = 200;
            driver.play(sounds.nosound);
			driver.volume = 0.2;
            driver.play(sounds.star);
			
			stage.addEventListener(MouseEvent.MOUSE_DOWN, function():void
			{
				var pt:Point = new Point( -fpContainer.x + swh, -fpContainer.y + shh);
				addFp(pt, 8);
				addFp(pt, 8);
				
				driver.sequenceOn(sounds.jump, null, 0, 0, 0);
				isJump = true;
				
				Tweener.addTween(root,
				{
					scale: 1/bgMul,
					time: 4
				});
			});
			stage.addEventListener(MouseEvent.MOUSE_UP, function():void
			{
				Tweener.addTween(root,
				{
					scale: 1,
					time: 0.5,
					transition: "easeInQuint",
					onComplete: function():void
					{
				var pt:Point = new Point( -fpContainer.x + swh, -fpContainer.y + shh);
				addFp(pt, 7);
				addFp(pt, 7);
				scrollDist = 0;

				isJump = false;
				driver.sequenceOn(sounds.fumi, null, 0, 0, 0);
						
					}
				});
			});
			
			function addFp(pt:Point, radius:Number=6):void
			{
				var fpShape:FpShape = new FpShape(radius);
				var lrPoint:Point = Point.polar(shoulderWidth + Math.random() * Math.random() *shoulderWidth*1.0, angle + Math.PI * -0.5 * shoulderAngle);
				fpShape.scaleX *= shoulderAngle;
				shoulderAngle *= -1;
				fpShape.x = pt.x + lrPoint.x;
				fpShape.y = pt.y - lrPoint.y;
				fpShape.rotation = (90 - angle * 180 / Math.PI) + (Math.random() - 0.5) * 40;
				fpContainer.addChild(fpShape);
				while (fpContainer.numChildren > 50) fpContainer.removeChildAt(0);
			}
		}
		
	}
	
}
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.filters.*;
import caurina.transitions.Tweener;
class FpShape
extends Sprite
{
	public function FpShape(radius:Number = 10):void 
	{
		blendMode = BlendMode.MULTIPLY
		var g:Graphics = graphics;
		var clr:uint = 0x999999;
		g.beginFill(clr);
		g.drawCircle(0, 0, radius);
		g.endFill();
		
		for each (var angle:Number in [0.15, 0.35, 0.55, 0.75])
		{
			var pt:Point = Point.polar(radius * 2, Math.PI * angle);
			g.beginFill(clr);
			g.drawCircle(pt.x*0.75, -pt.y, radius*0.5);
			g.endFill();
		}
		filters = [
			new BevelFilter( 3, -60, 0xFFFFFF, 0.8, 0x000000, 0.8, 4.0, 4.0, 1, 1, "inner", false )
		]		
	}
}



/*
 * SiOnSoundData from 
 * http://wonderfl.net/code/9d89bb207b020e15e3fa88bd6125dbc2e83a950b
 */
import org.si.sion.*;

// this instanse have to be created after creating SiONDrivers instance.
// All SiONData are in bpm of 200.
class SuperMarioSound {
    public var nosound:SiONData;
    // bgm
    public var mario1:SiONData;
    public var mario2:SiONData;
    public var mario2start:SiONData;
    public var mario4:SiONData;
    public var mario22:SiONData;
    public var star:SiONData;
    public var areaclear:SiONData;
    public var allclear:SiONData;
    public var hurryup:SiONData;
    public var stageclear:SiONData;
    public var miss:SiONData;
    public var gameover:SiONData;
    
    // sound effect
    public var block:SiONData;
    public var item:SiONData;
    public var iteml:SiONData;
    public var powerup:SiONData;
    public var jump:SiONData;
    public var jumpl:SiONData;
    public var poke:SiONData;
    public var fumi:SiONData;
    public var dom:SiONData;
    public var fire:SiONData;
    public var cion:SiONData;
    public var extend:SiONData;
    public var warp:SiONData;
    public var goal:SiONData;
    public var bonus:SiONData;
    public var firework:SiONData;
    
    
    function SuperMarioSound() {
        var driver:SiONDriver = SiONDriver.mutex;
        var header:String, mml:String;
        header = "t200;#EFFECT0{speaker20};";
        
        // The following 4 lines are avoiding bugs in curren version. 
        // In this version, the sequenceOn() function cannot refer tables in the SiONData, 
        // so we have to define all tables on main SiONData played by SiONDriver.play().
        // In new version(0.57), the sequenceOn() function can refer the tables in SiONData and following mmls are not requeired.
        header += "#TABLE0{(0,128)8};#TABLE1{(0,384)8};#TABLE2{(128,0)12,0};#TABLE3{(90,934)12};";
        header += "#TABLE4{(0,-1280)4};#TABLE5{(0,-1280)6};#TABLE6{(0,-2560)6};#TABLE7{(0,36)36};";
        header += "#TABLE8{14,0,13,0,13,0,12,0,12,,11,0,9,0,9,0,8,0,8,0,7,0,6,0,6,0,5,0,5}*8+31;";
        header += "#TABLE9{12,6,13,8,13,3,9,10,15,12,6,11,13,14};";
        
        nosound = driver.compile(header);
        
        // MML from TSSCP thread dtm 1-564 modifyed
        mml = header;
        mml += "#A=o6eerercer grrr>grrr;";
        mml += "#B=o6[2crr>grrer rarbra+ar gr24<er24gr24arfg rercd>brr];";
        mml += "#C=o6[2[2rrgf+fd+re r>g+a<cr>a<cd |rrgf+fd+re r<crccrrr]>rrd+rrdrr crr2.];";
        mml += "#D=o6[2ccrcrcdr ecr>agrrr |<ccrcrcde r1];";
        mml += "#E=o6[2ecr>grrg+r a<frf>arrr |br24<ar24ar24ar24gr24fr24 ecr>agrrr]b<frffr24er24dr24 crr2.;";
        mml += "#F=o5f+f+rf+rf+f+r brr2.;";
        mml += "#G=o5[2errcrr>gr r<crdrc+cr cr24gr24br24<cr>ab rarefdrr];";
        mml += "#H=o6[2[2rred+d>br<c r>efgrcef |<rred+d>br<c rfrffrrr]>rrg+rrfrr err2.<];";
        mml += "#I=o5[2g+g+rg+rg+a+r gerecrrr |g+g+rg+rg+a+g r1];";
        mml += "#J=o6[2c>arerrer f<crc>frrr |gr24<fr24fr24fr24er24dr24 c>arferrr]g<drddr24cr24>br24 gerecrrr;";
        mml += "#K=o4ddrdrddr <grrr>grrr;";
        mml += "#L=o4[2grrerrcr rfrgrf+fr er24<cr24er24frde rcr>abgrr];"
        mml += "#M=o4[2[2crrgrr<cr >frr<ccr>fr |crrerrg<c r<grggr>>gr]crg+rra+rr <crr>ggrcr];";
        mml += "#N=o3[3g+rr<d+rrg+r grrcrr>gr];";
        mml += "#O=o4[2crrf+gr<cr >frfr<cc>fr |drrfgrbr grgr<cc>gr]grrggr24ar24br24 <cr>grcrrr;";
        mml += "#X=v15o1q1s38g16r8.;#Y=v10o5q1s36c16;#Z=v8o5q5s34c8r8;";
        mml += "#P=ZYrZYrZZrrZYrYrYr;#Q=XYrrYZYrrY;#R=Yr4rYrZYr8.;";
        mml += "t200;%0@0l8v10q5s34A$BCDABEEDAE;%0@0l8v10q5s34F$GHIFGJJIFJ;%5@3l8v12q8s63K$LMNKLOONKO;";
        mml += "%2@0l16P$[Q]24[P]4[Q]8[R]16[P]4[R]8;";
        mario1 = driver.compile(mml);
        
        // MML from TSSCP thread dtm 1-115 modifyed
        mml = header;
        mml += "#A=[2c<c>>a<a>a+<a+r2.][2>f<f>d<d>d+<d+r2|r4]d+12d12c+12crd+rdr>g+rgr<c+rl12cf+fea+ag+.Rd+.R>b.Ra+.Ra.Rg+.Rr1.;";
        mml += "%1@4v10q5s34l8o5$A;%1@8v12q8s63l8o4$A;";
        mario2 = driver.compile(mml);

        // MML from TSSCP thread dtm 1-115 modifyed
        mml = header;
        mml += "#Y=v10q1s36c16r16; #Z=v8q5s38o5c8;";
        mml += "%1@4v10q5s34l8o6 eerercergrrr>g r2. s63q8l64o7[e>ad<e>ad>gc>f>a+r16]3;";
        mml += "%1@4v10q5s34l8o5 f+f+rf+rf+f+rb;";
        mml += "%1@8v12q8s63l8o4 ddrdrddr<grrr>g;";
        mml += "%2l8o5 ZrYZrYZrZrrZrYYY;";
        mario2start = driver.compile(mml);
        
        // MML from TSSCP thread dtm 1-115 modifyed
        mml = header;
        mml += "o6l8q1s29r64$r16[2dd-cd-de-dd-][2d-cd-dd-dd-c][2fg-fefee-|e]e16;";
        mml += "o5l16q1s31r64$[2gb-gaga-gagb-gbgb-ga][2f+af+a-f+af+b-f+af+b-f+af+a-]";
        mml += "[2a+<d>a+<e->a+<d>a+<d->a+<d>a+<d->a+<c>a+<d->];%5@0q8s63l2o4$e-1dg-f1eb-aee-e";
        mario4 = driver.compile(mml);
        
        // MML from TSSCP thread dtm 1-864 modifyed
        mml = header;
        mml += "%0s63o6l8c>ge<c>ge<c2.c+>g+f<c+>g+f<c+2.d+>a+g<d+>a+g<d+4.l6fffg1.;";
        mml += "%0s63o5l8ec>g<ec>g<ee16e16eeeefc+>g+<fc+>g+<ff16f16ffffgd+>a+<gd+>a+<gg16g16gl6aaab1.;";
        mml += "%5@3s63q6o4l8c2.cc16c16ccccc+2.c+c+16c+16c+c+c+c+a+gd+a+gd+a+a+16a+16a+<l6cccd1.;";
        areaclear = driver.compile(mml);
        
        // MML from MDX data convert
        mml = header;
        mml += "#REV;t113;#TABLE10{0,32,64,80,104,128};";
        mml += "%1@4s39na10o4v14l16q7$o5d8e8f+8g8a8a+8bbbrbrb4g8>e4r8d+4r8e4r8r<gab>cde4r8d+4f8e4r8r4r<g>d4r8c+4r8d4r8r<gab>cc+d4r8<g4>f8e4r8r4r<g>g4r8g4r8g4r8g8ar8gf4r8f4 r8f4r8f8gr8fe4r8<a8b8>f8eee8.<b>c4r8;";
        mml += "%1@4s63na10o4v14l16q7$o5d8c+8c8<b8>c8c+8dddrerf4.g4r8f+4r8g4r8r4r8g4r8f+4a8g4r8r4r8f4r8e4r8f4r8r4r8f4r8<b4>a8g4r8r4r8>e4r8d4r8c+4r8r4r8d4r8c+4r8c4r8r4r8<c4r8f8g8b8bbb8.fe4r8;";
        mml += "%5@3s63q8o4v16l8$r1g16r16g4.q4cg>c<<b>gbcg>c<eg>c<cg>c<<b>gbcg>c<eg>c<dgbc+f+a+dgb<b>gbdgb<b>gbcg>c<<g>g>c<cg>e<<b>g>d<<a+>g>c+<c+g>e<da>f<c+a>f<ca>f<<b>g>f<<c>g>e<<g>ggqf16f16f.<b16>c4.;";
        mml +="%2@0s60q2v13$o7r8q1c8q3o6c8o7q2r8c16c16q3o6c8;";
        mario22 = driver.compile(mml);
        
        // MML from MDX data convert
        mml = header;
        mml += "#REV;t152;";
        mml += "%0@0s32o6v10l8$q3cccq7<d16q3>ccq7<d16q3>c16q3<d16q3>c<bbbq7c16q3bbq7c16q3b16q7c16q3b;";
        mml += "%0@0s32o5v10l8$q3fffq7d16q3ffq7d16q3f16q7d16q3feeeq7c16q3eeq7c16q3e16q7c16q3e;";
        mml += "%5@3s40o4v16l8$q6drar16>drr16<a>dcrgr16>crr16<g>c;";
        mml += "%2@0$o5q4s60c24r24r24o6q2c24r24c24o6q7c24r24r24q2c24r24c24;";
        star = driver.compile(mml);
        
        // MML from TSSCP thread dtm 2-805 modifyed
        mml = header;
        mml += "l12%0v8s63q7o5 e<drddr> f<d+rd+d+r> f+<ereer fr f2>;";
        mml += "l12%0v8s63q7o5 >e<g+6g+g+6 >f<a6aa6 >f+<a+6a+a+6 br b2;";
        mml += "l12%3v8s63q6o5 >b<b6bb6 c<c6cc6> c+<c+6c+c+6> >g6 g2 <;";
        hurryup = driver.compile(mml);
        
        // MML from MDX data convert
        mml = header;
        mml += "#REV;#TABLE10{0,32,64,80,104,128};";
        mml += "%1@4s39na10o4v14l8q8g>ceg>ceg4.e4.<<g+>cd+g+>cd+g+4.d+4.<<a+>dfa+>dfa+4.a+a+a+>c2;";
        mml += "%1@4s63na10o4v14l8q8ceg>ceg>c4.<g4.<cd+g+>cd+g+>c4.<g+4.<dfa+>dfa+>d4.ddde2;";
        mml += "%5@3s63q8o4v16l8gegceg>e4.cr4<g+d+g+cd+g+>d+4.cr4<a+fa+dfa+>f4.dddc2;";
        stageclear = driver.compile(mml);
        
        // MML from MDX data convert
        mml = header;
        mml += "#REV;t203;#TABLE10{0,32,64,80,104,128};";
        mml += "%1@4s39na10o5v14l8q8$gf+ge2r4f4.f+4.g2r4>c4.e4ed4.e4.f4.<b4.>d2r4c4.<;";
        mml += "%1@4s63na10o4v14l8q8$r4.g2r4a4.a+4.b2r4>e4.g4gf4.g4.a4.d4.f4.r4.e4.<;";
        mml += "%5@3s63q8o3v16l8$b4.>c2.d4.d+4.e4.c4.a4.g4.f4.e4.d4.f4.g4.<g4.>c4.<;";
        allclear = driver.compile(mml);
        
        mml = header;
        mml += "%1@4s39v14q6l8r^2 b<frff6e6d6cr1;";
        mml += "%1@4s27,-45v14q0l8 o4<b16b16b16r16r^4g<drdd6c6>b6gerecr2;";
        mml += "%1@8s41v16q7l8r^2 o4gr4gg6a6b6<c>grgcr2;";
        miss = driver.compile(mml);
        
        mml = header + "#TABLE10{0,32,64,80,104,128};";
        mml += "%1@4s39v14q7l4na10,1o5e8rc8ro4go5f2f^2e8d8e2;";
        mml += "%1@4s63v14q8l4na10,1o6c8ro5g8rea8.b8a8.g+a+g+g2.;";
        mml += "%5@3s38v16q7l4o4g8re8rcs25f2c+2.c2..;";
        gameover = driver.compile(mml);

        mml = "t200;#TABLE8{14,0,13,0,13,0,12,0,12,,11,0,9,0,9,0,8,0,8,0,7,0,6,0,6,0,5,0,5}*8+31;";
        mml += "#TABLE9{12,6,13,8,13,3,9,10,15,12,6,11,13,14};";
        mml += "%1@9s63q8o0na8,1nt9,2c4.^32nantx128";
        block = driver.compile(mml);
        item = driver.compile("t200;#A=cggg+g+c+;%1@4s63q8l64o5A(0)A(1)A(2)A(3)");
        iteml = driver.compile("t200;#A=cggg+g+c+;%1@4s63q8l64o5A(0)A(1)A(2)A(3)A(4)A(5)A(6)A(7)");
        powerup = driver.compile("t200;%1@2s63q8l32o6c>g<ceg<c>g>g+<cd+g+d+g+b+<d+g+d+>>a+<dfa+fa+<dfa+f64");
        jump = driver.compile("t200;#TABLE2{(128,0)12,0};#TABLE3{(90,934)12};%1@4s63q8o5a32@2na2,2np3,2g2");
        jumpl = driver.compile("t200;#TABLE2{(128,0)12,0};#TABLE3{(90,934)12};%1@4s63q8o5d32@2na2,2np3,2c2");
        poke = driver.compile("t200;%1@4s63l128o5b-<cr16f64");
        fumi = driver.compile("t200;#TABLE0{(0,128)8};#TABLE1{(0,384)8};%1@4s63q8l10na0np1o5a<gnanp");
        dom = driver.compile("t200;#TABLE4{(0,-1280)4};%1@4s63q8l64np4,2o4a-16npc+&d+&f&f+");
        fire = driver.compile("t200;%1@4s63q8l64o4g<g<g<g<g");
        cion = driver.compile("t200;%1@4s63q8l16q0s22o6b<e");
        extend = driver.compile("t200;%1@4s63q0s24l9o7eg<ecdq8s63g");
        warp = driver.compile("t200;%1@4s63q8l64o7[e>ad<e>ad>gc>f>a+r16]3");
        goal = driver.compile("t200;#TABLE7{(0,36)36};%1@4s63q8o4nt7,2b-1");
        bonus = driver.compile("t200;%1@4s63q7l64o6[b]80");
        firework = driver.compile("t200;#TABLE5{(0,-1280)6};#TABLE6{(0,-2560)6};%1@4s63q8l64np5,2o4c+8<np6,2c+6np");
    }
}