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

forked from: forked from: Super oMochi Cave

BGMs are from TSSCP threads.
SEs are from http://mmltalks.appspot.com/mml/e781c745d6bac989bc13ce18dd5f4ccfb09c78cf
Translated from http://dic.nicovideo.jp/mml_id/1868
/**
 * Copyright fakestar0826 ( http://wonderfl.net/user/fakestar0826 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/7gtj
 */

// forked from Limeflash's forked from: Super oMochi Cave
// forked from miyaoka's Super oMochi Cave
// forked from miyaoka's Super Mario Cave
// forked from keim_at_Si's Super Mario Synthesizer (Data not completed)
// BGMs are from TSSCP threads.
// SEs are from http://mmltalks.appspot.com/mml/e781c745d6bac989bc13ce18dd5f4ccfb09c78cf
// Translated from http://dic.nicovideo.jp/mml_id/1868
package {
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.net.URLRequest;
    import flash.system.LoaderContext;
    import flash.utils.ByteArray;
    import flash.utils.Timer;
    import org.si.sion.*;
    import com.bit101.components.*;
    import caurina.transitions.Tweener;
    import net.hires.debug.Stats;
    
    [SWF(backgroundColor='#ffffff', frameRate='60')]
    public class SuperMarioCave2 extends Sprite {
        
        private var SW:Number = 465;
        private var SH:Number = 465;
        private var perlinPhase:Number = 0;
        private var thPhase:Number = 0;
        private var scroll:Number = 1;
        private var scale:Number = 0.5;
        private var bg:BitmapData = new BitmapData(SW * scale, SH * scale);
        private var ct:ColorTransform = new ColorTransform(1, 1, 1, 1, 0x00, 0x8f, 0x8f);
        public var threshold:uint = 0xff;
        public var xPos:Number = 150;
        private var yPos:Number;
        private var yMove:Number;
        public var yAccel:Number = 0.2;
        private var yVct:Number;
        private var perlinX:Number;
        private var perlinY:Number;

        
        function SuperMarioCave2() {
            
            init();
        }
        private function init():void 
        {
            var bmp:Bitmap = new Bitmap(bg);
            bmp.scaleX = bmp.scaleY = 1 / scale;
            addChild(bmp);
            
            addEventListener(Event.ENTER_FRAME, scrollDrawHandler);
            stageInit();
            
            addChild(new Stats());
        }
        
        private function stageInit():void 
        {
            yPos = SH * 0.2;
            yMove = 0;
            yVct = 1;
            alpha = 1;
            threshold = 0xff;
            xPos = 0;
            
            
            scroll = 0//1 + Math.floor(Math.random() * 2);
            
            perlinX = Math.random() * 0.4 + 0.2;
            perlinY = Math.random() * 0.4 + 0.2;

            yAccel = 0;
            Tweener.addTween(this, {
                xPos: 150,
                threshold: 0x50,
                time: 6.0,
                yAccel: scroll * 0.06
            });
            addEventListener(Event.ENTER_FRAME, thPhaseHandler);
            
        }
        private function thPhaseHandler(e:Event):void 
        {
            thPhase += Math.PI * 0.02;
        }
        
        private function scrollDrawHandler(e:Event):void 
        {
            bg.lock();
            bg.perlinNoise(SW * perlinX * scale, SH * perlinY * scale, 1, 2, true, false, 1, true, [new Point(perlinPhase += scroll * scale, 0)]);
            bg.colorTransform(bg.rect, ct);
            bg.threshold(bg, bg.rect, bg.rect.topLeft, ">", 0xff << 24 |
            Math.max(0, Math.min(0xff, (threshold + Math.sin(thPhase) * 0x08))) << 16, 0xffffffff);
            bg.unlock();
            
        }
        
    }
}