Section 1
//MainTimeline (mode_7_half_fla.MainTimeline)
package mode_7_half_fla {
import flash.display.*;
import flash.events.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.geom.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.text.*;
import flash.utils.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var angular;
public var version;
public var bufLEFT;
public var my_menu:ContextMenu;
public var mapData:Map;
public var D;
public var bg:Sprite;
public var bufUP;
public var camY;
public var sw;
public var sh;
public var camX;
public var backParent:Sprite;
public var camZ;
public var bufDOWN;
public var camRot;
public var bgData:BGData;
public var bufRIGHT;
public var backArray:Array;
public var bgmask:Sprite;
public var velocity;
public var downscale;
public var credit;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 2, frame3);
}
public function scanLine(_arg1:Sprite, _arg2:Number){
var _local3:Sprite;
_local3 = new Sprite();
_local3.graphics.beginFill(0);
_local3.graphics.drawRect(0, (_arg2 + (sh / 2)), sw, downscale);
_local3.graphics.endFill();
_arg1.mask = _local3;
}
function frame3(){
update();
gotoAndPlay(2);
}
public function perspectiveArray(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:Matrix;
var _local8:*;
_local7 = new Matrix();
_local7.translate(-(_arg2), -(_arg4));
_local7.rotate(((_arg5 / 180) * Math.PI));
_local8 = 0;
while (_local8 < _arg1.length) {
_arg1[_local8].transform.matrix = _local7;
applyPerspective(_arg1[_local8], _arg2, _arg3, _arg4, _arg5, (downscale * _local8));
_local8++;
};
}
function frame2(){
update();
}
function frame1(){
sh = 478;
sw = 0x0200;
stage.align = StageAlign.TOP_LEFT;
my_menu = new ContextMenu();
my_menu.hideBuiltInItems();
version = new ContextMenuItem("Mode_7 rev. 2");
version.enabled = false;
credit = new ContextMenuItem("Rubber NAND !0x524E/n3E 2015");
credit.enabled = false;
my_menu.customItems.push(version, credit);
contextMenu = my_menu;
bg = new Sprite();
bgData = new BGData(789, 239);
bg.graphics.beginBitmapFill(bgData);
bg.graphics.drawRect(0, 0, (789 * 3), 239);
bg.graphics.endFill();
bgmask = new Sprite();
bgmask.graphics.beginFill(0);
bgmask.graphics.drawRect(0, 0, sw, (sh / 2));
bgmask.graphics.endFill();
bg.mask = bgmask;
stage.addChild(bg);
backArray = new Array();
downscale = 2;
backParent = new Sprite();
backParent.y = (sh / 2);
stage.addChild(backParent);
mapData = new Map(0x0100, 0x0100);
populateBack(backParent, backArray, (sh / 2), mapData, 0x0100, 0x0100);
camX = 234;
camY = 4;
camZ = 128;
camRot = 0;
D = 0x0200;
velocity = 0;
angular = 0;
update();
bufUP = false;
bufDOWN = false;
bufLEFT = false;
bufRIGHT = false;
stage.addEventListener(KeyboardEvent.KEY_DOWN, reportKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, reportKeyUp);
}
public function reportKeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.UP:
bufUP = false;
break;
case Keyboard.LEFT:
bufLEFT = false;
break;
case Keyboard.RIGHT:
bufRIGHT = false;
break;
case Keyboard.DOWN:
bufDOWN = false;
break;
};
}
public function runBuffer(){
var _local1:*;
if (bufUP){
velocity = (velocity + 0.1);
} else {
if (bufDOWN){
velocity = (velocity - 0.1);
} else {
velocity = (velocity * 0.95);
};
};
if (Math.abs(velocity) > 1){
velocity = (velocity * 0.9);
};
_local1 = 0;
if (bufLEFT){
_local1 = 1;
} else {
if (bufRIGHT){
_local1 = -1;
} else {
angular = (angular * 0.9);
};
};
angular = (angular + (_local1 * 0.25));
if (angular > 2){
angular = 2;
} else {
if (angular < -2){
angular = -2;
};
};
camRot = (camRot + angular);
camZ = (camZ - (velocity * Math.cos(((camRot / 180) * Math.PI))));
camX = (camX - (velocity * Math.sin(((camRot / 180) * Math.PI))));
}
public function reportKeyDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.UP:
bufUP = true;
break;
case Keyboard.LEFT:
bufLEFT = true;
break;
case Keyboard.RIGHT:
bufRIGHT = true;
break;
case Keyboard.DOWN:
bufDOWN = true;
break;
};
}
public function update(){
runBuffer();
bg.x = ((((camRot % 360) / 360) * 789) - 789);
perspectiveArray(backArray, camX, camY, camZ, camRot, (sh / 2));
}
public function applyPerspective(_arg1:Sprite, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:Matrix;
_local7 = _arg1.transform.matrix;
_local7.scale((_arg6 / _arg3), (_arg6 / _arg3));
_local7.translate((sw / 2), (D + _arg6));
_arg1.transform.matrix = _local7;
}
public function populateBack(_arg1:Sprite, _arg2:Array, _arg3:Number, _arg4:BitmapData, _arg5:Number, _arg6:Number){
var _local7:*;
_local7 = 0;
while (_local7 < (_arg3 / downscale)) {
_arg2.push(new Sprite());
_arg2[_local7].graphics.beginBitmapFill(_arg4);
_arg2[_local7].graphics.drawRect(0, 0, _arg5, _arg6);
_arg2[_local7].graphics.endFill();
scanLine(_arg2[_local7], (downscale * _local7));
_arg1.addChild(_arg2[_local7]);
_local7++;
};
}
}
}//package mode_7_half_fla
Section 2
//BGData (BGData)
package {
import flash.display.*;
public dynamic class BGData extends BitmapData {
public function BGData(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package
Section 3
//Map (Map)
package {
import flash.display.*;
public dynamic class Map extends BitmapData {
public function Map(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package