ダンジョンRPG作る step6-(ステータス画面の作成).
/**
* Copyright shohei909 ( http://wonderfl.net/user/shohei909 )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/wyIu
*/
// forked from shohei909's ダンジョンRPG作る step5-(コードの整理)
/*
wonderflでがんばってダンジョンRPGを作ってます。
今回の目標は、ステータスの画面を作ることです。
同時にアイテムの表示、敵の追加もやってきます。
ゲーム内のフォントは、
bkzenさん,whirlpowerさんによる、Dot Fontを使用させていただいてます。
http://wonderfl.net/c/aB4L
操作方法
通常時
移動:方向キー
攻撃(モーションだけ): Z
びっくり: Y
メニュー: C
階段を下りる: 階段上でSpace
マップ
緑:部屋 または 通路
青:敵
ピンク:主人公
赤:階段
通ったことのない場所は見えません
制作過程を残していきたいのでforkを重ねて制作しています。
PREVIOUS http://wonderfl.net/c/oDmN
NEXT http://wonderfl.net/c/rhcZ/
前のステップの差分は,上の[diff()]をクリックするとみることができます
*/
package{
//package{}内で使用するクラスをインポート
import flash.display.Sprite;
import flash.display.Loader;
import net.kawa.tween.KTween;
import net.hires.debug.Stats;
[SWF(backgroundColor="0", frameRate="30")]
public class Game extends Sprite {
private var loaders:Vector.<Loader>;
private var data:Data;
public var dungeon:Dungeon;
//一番最初に実行される関数
function Game() {
data = new Data(); //ゲームデータを変数dataに格納
loaders = data.load(); //画像のロード開始
var nowload:NowLoading = new NowLoading(stage,init); //ロード画面の表示。ロード終了後init()を実行させる。
for each(var loader:Loader in loaders){ nowload.addLoader(loader); } //ロード画面と画像のロードの状態をリンクさせる
}
//ゲームの初期化 画像ロード後呼び出される
private function init():void{
stage.frameRate = 60; //フレームレート
stage.quality = "low"; //画質を下げる。見た目はあんまり変わらないけど、大幅に高速化。
//KTweenを利用して、ロード画面をフェードアウト
KTween.to(stage.getChildAt(1),3,{alpha:0},null,function():void{stage.removeChildAt(1)});
dungeon = new Dungeon( data ); //ダンジョンを作成
//表示リストの設定
//↑奥
addChild( dungeon ); //メインの画面
addChild( dungeon.effect ); //エフェクト
addChild( dungeon.mapBitmap ); //地図
addChild( new Stats() ).y = 350 //デバッグ用画面(左上)
addChild( dungeon.textBitmap ); //テキスト全般
//↓手前
}
}
}
import flash.ui.Keyboard;
//使用するクラス、パッケージをインポート
//http://help.adobe.com/ja_JP/AS3LCR/Flex_4.0/package-summary.html
import flash.system.LoaderContext;
import flash.geom.*;
import flash.display.*;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
//ライブラリの利用 http://wonderfl.net/libraries
//KTween-トゥイーン http://code.google.com/p/kawanet/wiki/KTweenJ
//サンプルコード:http://wonderfl.net/search?q=net.kawa.tween
import net.kawa.tween.KTween;
import net.kawa.tween.KTJob;
//PaperVision3D-3D表示 http://papervision3d.org/
//サンプルコード:http://wonderfl.net/search?q=org.papervision3d
import org.papervision3d.materials.BitmapMaterial;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.view.BasicView;
import org.papervision3d.cameras.CameraType;
import org.papervision3d.scenes.Scene3D;
import org.papervision3d.core.culling.RectangleTriangleCuller;
//オブジェクト作成は画像のロード完了後に行うこと!
class Dungeon extends Sprite{
//イメージの場所を記録した配列
//private var imgArray:Array;
public var mapWidth:uint,mapHeight:uint;
public var effect:EffectMap = new EffectMap(465,465);
public var map:Vector.<Vector.<Array>> = new Vector.<Vector.<Array>>(); //gameObjectを格納
public var mapBitmap:Bitmap = new Bitmap(); //地図
public var textBitmap:TextBitmap = new TextBitmap( 465, 465 ); //テキストを表示するbitmap
public var message:TextRow = new TextRow( 5,445,1,"" ); //メッセージを表示するテキスト
public var rooms:Vector.<Rectangle> = new Vector.<Rectangle>; //部屋の場所を記録
public var state:State = new State(); //主人公の状態とかを格納
public var menu:Menu; //メニュー
public var data:Data; //ゲームデータを格納
private var keyEvent:KeyboardEvent;
public var count:int = 0; //ゲーム開始から何フレーム経過したかを記録。
public var wait:int = 0; //設定されている時間だけ一時停止
public var stop:Boolean; //trueのときだけ一時停止
public var man:GameObject; //プレーヤーのゲームオブジェクト
public var view:BasicView; //pv3Dのview
//ゲーム初期化1 new Dungeon()で呼び出される。
function Dungeon(d:Data){
data = d;
view = new BasicView(Data.gameWidth,Data.gameHeight,false,true,CameraType.FREE);
addChild( view );
mapBitmap.alpha=0.8;mapBitmap.x = 300; mapBitmap.y = 430; mapBitmap.scaleX = 3;mapBitmap.scaleY = -3;
textBitmap.addRow( state.textRow );
textBitmap.addRow( message );
down(); //B1Fに進む
with( view.camera ){ z = -335; rotationX = -35; useCulling=true; fov=40; }//カメラ位置設定
view.startRendering(); //3D表示開始
addEventListener( "addedToStage",init );//DugeonがaddChildされるのを監視
}
//ゲーム初期化2 addChild(dungeon)と同時に呼び出される
private function init(e:Event):void{
removeEventListener("addedToStage",init);//addChild監視終了
addEventListener("enterFrame", onFrame );//onFrameを毎フレーム呼び出すように設定
//キーボードの監視を開始
stage.addEventListener("keyDown", onKeyDown );
stage.addEventListener("keyUp", onKeyUp );
menu = new Menu( this );
mask = new Bitmap( new BitmapData(1,1) );
mask.scaleX=Data.gameWidth; mask.scaleY=Data.gameHeight;
mask.x=(stage.stageWidth*stage.scaleX-Data.gameWidth)/2; mask.y=(stage.stageHeight*stage.scaleY-Data.gameHeight)/2;
addChild(mask);
}
//新しい階層を設定する
private function initFloor(flr:int):void {
Data.makeMap( this, flr ); //ランダムマップ生成
Data.stand( this ); //マップを立体化
mapBitmap.bitmapData = MapUtil.mapBitmap( this ); //地図を作成
onFrame();
state.updateText();
}
//ダンジョンを下る
public function down():void{
state.floor++; stop = true;
KTween.to( effect.color,0.5,{a:1},null,function f1():void{
stop = false; initFloor( state.floor );
KTween.to( effect.color, 0.45,{a:0},null,function f2():void{ } );
})
}
//位置を指定して、その位置の状態を確かめる
public function check(x:int,y:int,type:String = ""):Vector.<GameObject>{
var vec:Vector.<GameObject> = new Vector.<GameObject>()
for each( var obj:GameObject in map[x][y] ){ if( (obj.ability[type] != null ) || type == "" ){ vec.push(obj) } }
return vec; //typeに一致するGameObjectをVectorで返す
}
//毎フレーム処理
private function onFrame(e:Event = null):void {
if(stop){
}else{
if (wait != 0) { wait--;
}else{
count++;
var see:Array = [5,5,5,6];
var startX:int = 0,startY:int = 0,endX:int = mapWidth-1,endY:int = mapHeight-1;
for(var i:uint = startX; i<=endX; i++ ){
for(var j:uint = startY; j<=endY; j++ ){
var o:GameObject;
if( man.mapX-see[0] < i && i < man.mapX+see[1] && man.mapY-see[2] < j && j < man.mapY+see[3] ){
for each( o in map[i][j]){
if( o.plane.visible == false ){ o.plane.visible = true; }
if( o.tween != null && o.tween.length > 0){ o.move() }
if( (o.tween == null || o.tween.length == 0) && o.func.frame != null ){ o.func.frame(o) }
if( (o.tween == null || o.tween.length == 0) && keyEvent != null && o.func.key != null ){ o.func.key(keyEvent,o); }
if( o.anim != null ){
o.animation();
Data.setPlane(o);
data.draw(o.bitmapData, o.type, o.img + o.dir + o.state, 0, 0 );
}
}
}else{
for each( o in map[i][j]){
if(o.plane.visible){ o.plane.visible = false }
}
}
}
}
for(i = startX; i<=endX; i++ ){for(j = startY; j<=endY; j++ ){
for each( o in map[i][j] ){ o.slide(); }
} }
view.camera.x = man.x;
view.camera.y = -256 + man.y;
if( count % 6 == 0 ){
MapUtil.mapUpdate( this );
if( count % 12 == 0 ){ MapUtil.mapDraw( this ); }
if( count % 180 == 0 && state.hp < state.maxHp ){ state.hp++; state.updateText(); }
}
}
}
effect.onFrame()//エフェクトの実行中はエフェクトを進める
}
//キーボードタイプで呼び出される処理
private function onKeyDown(e:KeyboardEvent):void{ keyEvent = e; }
private function onKeyUp(e:KeyboardEvent):void{ keyEvent = null; }
}
//主人公の状態、所持アイテム、滞在階層,
class State {
public var textRow:TextRow = new TextRow(5,0,1,"");
public var floor:int = 0;
public var level:int = 1;
public var hp:int = 9;
public var maxHp:int = 100;
public var mp:int = 0;
public var maxMp:int = 0;
public var itemMax:int = 20;
public var itemArray:Array = [];
//技
public var sudeArray:Array = [];
public var bukiArray:Array = [];
public var seisinArray:Array = [];
public var mahouArray:Array = [];
public var katana:String = "";
public var dogi:String = "";
public var ex:int = 0; //経験値
public var wp:int = 0; //技ポイント
public function updateText():void{textRow.text="B"+floor+"F LV."+level+" HP:"+hp+"/"+maxHp+" MP:"+mp+"/"+maxMp}
}
class Menu{
//メニュー, 0:ステータス、1,アイテム、2,技
public var main:Vector.<TextRow> = new Vector.<TextRow>() ;
public var sub:Vector.<TextRow> = new Vector.<TextRow>() ;
public var waza:Vector.<TextRow> = new Vector.<TextRow>() ;
public var waza2:Vector.<TextRow> = new Vector.<TextRow>() ;
public var box1:Vector.<TextRow> = new Vector.<TextRow>() ;
public var box2:Vector.<TextRow> = new Vector.<TextRow>() ;
public var box3:Vector.<TextRow> = new Vector.<TextRow>() ;
public var box4:Vector.<TextRow> = new Vector.<TextRow>() ;
public var dungeon:Dungeon;
public var mode:String = "close"; //close,stats,item,use,waza1,waza2,
public function Menu(dun:Dungeon):void{
dungeon = dun;
dungeon.textBitmap.addRow( (main[0] = new TextRow(30,30,2,"ステータス")) );
dungeon.textBitmap.addRow( (main[1] = new TextRow(30,50,2,"アイテム")) );
dungeon.textBitmap.addRow( (main[2] = new TextRow(30,70,2,"わざ")) );
dungeon.textBitmap.addRow( (waza[0] = new TextRow(150,30,2,"すで")) );
dungeon.textBitmap.addRow( (waza[1] = new TextRow(150,50,2,"ぶき")) );
dungeon.textBitmap.addRow( (waza[2] = new TextRow(150,70,2,"せいしん")) );
dungeon.textBitmap.addRow( (waza[3] = new TextRow(150,90,2,"まほう")) );
for( var i:int=0; i<40; i++){ dungeon.textBitmap.addRow( (sub[i] = new TextRow(150+Math.floor(i/20)*150, 20+(i % 20)*20,2,"")) ); }
for( var j:int=0; j<20; j++){ dungeon.textBitmap.addRow( (waza2[j] = new TextRow(250, 20+(i % 20)*20,1.7,"")) ) }
makeBox(2,15,1.7,7,3,20,box1); makeBox(120,5,1.7,22,20,20,box2);
makeBox(122,15,1.7,6,4,20,box3); makeBox(225,5,1.7,14,20,20,box4);
hideAll();
dungeon.stage.addEventListener("keyDown",change);
dungeon.textBitmap.addEventListener("choise",choise);
dungeon.textBitmap.addEventListener("cursorMove",move);
}
private function choise( e:ChoiseEvent ):void{
switch(e.text){
case "ステータス": statsOpen(); break;
case "アイテム": itemOpen(); break;
case "わざ": wazaOpen(); break;
}
}
private function move( e:ChoiseEvent ):void{
}
public function change(e:KeyboardEvent):void{
switch( e.keyCode ){
case 67: if( mode != "close" ){ close() }else if( dungeon.stop == false ){ open() } break;
case 88:
switch( mode ){
case "close": break;
case "main": close(); break;
default: mainOpen();
}
break;
}
}
private function open():void{
dungeon.stop = true;
dungeon.mapBitmap.visible = false;
KTween.to( dungeon.effect.color,0.5,{a:0.7,v:0.3},null,function f():void{ mainOpen(); });
}
private function mainOpen():void{
hideAll(); vis( box1 );vis( main );
dungeon.textBitmap.update(); mode="main";
dungeon.textBitmap.setChoise(main);
}
private function statsOpen():void{
hideAll(); vis( sub ); vis( box2 );
dungeon.textBitmap.update(); mode="stats";
dungeon.textBitmap.setChoise(null);
}
private function itemOpen():void{
hideAll(); vis( sub ); vis( box2 );
dungeon.textBitmap.update(); mode="item";
dungeon.textBitmap.setChoise(sub);
}
private function wazaOpen():void{
hideAll(); vis( waza ); vis( box3 );
dungeon.textBitmap.update(); mode="waza";
dungeon.textBitmap.setChoise(waza);
}
private function close():void{
hideAll();
dungeon.stop=false;
mode="close";
dungeon.textBitmap.setChoise(null);
KTween.to( dungeon.effect.color,0.5,{a:0,v:1},null,function f():void{ dungeon.mapBitmap.visible = true;});
}
private function makeBox( x:int,y:int,scale:Number,w:int,h:int,ih:int,vec:Vector.<TextRow> ):void{
var str:String = "";var i:int;
str="┌";for(i=0;i<w;i++){ str += "─" };str+="┐";
dungeon.textBitmap.addRow( vec[0] = new TextRow(x,y,scale,str) );
str="│";for(i=0;i<w;i++){ str += " " };str+="│";
for(var j:int=1;j<h+1;j++){ dungeon.textBitmap.addRow( vec[j] = new TextRow(x,y+20*j,scale,str) ); }
str="└";for(i=0;i<w;i++){ str += "─" };str+="┘";
dungeon.textBitmap.addRow( vec[j] = new TextRow(x,y+20*j,scale,str) );
}
private function hideAll():void{hide(main);hide(sub);hide(waza);hide(waza2);hide(box1);hide(box2);hide(box3);hide(box4);dungeon.textBitmap.update();}
private function hide(vec:Vector.<TextRow> ):void{for each(var row:TextRow in vec){row.visible=false}}
private function vis(vec:Vector.<TextRow> ):void{for each(var row:TextRow in vec){row.visible=true}}
private function del(vec:Vector.<TextRow> ):void{for each(var row:TextRow in vec){row.text=""}}
}
//マップに配置するオブジェクト
class GameObject extends Object {
public var anim:Object; //アニメーションに関するデータ
public var dir:String = ""; //向き
public var img:String = ""; //イメージ番号
public var moveArray:Array = [0,0,5];
public var moving:Boolean = false;
public var ability:Object = {}; //bool値を格納するための オブジェクト
public var func:Object = {}; //functionを格納するための オブジェクト
public var param:Object = {}; //paramを格納するための オブジェクト
//ゲームオブジェクトの外見
public var visual:String = "stand"; //プレートの配置方法を指定
public var name:String; //オブジェクトの名前
public var dungeon:Dungeon; //配置された部屋
public var x:int=0,y:int=0;
public var mapX:uint=0,mapY:uint=0;
public var state:String; //画像の状態
public var type:String; //使用する画像のタイプ
public var count:int = 0;
public var animState:String;//現在選択されているアニメーション
public var bitmapData:BitmapData;
public var plane:Plane;
//tween?
public var tweenFrame:Vector.<int>;
public var tween:Vector.<Object>;
//アニメーション時に呼び出される
public function animation():void{
if(anim[animState]!=null){
var data:Array = anim[animState];
//配列から現在のカウントと一致するものを取り出す。
data = data.filter(function(d:*, i:int, a:Array):Boolean{return d[0]==this.count},this);
for each(var act:Array in data){
switch(act[1]){
case "goto": count = act[2]; break;
case "action": animState = act[2]; count = -1; break;
default: state = act[1];
}
}
count++;
}
}
public function action(state:String,count:int=0):void{
animState = state; this.count = count;
}
public function addTween( o:Object, frame:int = 1, delay:int = 0):void{
if(o.tween == null){ tweenFrame=new Vector.<int>;tween=new Vector.<Object>; }
tween.push(o); tweenFrame.push(frame);
};
public function move():void{
for(var str:String in tween[0]){
this[str] = ( this[str]* (tweenFrame[0]-1) + tween[0][str] ) / tweenFrame[0];
}
tweenFrame[0]--;
if( tweenFrame[0] == 0){ tween.shift(); tweenFrame.shift(); }
}
public function slide():void{
if( moving ){
if( dungeon.check( mapX+moveArray[0], mapY+moveArray[1], "block" ).length == 0 ){
dungeon.map[mapX][mapY].splice( dungeon.map[mapX][mapY].indexOf(this), 1 );
mapX += moveArray[0]; mapY += moveArray[1];
addTween( { x:x+Data.cellSize*moveArray[0], y:y+Data.cellSize*moveArray[1] }, moveArray[2]);
dungeon.map[mapX][mapY].push(this);
if( name=="man"){
var target:Vector.<GameObject> = dungeon.check( mapX, mapY, "pickable" );
for each(var o:GameObject in target){ o.func.pick(o) }
}
}else{ addTween( {}, moveArray[2]); }
moving = false;
}
}
}
//主人公に関するデータ用クラス(static)
class Man{
static public const anim:Object = {
"stand": [[0,"s"]],
"kick":[ [0,"d"],[1,"k"],[5,"action","stand"] ],
"sup":[ [0,"j"],[10,"action","stand"] ],
"walk1":[ [0,"w1"],[3,"s"] ],
"walk2":[ [0,"w0"],[3,"s"] ]
}
static public function key(e:KeyboardEvent,man:GameObject):void{
var c:int; var dirX:int; var targets:Vector.<GameObject>; var o:GameObject
switch( Data.keyString[e.keyCode] ){
case "→": walk(man,"r"); break;
case "←": walk(man,"l"); break;
case "↑": walk(man,"b"); break;
case "↓": walk(man,"f"); break;
case "z": man.action("kick");man.addTween( {}, 6 ); break;
case "x": man.action("sup");man.addTween( {}, 6 ); break;
case " ": if(man.dungeon.check(man.mapX,man.mapY,"stair").length > 0){ man.dungeon.down() } break;
}
}
static public function walk(man:GameObject, dir:String):void{
if( dir == man.dir ){
var arr:Array = [[1,0],[-1,0],[0,1],[0,-1]]["rlbf".indexOf(man.dir)];
man.moveArray = arr;
}else{
man.dir = dir
man.moveArray = [0,0]
}
man.moveArray[2] = 6;//移動スピード
man.moving = true;
if( man.animState == "walk2" ){ man.action("walk1") }
else{ man.action("walk2") }
}
}
//敵に関するデータ用クラス(static)
class Enemy{
static public const anim:Object = {
"walk":[ [0,"w1"],[16,"w0"],[31,"goto",-1] ]
}
static public function frame( enm:GameObject ):void{
if( enm.dungeon.count % 12 == 0 ){
switch( enm.param.walkType ){
case "room": if( enm.dungeon.check(enm.dungeon.man.mapX,enm.dungeon.man.mapY,"room").length == 0 ){ random(enm); break; }
case "chase": chase(enm); break;
default: random(enm); break;
}
}
}
static public function walk(enm:GameObject):void{
var arr:Array = [[1,0],[-1,0],[0,1],[0,-1]]["rlbf".indexOf(enm.dir)];
enm.moveArray = arr;
enm.moveArray[2] = 12;//移動スピード
enm.moving = true;
}
static private function random(enm:GameObject):void{
if( enm.dungeon.count % 60 == 0 ){
enm.dir = "rlbf".substr(Math.random()*4,1);
walk(enm);
}
}
static private function chase(enm:GameObject):void{
var dir:Array = [];
if( enm.dungeon.man.mapX > enm.mapX ){ dir.push("r") }
else if( enm.dungeon.man.mapX < enm.mapX ){ dir.push("l") }
if( enm.dungeon.man.mapY > enm.mapY ){ dir.push("b") }
else if( enm.dungeon.man.mapY < enm.mapY ){ dir.push("f") }
enm.dir = dir[ int(dir.length*Math.random()) ];
walk(enm);
}
}
//アイテム用データクラス
class Item{
static public var tween:KTJob;
static public function pick(item:GameObject):void{
if( tween != null ){ tween.cancel(); }
tween = KTween.to( item.dungeon.message, 2, {}, null, function f1():void{item.dungeon.message.text = ""} )
if( item.dungeon.state.itemArray.length < item.dungeon.state.itemMax ){
var map:Array = item.dungeon.map[ item.mapX ][ item.mapY ];
map.splice( map.indexOf(item), 1 );
item.plane.visible = false;
item.dungeon.state.itemArray.push( item );
item.dungeon.message.text = item.param.name+" を てにいれた";
}else{
item.dungeon.message.text = "もちもの が いっぱい";
}
}
}
//ゲームデータ用クラス
class Data {
static public const cellSize:int=50,cellWidth:int=cellSize,cellHeight:int=cellSize;
static public const gameWidth:int=465,gameHeight:int=465;
static public const keyString:Object = {37:"←",38:"↑",39:"→",40:"↓",88:"x",90:"z",67:"c",32:" "}
//各オブジェクトに使うビットマップデータの設定
public var MAP_SET:Object = { "man":"man0", "enemy":"enemy0", "room":"room0", item:"item0"}
static public const URL:Object = {
"man0":"http://assets.wonderfl.net/images/related_images/f/f1/f168/f168bdc2ee526b301fc8734d2d48f8e9d2f06f53",
"room0":"http://assets.wonderfl.net/images/related_images/a/ac/ac75/ac75fcdc15b0f4c805d8be257d1564748d7d7645",
"enemy0":"http://assets.wonderfl.net/images/related_images/3/36/3628/362841f60b3777386f56387026b6129d4182b9ee",
"item0":"http://assets.wonderfl.net/images/related_images/6/6b/6b67/6b67d278ebebbcbb199457b09055eb0f4d8187a4"
}
static public const URL_NAME:Array = ["man0","room0","enemy0","item0"];
static public const IMG_NAME:Object = {
"man":["lw0","lw1","rw0","rw1","fw0","fw1","bw0","bw1", "ls" ,"rs" ,"fs" ,"bs" ,"lk" ,"rk" ,"fk" ,"bk" ,"lj" ,"rj" ,"fj" ,"bj" ,"ld" ,"rd" ,"fd" ,"bd" ],
"room":["wall","road","stair","stone","room"],
"item":["1item","2item","3item"],
"enemy":enmImg()
}
static private function enmImg():Array {
var a:Array = [ "lw0", "lw1", "rw0", "rw1", "fw0", "fw1", "bw0", "bw1"]; var re:Array = [];
for (var i:int = 1; i <= 6; i++ ) { for (var j:int = 0; j < a.length; j++ ){ re.push(""+i+a[j]) } }
return re;
}
//GameObjectに関する設定,各GameObjectの特徴を記録
static public const OBJECT:Object = {
"man": { type:"man", state:"w0", visual:"stand", func:{ key:Man.key }, ability:{ map:false,block:true },anim:Man.anim, animState:"walk1", dir:"f" },
"enemy": { type:"enemy", state:"w0", func:{ frame:Enemy.frame }, visual:"stand", ability:{ map:false,block:true }, anim:Enemy.anim, animState:"walk", dir:"f" },
"item": { type:"item", state:"item", func: { pick:Item.pick }, ability:{ pickable:true,map:false,item:false },visual:"drop" },
"fwall": { type:"room", state:"wall", visual:"front" },
"bwall": { type:"room", state:"wall", visual:"back" },
"rwall": { type:"room", state:"wall", visual:"right" },
"lwall": { type:"room", state:"wall", visual:"left" },
"ceil": { type:"room", state:"stone", visual:"ceil", ability:{ block:true } },
"road": { type:"room", state:"road", visual:"floor", ability:{map:false} },
"stair": { type:"room", state:"stair", visual:"floor" , ability: { map:false,stair:true,room:true }},
"room": { type:"room", state:"room", visual:"floor", ability: { map:false,room:true } }
}
public static var FLOOR:Array = [ //各階の構造に関するデータ
{//0階(デフォルト値)
enMax:2, enMin:1, //敵の数
itMax:2, itMin:0, //アイテムの数
width:35, height:35,
roomWidth:6, roomHeight:6,
type:"random"
},
/* 1階 */{ enemy:[1,2,3,4,5,6], item:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] },
];
public static var ENEMY:Object = [
//敵のデータ、名前は暫定
/*デフォルト*/{ name:"敵", life:100, walkType:"room" },
/*1*/{ name:"もさもさ", life:60, walkType:"room" },
/*2*/{ name:"ふさふさ", life:50, walkType:"random" },
/*3*/{ name:"めだまさん", life:50, walkType:"room" },
/*4*/{ name:"ヨハン", life:50, walkType:"chase" },
/*5*/{ name:"カムイ", life:50, walkType:"chase" },
/*6*/{ name:"ゴールドヨハン", life:50, walkType:"chase" }
]
public static var ITEM:Object = [
//アイテムのデータ
/*デフォルト*/{ },
/*1*/{ name:"フォーク", img:"1", value:1, type:"katana" },
/*2*/{ name:"しない", img:"1", value:5, type:"katana"},
/*3*/{ name:"ぼくとう", img:"1", value:10, type:"katana"},
/*4*/{ name:"ボロふく", img:"2", value:0, type:"dogi" },
/*5*/{ name:"どうぎ", img:"2", value:3, type:"dogi" },
/*6*/{ name:"きずぐすり", img:"3", value:50, type:"hp" },
/*7*/{ name:"もぞうとう", img:"1", value:13, type:"katana"},
/*8*/{ name:"こだち", img:"1", value:30, type:"katana"},
/*9*/{ name:"たち", img:"1", value:35, type:"katana"},
/*10*/{ name:"ながまき", img:"1", value:40, type:"katana"},
/*11*/{ name:"まさむね", img:"1", value:60, type:"katana"},
/*12*/{ name:"ざんてつけん", img:"1", value:99, type:"katana"},
/*13*/{ name:"きんのかたな", img:"1", value:15, type:"katana"},
/*14*/{ name:"くさりかたびら", img:"2", value:10, type:"dogi" },
/*15*/{ name:"ぼうだんベスト", img:"2", value:20, type:"dogi" },
/*16*/{ name:"どうぎ", img:"2", value:3, type:"dogi" },
/*17*/{ name:"まきもの", img:"2", value:5, type:"dogi" },
]
public static var WAZA:Object = [
//わざのデータ
/*デフォルト*/{ effect:"hit" },
/*1*/{ name:"けり", value:1, type:"sude" },
/*2*/{ name:"きりさき", value:1, type:"buki"},
/*3*/{ name:"ため", value:2, type:"seisin", effect:"powor" },
/*4*/{ name:"ファイヤー", value:10, type:"mahou", effect:"direct"}
]
//ビットマップを記録したオブジェクト。ロード後に使用可能
public var imageMap:Object = {};
public var imageCell:Object = {};
public var imageRect:Object = {};
private var loaders:Vector.<Loader> = new Vector.<Loader>();
//画像をロード。ローダーの配列を作る。
public function load():Vector.<Loader>{
for each(var url:String in URL){
var loader:Loader = new Loader();
loaders.push(loader);
}
loaders[0].load(new URLRequest(URL[URL_NAME[0]]), new LoaderContext(true));
loaders[0].contentLoaderInfo.addEventListener("complete",onLoad,false,1000);
return loaders;
}
//bitmapdataに画像を描画する
public function draw(target:BitmapData,type:String,name:String,x:int=0,y:int=0,dir:Boolean=true):void{
var map:String = MAP_SET[type];
var mtr:Matrix = new Matrix(-1,0,0,1,x+cellWidth,y)
if (dir) { mtr.a = 1, mtr.tx = x }
if(-1 < IMG_NAME[type].indexOf(name)){
target.fillRect( target.rect, 0 )
target.draw( imageCell[map][ IMG_NAME[type].indexOf(name) ] ,mtr)
}
}
public function getImage(type:String,name:String):BitmapData{ return imageCell[ MAP_SET[type] ][ IMG_NAME[type].indexOf(name) ].clone(); }
//指定した条件の物体を設置する。
static public function setObject( dun:Dungeon,x:int,y:int,name:String ):GameObject{
if(name != null && OBJECT[name] != null){
var obj:Object = clone( OBJECT[name] );
var g:GameObject = new GameObject();
for(var str:String in obj){ g[ str ] = obj[ str ]; }
g.mapX = x; g.mapY = y; g.x = (x - 0.5)* cellWidth; g.y = (y - 0.5) * cellHeight;
g.name = name; g.dungeon = dun;
}
dun.map[x][y].push( g );
return g;
}
//マップを立体化する
static public function stand( dun:Dungeon ):void {
dun.view.scene = null;
var scene:Scene3D = new Scene3D();
for ( var i:int = 0; i < dun.map.length; i++ ) {
for ( var j:int = 0; j < dun.map[i].length; j++ ) {
for each( var g:GameObject in dun.map[i][j] ) {
if( g != null ){
g.bitmapData = dun.data.getImage( g.type, g.img + g.dir + g.state );
var material:BitmapMaterial = new BitmapMaterial( g.bitmapData );
g.plane = new Plane( material ); g.plane.visible = false; material.doubleSided = true;
//g.plane.scaleX = cellSize/g.bitmapData.width; g.plane.scaleY = cellSize/g.bitmapData.height;
setPlane(g);
if( g.name == "man" ){dun.man = g}
scene.addChild( g.plane );
}
}
}
}
dun.view.scene = scene;
}
static public function setPlane(g:GameObject):void{
switch( g.visual ){
case "ceil": g.plane.z = -cellSize;
case "floor": g.plane.x = g.x; g.plane.y = g.y; break;
case "stand": g.plane.scaleX = g.plane.scaleY = 2;g.plane.z = -cellSize/2; g.plane.x=g.x;g.plane.y=g.y+5;g.plane.rotationX=-35; break;
case "drop": g.plane.z = -cellSize/4; g.plane.x=g.x;g.plane.y=g.y+5;g.plane.rotationX=-35; break;
case "left": g.plane.z = -cellSize/2; g.plane.x=g.x-25;g.plane.y=g.y;g.plane.rotationX=90;g.plane.rotationZ=90; break;
case "right": g.plane.z = -cellSize/2; g.plane.x=g.x+25;g.plane.y=g.y;g.plane.rotationX=90;g.plane.rotationZ=90; break;
case "front": g.plane.z = -cellSize/2; g.plane.x=g.x;g.plane.y=g.y+25;g.plane.rotationX=90;g.plane.rotationZ=180; break;
case "back": g.plane.z = -cellSize/2; g.plane.x=g.x;g.plane.y=g.y-25;g.plane.rotationX=90; break;
}
}
static private var loadNum:int = 0;
private function onLoad(e:Event):void{
e.currentTarget.removeEventListener("complete",onLoad);
var rect:Rectangle = e.currentTarget.content.getRect(e.currentTarget.content);
imageMap[URL_NAME[loadNum]]=new BitmapData(rect.width,rect.height,true,0x000000);
imageMap[URL_NAME[loadNum]].draw( e.currentTarget.content );
imageMap[URL_NAME[loadNum]].lock();
setImageRect(URL_NAME[loadNum]);
loadNum++;
if(URL_NAME.length>loadNum){
loaders[loadNum].load(new URLRequest(URL[URL_NAME[loadNum]]), new LoaderContext(true));
loaders[loadNum].contentLoaderInfo.addEventListener("complete",onLoad,false,1000);
}
}
private function setImageRect(name:String):void{
imageCell[name] = [];
var map:BitmapData = imageMap[name];
var lineColor:uint = map.getPixel32(map.width-1,map.height-1);
var x:int = 0; var y:int=0; var height:int=0; var width:int=0; var count:int=0;
while(true){
width=0;height=0;
if(lineColor != map.getPixel32(x,y) ){
for(var i:int=1;i+x<map.width;i++){
if( lineColor == map.getPixel32(x+i,y) ){break;}
}
width=i;
for(var j:int=1;j+y<map.width;j++){
if( lineColor == map.getPixel32(x,y+j) ){break;}
}
height=j;
var rect:Rectangle = new Rectangle(x,y,width,height);
var rect2:Rectangle = new Rectangle(0,0,width,height);
var cell:BitmapData = new BitmapData(rect.width,rect.height,true,0x0)
cell.setVector( rect2,map.getVector( rect ) );
imageCell[name].push( cell );
}
x+=width+1; if(x>=map.width){ y+=height+1;x=0; } if(y>=map.height){ break; }
count++;
}
}
//ランダムマップ生成
static public function makeMap( dun:Dungeon, flr:int ):void {
var count:int = 0;
while(true){
count++;
var data:Object = clone( FLOOR[ ( (flr-1) % (FLOOR.length-1) )+1 ] );
for ( var str:String in FLOOR[0] ) {
if( data[str] == null ){ data[str] = FLOOR[0][str] }
}
//まっさらなマップ生成
dun.mapWidth = data.width; dun.mapHeight = data.height;
dun.map = new Vector.<Vector.<Array>>();
for ( var i:int = 0; i < dun.mapHeight; i++ ) {
dun.map[i] = new Vector.<Array>();
for ( var j:int = 0; j < dun.mapWidth; j++ ){ dun.map[i][j] = []; }
dun.map[i].fixed = true;
}
dun.map.fixed = true;
dun.rooms = new Vector.<Rectangle>();
if ( data["type"] == "random" ) {
//マップに部屋を配置
var missCount:int = 0;
while( missCount < 10 || dun.rooms.length < 2 ){
if ( MapUtil.requestRoom( dun, data ) == false ) { missCount++; } else{ missCount=0; }
}
/*通路を設置*/ if( MapUtil.makeRoad( dun ) == false ){ continue; }
/*壁配置*/ MapUtil.makeWall( dun );
/*天井配置*/ MapUtil.makeCeil( dun );
/*人配置*/ MapUtil.roomAdd( dun, dun.rooms[0], "man" );
/*階段配置*/ MapUtil.roomSet( dun, dun.rooms[dun.rooms.length-1], "stair" );
/*敵配置*/ MapUtil.addEnemy( dun, data );
/*アイテム配置*/ MapUtil.addItem( dun, data );
}
break;
}
}
}
//マップ生成の補助をする関数をおさめたクラス
class MapUtil {
static public function requestRoom( dun:Dungeon, d:Object ):Boolean {
var rect:Rectangle = new Rectangle( Math.floor( Math.random() * (d.width - d.roomWidth - 2) ), Math.floor( Math.random() * (d.height - d.roomHeight - 2) ), d.roomWidth+2, d.roomHeight+2 );
for each( var r:Rectangle in dun.rooms) { if ( r.intersects( rect ) ) { return false; } }
rect.x++; rect.y++; rect.width -= 2; rect.height -= 2;
makeRoom( dun, rect );
return true;
}
static private function makeRoom( dun:Dungeon, rect:Rectangle ):void {
for (var i:int = 0; i < rect.width; i++ ) { for (var j:int = 0; j < rect.height; j++ ) {
var o:GameObject = Data.setObject( dun, rect.x+i, rect.y+j, "room" );
o.param = { roomNum:dun.rooms.length }
} }
dun.rooms.push( rect );
}
static public function makeCeil( dun:Dungeon ):void { //マップ何もない所にceilを配置
for (var i:int = 0; i < dun.mapWidth; i++ ) { for (var j:int = 0; j < dun.mapHeight; j++ ) {
if (dun.map[i][j].length == 0) { Data.setObject( dun, i, j, "ceil" ); }
} }
}
static public function makeWall( dun:Dungeon ):void {
var o:GameObject;
for (var i:int = 1; i < dun.mapWidth-1; i++ ) {
for (var j:int = 1; j < dun.mapHeight-1; j++ ) {
if (dun.map[i][j].length > 0) {
if( dun.map[i-1][j].length == 0 ){ Data.setObject( dun, i, j, "lwall" ); }
if( dun.map[i+1][j].length == 0 ){ Data.setObject( dun, i, j, "rwall" ); }
if( dun.map[i][j+1].length == 0 ){ Data.setObject( dun, i, j, "fwall" ); }
//if( dun.map[i][j-1].length == 0 ){ Data.setObject( dun, i, j, "bwall" ); }
}
}
}
}
static public function makeRoad( dun:Dungeon ):Boolean {
var roomConect:Array = [];var roomDir:Array = [];var count:int = 0;
for(var n:int = 0; n < dun.rooms.length ; n++ ){ roomConect[n] = [n] }
var roads:Vector.<Vector.<GameObject>> = new Vector.<Vector.<GameObject>>();
var d:Array = [ [1,0],[-1,0],[0,1],[0,-1] ];
for( var i:int; i<dun.rooms.length ;i++ ){ roomDir[i] = [ d[0], d[1], d[2], d[3] ] }
while( count < 12 ){
var roomNum:int = Math.random() * dun.rooms.length;
if( roomDir[roomNum].length > 0 ){ count=0; var dir:Array = roomDir[roomNum].splice(Math.floor(Math.random()*roomDir[roomNum].length),1)[0] ;
}else{ count++; continue; }
var road:Vector.<GameObject> = new Vector.<GameObject>();
var room:Rectangle = dun.rooms[ roomNum ];
var pos:Array = [ int(room.x+1 + (room.width-2)*Math.random()), int(room.y+1 + (room.height-2)*Math.random()) ];
do{
pos[0] += dir[0]; pos[1]+=dir[1];
if( !room.contains(pos[0],pos[1]) ){
if( dun.map[ pos[0] ][ pos[1] ].length > 0 || dun.map[ pos[0]+dir[1] ][ pos[1]+dir[0] ].length > 0 || dun.map[ pos[0]-dir[1] ][ pos[1]-dir[0] ].length > 0 ){ break; }
if( dun.map[ pos[0] + dir[0] ][ pos[1] + dir[1] ].length > 0 ){
if( dun.map[ pos[0]+dir[0]+dir[1] ][ pos[1]+dir[0]+dir[1] ].length > 0 && dun.map[ pos[0]-dir[1]+dir[0] ][ pos[1]-dir[0]+dir[1] ].length > 0 ){
var target:GameObject = dun.check( pos[0] + dir[0], pos[1] + dir[1] )[0]
var c:int = target.param.roomNum;
if( roomConect[roomNum].indexOf(c) < 0 ){
roomConect[roomNum].push(c);
roomConect[c] = roomConect[roomNum];
}else{
var rev:Array = d[ [d[1],d[0],d[3],d[2]].indexOf( dir ) ] ;
if( target.name == "room" && roomDir[c].indexOf( rev ) < 0 ) { break; }
}
}else{ break; }
}
var o:GameObject = Data.setObject( dun, pos[0], pos[1], "road" )
o.param = { roomNum:roomNum, roadNum:count }
road.push( o );
}
}while( 1 < pos[0] && pos[0] < dun.map.length-2 && 1 < pos[1] && pos[1] < dun.map[0].length-2 )
roads.push(road);
if( roomConect[0].length == roomConect.length ){
for each( road in roads ){
for( var j:int = road.length-1; j>=0; j-- ){
var x:int = road[j].mapX; var y:int = road[j].mapY;
if( dun.map[ x+1 ][ y ].length + dun.map[ x-1][y ].length + dun.map[ x][y+1 ].length + dun.map[ x ][ y-1 ].length == 1 ){
dun.map[x][y] = [];
}else{ j = 0 }
}
}
return true;
}
}
return false;
}
static public function roomAdd( dun:Dungeon, room:Rectangle, str:String ):GameObject{
while(true){
var x:int = Math.floor(room.x+Math.random()*(room.width-2)+1);
var y:int = Math.floor(room.y+Math.random()*(room.height-2)+1);
if( dun.check(x,y,"block").length == 0 ){ break; }
}
return Data.setObject( dun, x, y, str );
}
static public function roomSet( dun:Dungeon, room:Rectangle, str:String ):GameObject{
var x:int = Math.floor(room.x+Math.random()*(room.width-2)+1);
var y:int = Math.floor(room.y+Math.random()*(room.height-2)+1);
dun.map[x][y]=[];
return Data.setObject( dun, x, y, str );
}
static public function addEnemy( dun:Dungeon, d:Object ):void{
for(var i:int=1;i < dun.rooms.length;i++){
var l:int = Math.random()*(d.enMax-d.enMin+1) + d.enMin;
for(var j:int=0;j < l;j++){
var o:GameObject = roomAdd( dun, dun.rooms[i], "enemy" );
var rand:int = d.enemy[ int(d.enemy.length*Math.random()) ];
var data:Object = clone( Data.ENEMY[rand] );
for ( var str:String in Data.ENEMY[0] ) { if( data[str] == null ){ data[str] = Data.ENEMY[0][str] } }
o.param = data; o.img = ""+rand; o.param.num = rand;
}
}
}
static public function addItem( dun:Dungeon, d:Object ):void{
for(var i:int=0;i < dun.rooms.length;i++){
var l:int = Math.random()*(d.itMax-d.itMin+1) + d.itMin;
for(var j:int=0;j < l;j++){
var o:GameObject = roomAdd( dun, dun.rooms[i], "item" );
var rand:int = d.item[ int(d.item.length*Math.random()) ];
var data:Object = clone( Data.ITEM[rand] );
for ( var str:String in Data.ITEM[0] ) { if( data[str] == null ){ data[str] = Data.ENEMY[0][str] } }
o.param = data; o.img = ""+o.param.img; o.param.num = rand;
}
}
}
static public function mapBitmap( dun:Dungeon ):BitmapData {
return new BitmapData( dun.map.length, dun.map[0].length, true, 0 );
}
static public function mapDraw( dun:Dungeon ):void {
var b:BitmapData = dun.mapBitmap.bitmapData;
b.lock();
var target:Vector.<GameObject>,see:int = 5;
for(var i:uint = 0; i< dun.map.length; i++ ){
for(var j:uint = 0; j< dun.map[0].length; j++ ){
if( (target = dun.check(i,j,"map")).length > 0 ){
if( target[0].ability.map ){
if( target[0].name == "room" || target[0].name == "road" ){ b.setPixel32( i,j,0xFF00FF00 );
}else if( target[0].name == "stair" ){ b.setPixel32( i,j,0xFFFF0000 ) }
if( dun.man.mapX-see < i && i < dun.man.mapX+see && dun.man.mapY-see < j && j < dun.man.mapY+see ){
for( var k:uint = 1; k<target.length; k++ ){
if( target[k].name == "enemy" ){ b.setPixel32( i,j,0xFF3344FF ) }
else if( target[k].name == "man" ){ b.setPixel32( i,j,0xFFFF00FF ) }
else if( target[k].name == "item" ){ b.setPixel32( i,j,0xFFFFFF00 ) }
}
}
}else{ b.setPixel32( i,j,0x000000FF ); }
}
}
}
b.unlock();
}
static public function mapUpdate( dun:Dungeon ):void {
var target:Vector.<GameObject> = dun.check(dun.man.mapX,dun.man.mapY,"map");
if( target[0].ability.map == false ){
target[0].ability.map = true
if( target[0].name == "room" ){
var rect:Rectangle = dun.rooms[ target[0].param.roomNum ];
for (var i:uint = 0; i < rect.width; i++ ) { for (var j:uint = 0; j < rect.height; j++ ) {
dun.check(i+rect.x,j+rect.y,"map")[0].ability.map = true;
} }
}
}
}
}
class TextBitmap extends Bitmap{
public var rows:Vector.<TextRow> = new Vector.<TextRow>();
public var choise:Vector.<TextRow> = new Vector.<TextRow>();
public var select:int;
function TextBitmap(w:int,h:int){
super( new BitmapData(w,h,true,0) );
addEventListener("addedToStage",init);
}
private function init(e:Event):void{
stage.addEventListener("keyDown",keyDown);
}
private function keyDown(e:KeyboardEvent):void{
switch(e.keyCode){
case Keyboard.UP: select--; dispatchSelect(); break;
case Keyboard.DOWN: select++; dispatchSelect(); break;
case Keyboard.LEFT: select-=20; dispatchSelect(); break;
case Keyboard.RIGHT: select+=20; dispatchSelect(); break;
case 90: if( choise != null && choise.length > 0 ){dispatchEvent( new ChoiseEvent("choise", choise[select]) )} break;
}
}
private function dispatchSelect():void{
if( choise != null && choise.length > 0 ){
select = (select % choise.length);
if(select < 0){ select += choise.length }
dispatchEvent( new ChoiseEvent("cursorMove", choise[select]) );
update();
}
}
public function update():void{
var b:BitmapData = bitmapData;
b.lock();
b.fillRect(b.rect,00)
for each(var row:TextRow in rows){ row.draw() }
if( choise != null && choise.length > 0 ){
select = (select % choise.length);
if(select < 0){ select += choise.length }
var t:TextRow = choise[select]
var f:BitmapData = fonts[">"].bmd;
b.draw(f, new Matrix( t.scale, 0, 0, t.scale, t.x - t.scale*f.width, t.y ) );
}
b.unlock();
}
public function addRow(r:TextRow):void{ rows.push(r); r.parent=this; update() }
public function setChoise(vec:Vector.<TextRow>):void{ choise = vec; select=0; update(); }
}
class TextRow {
public var scale:Number=0,x:int=0,y:int=0,parent:TextBitmap,visible:Boolean=true;
private var _str:String="";
public function get text():String{return _str;}
public function set text(str:String):void{_str=str;if(parent!=null){parent.update()}}
function TextRow(x:int,y:int,scale:Number=3,str:String=""){
this.x=x;this.y=y;this.scale=scale;this._str=str;
}
public function draw():void{
if(visible && parent != null ){
var b:BitmapData = parent.bitmapData; var w:int = 0;
for(var i:int=0;i<_str.length;i++){
var f:BitmapData = fonts[_str.substr(i,1)].bmd;
b.draw(f, new Matrix( scale, 0, 0, scale, x + w * scale, y ) );
w += (f.width);
}
}
}
}
class ChoiseEvent extends Event {
public var text:String, row:TextRow;
static public const CHOISE:String="choise", CURSOR_MOVE:String="cursorMove";
function ChoiseEvent(str:String, row:TextRow){ text = row.text; this.row = row; super( str ); }
}
//Frocessing-HSVカラーを利用 http://www.libspark.org/wiki/nutsu/Frocessing
//サンプルコード:http://wonderfl.net/search?q=frocessing
import frocessing.color.ColorHSV;
class EffectMap extends Bitmap{
public var color:ColorHSV = new ColorHSV();
public var back:BitmapData;
public var moving:Boolean = true;
function EffectMap(w:int,h:int){
super( new BitmapData(w,h,true,0) );
back = sphere( w,h );
color.h = 0; color.s = 0; color.v = 1; color.a = 0;
}
public function onFrame(e:Event=null):void{
var b:BitmapData = bitmapData;
b.lock();
b.fillRect( b.rect, color.value32 );
b.draw( back );
b.unlock();
}
private function sphere(w:int,h:int):BitmapData{
var b:BitmapData = new BitmapData(w,h,true,0);
b.lock();
for( var i:int=0; i<w; i++ ){ for( var j:int=0; j<h; j++ ){
var cx:int = i-(w>>1), cy:int = j-(h>>1);
var r:int = 0x200 * Math.sqrt(cx*cx+cy*cy)/w - 0x40;
r = r < 0xF0 ? r : 0xF0; r = r > 0 ? r : 0;
b.setPixel32(i,j, 0x1000000 * r );
} }
b.unlock();
return b;
}
}
//ライブラリ
//ロード画面 http://wonderfl.net/c/zZl2
class NowLoading extends Sprite{
static public const COMPLETE:String = "complete";
public var loaders:Vector.<Object> = new Vector.<Object>;
public var bytesTotal:uint=0,bytesLoaded:uint=0;
private var _loaderNum:uint=0,_completedNum:uint=0,_openNum:uint=0; //ローダーの数
private var text:Bitmap, sprite:ProgressSprite;
private var onLoaded:Function;
private var LETTER:Object = {//文字
"1":[[0,1,1],[0,0,1],[0,0,1],[0,0,1],[0,0,1]],"2":[[1,1,1],[0,0,1],[0,1,1],[1,0,0],[1,1,1]],"3":[[1,1,1],[0,0,1],[1,1,1],[0,0,1],[1,1,1]],"4":[[1,0,1],[1,0,1],[1,0,1],[1,1,1],[0,0,1]],"5":[[1,1,1],[1,0,0],[1,1,1],[0,0,1],[1,1,1]],
"6":[[1,1,1],[1,0,0],[1,1,1],[1,0,1],[1,1,1]],"7":[[1,1,1],[0,0,1],[0,0,1],[0,0,1],[0,0,1]],"8":[[1,1,1],[1,0,1],[1,1,1],[1,0,1],[1,1,1]],"9":[[1,1,1],[1,0,1],[1,1,1],[0,0,1],[0,0,1]],"0":[[1,1,1],[1,0,1],[1,0,1],[1,0,1],[1,1,1]],
".":[[0],[0],[0],[0],[1]]," ":[[0],[0],[0],[0],[0]],"n":[[0,0,0],[0,0,0],[1,1,1],[1,0,1],[1,0,1]],"w":[[0,0,0,0,0],[0,0,0,0,0],[1,0,1,0,1],[1,0,1,0,1],[1,1,1,1,1]],"o":[[0,0,0],[0,0,0],[1,1,1],[1,0,1],[1,1,1]],
"a":[[0,0,0],[0,0,1],[1,1,1],[1,0,1],[1,1,1]],"l":[[1],[1],[1],[1],[1]],"i":[[1],[0],[1],[1],[1]],"d":[[0,0,1],[0,0,1],[1,1,1],[1,0,1],[1,1,1]],"g":[[0,0,0],[0,0,0],[1,1,1],[1,0,1],[1,1,1],[0,0,1],[1,1,1]],
"C":[[1,1,1],[1,0,0],[1,0,0],[1,0,0],[1,1,1]],"O":[[1,1,1],[1,0,1],[1,0,1],[1,0,1],[1,1,1]],"M":[[1,1,1,1,1],[1,0,1,0,1],[1,0,1,0,1],[1,0,1,0,1],[1,0,1,0,1]],"P":[[1,1,1],[1,0,1],[1,1,1],[1,0,0],[1,0,0]],
"T":[[1,1,1],[0,1,0],[0,1,0],[0,1,0],[0,1,0]],"L":[[1,0,0],[1,0,0],[1,0,0],[1,0,0],[1,1,1]],"E":[[1,1,1],[1,0,0],[1,1,1],[1,0,0],[1,1,1]]
}
//ステージと関数を渡す
public function NowLoading(stage:Stage, onLoaded:Function = null){
if(onLoaded == null){ this.onLoaded=nullFunc }else{ this.onLoaded=onLoaded }
sprite = new ProgressSprite(stage.stageWidth,stage.stageHeight);
text = new Bitmap( new BitmapData(30*4,8,true,0x00000000 ) );
stage.addChild(this); addChild(sprite); addChild(text);
with(text){scaleX=scaleY=1; blendMode="invert"; x=stage.stageWidth-text.width; y=stage.stageHeight-text.height;}
}
//ローダーの追加
public function addLoader(loader:Loader):Loader{ setListener(loader.contentLoaderInfo);_loaderNum++;return loader;}
public function addURLLoader(loader:URLLoader):URLLoader{setListener(loader); _loaderNum++; return loader;}
private function nullFunc():void{}
private function setListener(loader:*):void{
loader.addEventListener("open", onOpen);
loader.addEventListener("complete", onComplete);
loader.addEventListener("progress", update);
}
private function update(e:Event=null):void{
bytesLoaded=0; bytesTotal=0;
for each(var loadObj:Object in loaders){
bytesLoaded += loadObj.bytesLoaded;
bytesTotal += loadObj.bytesTotal;
};
sprite.progress(bytesLoaded/bytesTotal * _openNum/_loaderNum);
if(bytesTotal!=0){ setText( "now loading... "+(bytesLoaded/bytesTotal* _openNum/_loaderNum*100).toFixed(1) ); }
}
private function onOpen(e:Event):void{ _openNum++;loaders.push(e.currentTarget); bytesTotal+=e.currentTarget.bytesTotal; }
private function onComplete(e:Event):void{ _completedNum++;if(_loaderNum == _completedNum){ setText( "COMPLETE" );onLoaded(); } }
private function setText(str:String):void{
var b:BitmapData = text.bitmapData; var l:int = str.length; var position:int = b.width;
b.lock();b.fillRect(b.rect,0x000000);
for(var i:int=0;i<l;i++){
var letterData:Array = LETTER[str.substr(l-i-1,1)];position-=letterData[0].length+1;
for(var n:int=0;n<letterData.length;n++){ for(var m:int=0;m<letterData[n].length;m++){
if(letterData[n][m]==1){b.setPixel32(m+position,n+1,0xFF000000);}
} }
}
b.unlock();
}
}
//このスプライトを編集することでロード画面を変えることができる。
class ProgressSprite extends Sprite{
private var mapData:BitmapData,sphereData:BitmapData,noizeData:BitmapData;
private var bfRate:Number=0; //前の段階での進行度
private var drawRate:Number=0;
private var maxLevel:int = 5;
private var meter:Array = new Array();
//コンストラクタ
public function ProgressSprite(width:int,height:int):void{
mapData = new BitmapData(width,height,true,0x00000000);
addChild(new Bitmap(mapData)).blendMode="invert";
for(var i:int=0;i<maxLevel;i++){
meter[i]=0;
}
addEventListener("enterFrame",onFrame);
}
//ロードが進行したときに呼び出される。 rateはロードの進行度で0-1
public function progress(rate:Number):void{ bfRate = rate; }
//ロードの進行度に合わせて、描画。
private function draw(rate:Number, level:int=0):void{
var thick:int = mapData.height*(0.61803)/1.61803;
var floor:int = 0;
for(var i:int=1;i<level+1;i++){
thick*=(0.61803)/1.61803;
floor+=thick;
}
mapData.fillRect( new Rectangle(0,mapData.height-floor,mapData.width*rate,thick), 0x1000000*int(0xFF*(maxLevel-level+1)/(maxLevel)));
}
private function onFrame(e:Event):void{
for(var i:int=0;i<maxLevel;i++){
var n:int = Math.pow(2,i+2);
meter[i]=(bfRate+ meter[i]*(n-1))/n;
draw(meter[i],i);
}
}
}
//ライブラリ
//SiON-音声全般 http://www.libspark.org/wiki/keim/SiON
//サンプルコード:http://wonderfl.net/search?q=org.si.sion
import org.si.sion.*;
import org.si.sound.*;
class MyDriver extends SiONDriver {
public var dm:DrumMachine = new DrumMachine(0, 0, 0, 1, 1, 1);
public var fill:SiONData;
function MyDriver():void{
super();
volume = 2.0
dm.volume = 0.1;
setVoice(0, new SiONVoice(5,2,63,63,-10,0,2,20));
fill = compile("#A=c&ccrccrc&cccrc&c&c&c;#B=<c&c>bragrf&fedrc&c&c&c;#C=<c&c>bragra&ab<crc&c&c&c>;%1@8,l16B;#D=rrrrrrrrrrrrcerg;#E=<c>bagfedcfedrc&c&c&c;#F=cdefgab<c>fgar<c&c&c&c>;");
setSamplerData(0, render("%2@4 v8 l24 c<<c"));
setSamplerData(1, render("%2@4 l60 ccc"));
setSamplerData(2, render("%3@8 l12 <<<<<a0b0c0b0e0d0g"));
setSamplerData(3, render("%3@4 l60 <<<<<c>c"));
setSamplerData(4, render("%2@60 v2 l48 c<c"));
setSamplerData(5, render("%3@0q0,c"));
setSamplerData(6, render("%2@4, l24q0 <<c<<c>>c<<c>>"));
play() ;
}
}
class Sound{
static public var driver:MyDriver = new MyDriver();
static public function se(i:int,delay:int=0):void{
driver.playSound(i,0,delay);
}
static public function music(i:int=1):void{
switch(i) {
case 1:
//driver.dm.play();
driver.dm.fadeIn(6);
break;
case 2:
driver.dm.stop();
driver.sequenceOn(driver.fill);
break;
}
}
}
//配列の複製を返す http://wonderfl.net/c/5fQr
import flash.utils.getQualifiedClassName;
function clone(arg:*):*{
var cl:*;
var name:String = getQualifiedClassName(arg);
if( name == "Object" || name == "Array" || name == "Vector" ){
if( name == "Object" ){ cl = {}; }
else if( name == "Array" ){ cl = []; }
else if( name == "Vector" ){ cl = Vector([]); }
for( var s:String in arg ){
cl[s] = clone( arg[s] );
}
return cl;
}else if( arg is Object && arg.hasOwnProperty("clone") && arg.clone is Function ){
return arg.clone();
}
return arg;
}
//Dot Fontの利用 http://wonderfl.net/c/aB4L
class FontData
{
public var bmd: BitmapData;
function FontData(data: String)
{
if (data == null) return;
var arr: Array = data.match(/../g).map(_map).reverse();
bmd = new BitmapData(8, 15, true, 0x00000000);
bmd.lock();
var y: int, x: int;
while (arr.length > 0)
{
var u: uint = arr.pop();
for (x = 0; x < 8; x++, u >>= 1) bmd.setPixel32(7 - x, y, (u & 1) ? 0xFFFFFFFF : 0x00000000);
y ++;
}
bmd.unlock();
}
private function _map(e: *, i: int, a: Array): int { return parseInt(e, 16); }
}
const fonts: Object =
{
"A": $("0000000000386CC6C6FEC6C6000000"), "B": $("0000000000FCC6C6FCC6C6FC000000"), "C": $("00000000003C66C0C0C0663C000000"),
"D": $("0000000000F8CCC6C6C6CCF8000000"), "E": $("00000000007E60607C60607E000000"), "F": $("0000000000FEC0C0FCC0C0C0000000"),
"G": $("00000000003E60C0CEC6663E000000"), "H": $("0000000000C6C6C6FEC6C6C6000000"), "I": $("00000000007E18181818187E000000"),
"J": $("00000000000606060606C67C000000"), "K": $("0000000000C6CCD8F0F8DCCE000000"), "L": $("00000000006060606060607E000000"),
"M": $("0000000000C6EEFEFED6C6C6000000"), "N": $("0000000000C6E6F6FEDECEC6000000"), "O": $("00000000007CC6C6C6C6C67C000000"),
"P": $("0000000000FCC6C6C6FCC0C0000000"), "Q": $("00000000007CC6C6C6DECC7A000000"), "R": $("0000000000FCC6C6CEF8DCCE000000"),
"S": $("000000000078CCC07C06C67C000000"), "T": $("00000000007E181818181818000000"), "U": $("0000000000C6C6C6C6C6C67C000000"),
"V": $("0000000000C6C6C6EE7C3810000000"), "W": $("0000000000C6C6D6FEFEEEC6000000"), "X": $("0000000000C6EE7C387CEEC6000000"),
"Y": $("00000000006666663C181818000000"), "Z": $("0000000000FE0E1C3870E0FE000000"), "a": $("0000000000000078CCCCCC7E000000"),
"b": $("000000000060607C6666667C000000"), "c": $("000000000000003C6660663C000000"), "d": $("000000000006063E6666663E000000"),
"e": $("000000000000003C667E603E000000"), "f": $("000000000038307830303030000000"), "g": $("000000000000003C6666663E063C00"),
"h": $("000000000060607C66666666000000"), "i": $("000000000018001818181818000000"), "j": $("000000000018001818181818D87000"),
"k": $("00000000006060666C786C66000000"), "l": $("000000000018181818181818000000"), "m": $("00000000000080FCD6D6D6D6000000"),
"n": $("000000000000007C66666666000000"), "o": $("000000000000003C6666663C000000"), "p": $("000000000000007C6666667C606000"),
"q": $("000000000000003E6666663E060600"), "r": $("000000000000006E78706060000000"), "s": $("000000000000003E703C0E7C000000"),
"t": $("000000000030307830303030000000"), "u": $("00000000000000666666663E000000"), "v": $("000000000000006666663C18000000"),
"w": $("00000000000000C6D6D6D66C000000"), "x": $("00000000000000663C183C66000000"), "y": $("00000000000000666666663E063C00"),
"z": $("000000000000007E1C38707E000000"), "0": $("0000000000384CC6C6C66438000000"), "1": $("00000000001838781818187E000000"),
"2": $("00000000007CC60E3C78E0FE000000"), "3": $("00000000007E0C183C06C67C000000"), "4": $("00000000001C3C6CCCFE0C0C000000"),
"5": $("0000000000FCC0FC0606C67C000000"), "6": $("00000000003C60C0FCC6C67C000000"), "7": $("0000000000FEC60C18303030000000"),
"8": $("000000000078C4E4789E867C000000"), "9": $("00000000007CC6C67E060C78000000"), "!": $("000000000018181818180018000000"),
"\"":$("00000000006C6C2400000000000000"), "#": $("00000000006CFE6C6C6CFE6C000000"), "$": $("00000000007CD6D07C16D67C000000"),
"%": $("0000000000E4ACB8FE3A6A4E000000"), "&": $("0000000000386C6CFECCCE7A000000"), "'": $("000000000060602000000000000000"),
"(": $("00000000000C18181818180C000000"), ")": $("0000000000180C0C0C0C0C18000000"), "=": $("000000000000FE0000FE0000000000"),
"~": $("00000000000060F29E0C0000000000"), "|": $("000000000018181818181818000000"), "-": $("00000000000000FE00000000000000"),
"^": $("0000000010386C0000000000000000"), "`": $("000000000060703818000000000000"), "@": $("00000000007CC6F6D6F6C07E000000"),
"*": $("000000000000107C38280000000000"), "+": $("0000000000003030FC303000000000"), "_": $("0000000000000000000000FE000000"),
"?": $("00000000003C66660C180018000000"), ">": $("00000000006030180C183060000000"), "<": $("00000000000C18306030180C000000"),
",": $("000000000000000000003030100000"), ".": $("000000000000000000003030000000"), "/": $("0000000000060C183060C080000000"),
"\\":$("0000000000C06030180C0602000000"), "[": $("000000000038303030303038000000"), "]": $("000000000038181818181838000000"),
":": $("000000000000181800181800000000"), ";": $("000000000000181800181808000000"), "{": $("00000000000C18183018180C000000"),
"}": $("0000000000180C0C060C0C18000000"), "あ": $("000000000020FC207CAAB2E4000000"), "い": $("00000000000088848282A240000000"),
"う": $("000000000078007C82020418000000"), "え": $("00000000007800FC081028CE000000"), "お": $("00000000002CF2203C62A2EC000000"),
"か": $("000000000024FA262444548C000000"), "き": $("0000000000107C08FE08403E000000"), "く": $("000000000008102040201008000000"),
"け": $("000000000084BE8484848458000000"), "こ": $("00000000007804000000827C000000"), "さ": $("000000000010FE08048C807C000000"),
"し": $("000000000080808082824438000000"), "す": $("000000000004FE3C443C0418000000"), "せ": $("000000000044FE444440403C000000"),
"そ": $("00000000007C08FE1820201C000000"), "た": $("000000000040FC405E80A09E000000"), "ち": $("000000000020FE203C42023C000000"),
"つ": $("000000000000FC0202020438000000"), "て": $("0000000000FE08102020201C000000"), "と": $("00000000004026382040403E000000"),
"な": $("000000000040F64288384C32000000"), "に": $("0000000000409E80808090CE000000"), "ぬ": $("0000000000487CCAAAB6BA66000000"),
"ね": $("000000000040EC5262CED24E000000"), "の": $("0000000000003C5292929264000000"), "は": $("000000000004BE84849CA65A000000"),
"ひ": $("000000000030E02C46444438000000"), "ふ": $("0000000000380810544A8AB6000000"), "へ": $("000000000000205088840200000000"),
"ほ": $("0000000000BE84BE849CA6DA000000"), "ま": $("000000000010FC10FC7098E4000000"), "み": $("0000000000E024247EA4A448000000"),
"む": $("000000000020F42262A0A27C000000"), "め": $("0000000000487C4ACAB2A254000000"), "も": $("0000000000107C20FC20221C000000"),
"や": $("0000000000485C62A2241010000000"), "ゐ": $("000000000070103C52929666000000"), "ゆ": $("000000000050BCCA8AAA9C50000000"),
"ゑ": $("000000000038107C04387CAA000000"), "よ": $("0000000000101C1010789462000000"), "ら": $("00000000001804205C62421C000000"),
"り": $("000000000044424252220408000000"), "る": $("000000000078103C42823A3C000000"), "れ": $("000000000020EE322262A426000000"),
"ろ": $("000000000078103C4282021C000000"), "わ": $("000000000040DC6242C24244000000"), "を": $("0000000000107C305E28403C000000"),
"ん": $("000000000010202070488A84000000"), "ぁ": $("00000000000020782074A8F4000000"), "ぃ": $("00000000000000888484A440000000"),
"ぅ": $("0000000000007000F8080870000000"), "ぇ": $("0000000000007000F81070DC000000"), "ぉ": $("00000000000028F42078A4CC000000"),
"っ": $("0000000000000038C4040438000000"), "ゃ": $("0000000000004878C4442820000000"), "ゅ": $("00000000000010B8D4949C30000000"),
"ょ": $("000000000000101C10709874000000"), "ゎ": $("00000000000040D86444C448000000"), "が": $("000000050524FA262444548C000000"),
"ぎ": $("0000000505107C08FE08403E000000"), "ぐ": $("000000050508102040201008000000"), "げ": $("000000050584BE8484848458000000"),
"ご": $("00000005057804000000827C000000"), "ざ": $("000000050510FE08048C807C000000"), "じ": $("000000050580808082824438000000"),
"ず": $("000000050504FE3C443C0418000000"), "ぜ": $("000000050544FE444440403C000000"), "ぞ": $("00000005057C08FE1820201C000000"),
"だ": $("000000050540FC405E80A09E000000"), "ぢ": $("000000050520FE203C42023C000000"), "づ": $("000000050500FC0202020438000000"),
"で": $("0000000505FE08102020201C000000"), "ど": $("00000005054026382040403E000000"), "ば": $("000000050504BE84849CA65A000000"),
"び": $("000000050530E02C46444438000000"), "ぶ": $("0000000505380810544A8AB6000000"), "べ": $("0000000505002070D88C0602000000"),
"ぼ": $("0000000505BE84BE849CA6DA000000"), "ぱ": $("000002050204BE84849CA65A000000"), "ぴ": $("000002050230E02C46444438000000"),
"ぷ": $("0000020502380810544A8AB6000000"), "ぺ": $("000000040A04205088840200000000"), "ぽ": $("0000020502BE84BE849CA6DA000000"),
"ア": $("0000000000FE021214102040000000"), "イ": $("0000000000020418E8080808000000"), "ウ": $("000000000010FE8282020438000000"),
"エ": $("000000000000FE10101010FE000000"), "オ": $("000000000004FE040C1424C4000000"), "カ": $("000000000020FE222242428C000000"),
"キ": $("000000000020FE1010FE0808000000"), "ク": $("0000000000203E4282020438000000"), "ケ": $("0000000000407E4484040830000000"),
"コ": $("000000000000FE02020202FE000000"), "サ": $("000000000044FE4444040830000000"), "シ": $("0000000000C020C222040870000000"),
"ス": $("0000000000FE0204081422C2000000"), "セ": $("000000000040FE424440403E000000"), "ソ": $("000000000082424202040830000000"),
"タ": $("00000000003E22629A060438000000"), "チ": $("00000000000C7010FE101020000000"), "ツ": $("000000000052525202020438000000"),
"テ": $("00000000007C00FE10101020000000"), "ト": $("0000000000404040704C4040000000"), "ナ": $("000000000008FE0808101020000000"),
"ニ": $("0000000000007C00000000FE000000"), "ヌ": $("0000000000FE0202340C0A70000000"), "ネ": $("000000000010FE020438D610000000"),
"ノ": $("0000000000020202040418E0000000"), "ハ": $("000000000048444442424282000000"), "ヒ": $("00000000004046784040403E000000"),
"フ": $("0000000000FE020202020438000000"), "ヘ": $("000000000000205088840200000000"), "ホ": $("000000000010FE1054549292000000"),
"、": $("000000000000000000804020000000"), "。": $("000000000000000060909060000000"), "マ": $("0000000000FE020204281008000000"),
"ミ": $("0000000000700C601800E01C000000"), "ム": $("000000000010202044448EF2000000"), "メ": $("0000000000024222140814E2000000"),
"モ": $("00000000007C2020FE20201C000000"), "ヤ": $("000000000040FE4224201010000000"), "ヰ": $("000000000008087848FE0808000000"),
"ユ": $("0000000000007808080808FE000000"), "ヱ": $("0000000000FC0414181010FE000000"), "ヨ": $("0000000000FC0404FC0404FC000000"),
"ラ": $("00000000007C00FE02020478000000"), "リ": $("000000000042424242020438000000"), "ル": $("000000000010505050525498000000"),
"レ": $("0000000000808080808488F0000000"), "ロ": $("0000000000FE8282828282FE000000"), "ワ": $("0000000000FE828202020438000000"),
"ヲ": $("0000000000FE02023E020478000000"), "ン": $("0000000000C0320202020CF0000000"), "ァ": $("000000000000F80828302040000000"),
"ィ": $("0000000000000810E0202020000000"), "ゥ": $("00000000000020F888081020000000"), "ェ": $("00000000000000F8202020F8000000"),
"ォ": $("00000000000010F810305090000000"), "ッ": $("00000000000000A8A8081060000000"), "ャ": $("00000000000040F848482020000000"),
"ュ": $("0000000000000070101010F8000000"), "ョ": $("00000000000000F8087808F8000000"), "ヮ": $("00000000000000F888081060000000"),
"ガ": $("000000050520FE222242428C000000"), "ギ": $("000000050520FE1010FE0808000000"), "グ": $("0000000505203E4282020438000000"),
"ゲ": $("0000000505407E4484040830000000"), "ゴ": $("000000050500FE02020202FE000000"), "ザ": $("000000050544FE4444040830000000"),
"ジ": $("0000000505C020C222040870000000"), "ズ": $("0000000505FE0204081422C2000000"), "ゼ": $("000000050540FE424440403E000000"),
"ゾ": $("000000050580424202040830000000"), "ダ": $("00000005053E22629A060438000000"), "ヂ": $("00000005050C7010FE101020000000"),
"ヅ": $("000000050550525202020438000000"), "デ": $("00000005057C00FE10101020000000"), "ド": $("0000000A0A404040704C4040000000"),
"バ": $("000000050548444442424282000000"), "ビ": $("00000005054046784040403E000000"), "ブ": $("0000000505FE020202020438000000"),
"ベ": $("000000000A0A205088840200000000"), "ボ": $("000000050510FE1054549292000000"), "パ": $("000002050248444442424282000000"),
"ピ": $("00000205024046784040403E000000"), "プ": $("0000020502FE020202020438000000"), "ペ": $("000000040A04205088840200000000"),
"ポ": $("000002050210FE1054549292000000"), " ": $("000000000000000000000000000000"), " ": $("000000000000000000000000000000"),
"「": $("0000001E1E18181818000000000000"), "」": $("000000000000181818187878000000"), "★": $("000000001038FE7C386CC600000000"),
"●": $("00000000387CFEFEFE7C3800000000"), "○": $("000000003844828282443800000000"), "◎": $("000000003844BAAABA443800000000"),
"■": $("00000000007C7C7C7C7C0000000000"), "□": $("00000000007C4444447C0000000000"), "◆": $("000000000010387C38100000000000"),
"◇": $("000000000010284428100000000000"), "▲": $("000000001038387C7CFE0000000000"), "△": $("000000001028284444FE0000000000"),
"▼": $("0000000000FE7C7C38381000000000"), "▽": $("0000000000FE444428281000000000"), "×": $("000000000044281028440000000000"),
"ω": $("0000000000004492926C0000000000"), "Д": $("000000003848484878840000000000"), "※": $("000000009244289228449200000000"),
"←": $("00000000002040FE40200000000000"), "↑": $("000000001038541010101000000000"), "↓": $("000000001010101054381000000000"),
"→": $("00000000001008FC08100000000000"), "♀": $("0000003844444438107C1010000000"), "♂": $("000000001E060A7290906000000000"),
"♪": $("00000000101814141070F060000000"), "ゝ": $("00000000002020100C300000000000"), "ゞ": $("000000041248402018600000000000"),
"ヽ": $("000000000020100804040000000000"), "ヾ": $("000000041248201008080000000000"), "㊥": $("0000007CFEFE9292EE7C5400000000"), // ドクロ
"㊤": $("00000000006CFEFE7C381010000000"), "㊦": $("0000001082387C7C7C388210000000"), "㊧": $("00000000041C7CFC7C1C0400000000"), // ハート、太陽、<|
"㊨": $("0000000040707C7E7C704000000000"), "£": $("00000000F08085E58285F500000000"), "ー": $("000000000000403E00000000000000"), // |>、Ex、ー
"│": $("181818181818181818181818181818"), "┃": $("3C3C3C3C3C3C3C3C3C3C3C3C3C3C3C"), "┤": $("181818181818F8F818181818181818"),
"┥": $("1818181818F8F000F0F81818181818"), "┨": $("3C3C3C3C3C3CFCFC3C3C3C3C3C3C3C"), "┫": $("3C3C3C3C3CFCEC0CECFC3C3C3C3C3C"),
"├": $("1818181818181F1F18181818181818"), "┝": $("18181818181F0F000F1F1818181818"), "┠": $("3C3C3C3C3C3C3F3F3C3C3C3C3C3C3C"),
"┣": $("3C3C3C3C3C3F3730373F3C3C3C3C3C"), "┌": $("0000000000000F1F18181818181818"), "┐": $("000000000000F0F818181818181818"),
"┘": $("181818181818F8F000000000000000"), "└": $("1818181818181F0F00000000000000"), "─": $("000000000000FFFF00000000000000"),
"━": $("0000000000FFFF00FFFF0000000000"), "┬": $("000000000000FFFF18181818181818"), "┰": $("000000000000E7FF3C3C3C3C3C3C3C"),
"┯": $("0000000000FFFF00FFFF1818181818"), "┳": $("0000000000FFFF00E7FF3C3C3C3C3C"), "┴": $("181818181818FFFF00000000000000"),
"┸": $("3C3C3C3C3C3CFFE700000000000000"), "┻": $("3C3C3C3C3CFFE700FFFF0000000000"), "┷": $("1818181818FFFF00FFFF0000000000"),
"┼": $("181818181818FFFF18181818181818"), "╋": $("3C3C3C3C3CFFE700E7FF3C3C3C3C3C"), "┿": $("1818181818FFFF00FFFF1818181818"),
"╂": $("3C3C3C3C3C3CE7E73C3C3C3C3C3C3C"),
"A": $("0000000000386CC6C6FEC6C6000000"), "B": $("0000000000FCC6C6FCC6C6FC000000"), "C": $("00000000003C66C0C0C0663C000000"),
"D": $("0000000000F8CCC6C6C6CCF8000000"), "E": $("00000000007E60607C60607E000000"), "F": $("0000000000FEC0C0FCC0C0C0000000"),
"G": $("00000000003E60C0CEC6663E000000"), "H": $("0000000000C6C6C6FEC6C6C6000000"), "I": $("00000000007E18181818187E000000"),
"J": $("00000000000606060606C67C000000"), "K": $("0000000000C6CCD8F0F8DCCE000000"), "L": $("00000000006060606060607E000000"),
"M": $("0000000000C6EEFEFED6C6C6000000"), "N": $("0000000000C6E6F6FEDECEC6000000"), "O": $("00000000007CC6C6C6C6C67C000000"),
"P": $("0000000000FCC6C6C6FCC0C0000000"), "Q": $("00000000007CC6C6C6DECC7A000000"), "R": $("0000000000FCC6C6CEF8DCCE000000"),
"S": $("000000000078CCC07C06C67C000000"), "T": $("00000000007E181818181818000000"), "U": $("0000000000C6C6C6C6C6C67C000000"),
"V": $("0000000000C6C6C6EE7C3810000000"), "W": $("0000000000C6C6D6FEFEEEC6000000"), "X": $("0000000000C6EE7C387CEEC6000000"),
"Y": $("00000000006666663C181818000000"), "Z": $("0000000000FE0E1C3870E0FE000000"), "a": $("0000000000000078CCCCCC7E000000"),
"b": $("000000000060607C6666667C000000"), "c": $("000000000000003C6660663C000000"), "d": $("000000000006063E6666663E000000"),
"e": $("000000000000003C667E603E000000"), "f": $("000000000038307830303030000000"), "g": $("000000000000003C6666663E063C00"),
"h": $("000000000060607C66666666000000"), "i": $("000000000018001818181818000000"), "j": $("000000000018001818181818D87000"),
"k": $("00000000006060666C786C66000000"), "l": $("000000000018181818181818000000"), "m": $("00000000000080FCD6D6D6D6000000"),
"n": $("000000000000007C66666666000000"), "o": $("000000000000003C6666663C000000"), "p": $("000000000000007C6666667C606000"),
"q": $("000000000000003E6666663E060600"), "r": $("000000000000006E78706060000000"), "s": $("000000000000003E703C0E7C000000"),
"t": $("000000000030307830303030000000"), "u": $("00000000000000666666663E000000"), "v": $("000000000000006666663C18000000"),
"w": $("00000000000000C6D6D6D66C000000"), "x": $("00000000000000663C183C66000000"), "y": $("00000000000000666666663E063C00"),
"z": $("000000000000007E1C38707E000000"), "0": $("0000000000384CC6C6C66438000000"), "1": $("00000000001838781818187E000000"),
"2": $("00000000007CC60E3C78E0FE000000"), "3": $("00000000007E0C183C06C67C000000"), "4": $("00000000001C3C6CCCFE0C0C000000"),
"5": $("0000000000FCC0FC0606C67C000000"), "6": $("00000000003C60C0FCC6C67C000000"), "7": $("0000000000FEC60C18303030000000"),
"8": $("000000000078C4E4789E867C000000"), "9": $("00000000007CC6C67E060C78000000"), "!": $("000000000018181818180018000000"),
"”": $("00000000006C6C2400000000000000"), "#": $("00000000006CFE6C6C6CFE6C000000"), "$": $("00000000007CD6D07C16D67C000000"),
"%": $("0000000000E4ACB8FE3A6A4E000000"), "&": $("0000000000386C6CFECCCE7A000000"), "’": $("000000000060602000000000000000"),
"(": $("00000000000C18181818180C000000"), ")": $("0000000000180C0C0C0C0C18000000"), "=": $("000000000000FE0000FE0000000000"),
"~": $("00000000000060F29E0C0000000000"), "|": $("000000000018181818181818000000"), "-": $("00000000000000FE00000000000000"),
"^": $("0000000010386C0000000000000000"), "‘": $("000000000060703818000000000000"), "@": $("00000000007CC6F6D6F6C07E000000"),
"*": $("000000000000107C38280000000000"), "+": $("0000000000003030FC303000000000"), "_": $("0000000000000000000000FE000000"),
"?": $("00000000003C66660C180018000000"), ">": $("00000000006030180C183060000000"), "<": $("00000000000C18306030180C000000"),
",": $("000000000000000000003030100000"), ".": $("000000000000000000003030000000"), "/": $("0000000000060C183060C080000000"),
"¥": $("0000000000C06030180C0602000000"), "[": $("000000000038303030303038000000"), "]": $("000000000038181818181838000000"),
":": $("000000000000181800181800000000"), ";": $("000000000000181800181808000000"), "{": $("00000000000C18183018180C000000"),
"}": $("0000000000180C0C060C0C18000000"),
"ng": $("00FEC6AA92AAC6FE00000000000000"), "return": $(null)
}
function $(data: String): FontData { return new FontData(data); }