たい☆すた作った


今回もソース超汚い。
テキストスプライトスゲー!ってなればいいと思うよ。

myApp = {};
myApp.quicktigame2d = require('com.googlecode.quicktigame2d');
Z=[];
S=[];
count=0;

// create gameview
myApp.gameView = myApp.quicktigame2d.createGameView();
myApp.gameView.timerType = myApp.quicktigame2d.ENGINE_TIMER_DISPLAYLINK;
myApp.gameView.screen = {width:320, height:480};
myApp.gameView.size.width = 320;
myApp.gameView.size.height = 480;
myApp.gameView.fps = 30;
myApp.scene = myApp.quicktigame2d.createScene();
myApp.gameView.pushScene(myApp.scene);
myApp.dispfps = myApp.quicktigame2d.createTextSprite({
	text:'', 
	fontSize:12, 
	fontFamily:'Mosamosa', 
	width:320, 
	height:20, 
	x:10, 
	y:10
});
myApp.dispfps.color(1, 1, 1);
myApp.scene.add(myApp.dispfps);
myApp.vconsole = [];
for(i=0;i<6;i++){ 
	myApp.vconsole[i] = myApp.quicktigame2d.createTextSprite({text:'', fontSize:20, width:320, height:480, x:0, y:0});
	myApp.scene.add(myApp.vconsole[i]);
}
myApp.vconsole[0].color(1, 1, 0.0);
myApp.vconsole[1].color(1, 1, 0.5);
myApp.vconsole[2].color(1, 1, 1.0);
myApp.vconsole[3].color(1, 1, 1.0);
myApp.vconsole[4].color(1, 1, 0.5);
myApp.vconsole[5].color(1, 1, 0.0);
myApp.vconsole[0].rotateX(80);
myApp.vconsole[1].rotateX(75);
myApp.vconsole[2].rotateX(70);
myApp.vconsole[3].rotateX(90);
myApp.vconsole[4].rotateX(85);
myApp.vconsole[5].rotateX(80);
myApp.vconsole[0].y = -30;
myApp.vconsole[1].y = -15;
myApp.vconsole[2].y =   0;
myApp.vconsole[3].y = -80;
myApp.vconsole[4].y = -65;
myApp.vconsole[5].y = -50;

myApp.gameView.addEventListener('onload', function (event) {
	myApp.gameView.start();
});
myApp.gameView.addEventListener('enterframe', function(event) {
	myApp.dispfps.text = "たい☆すた FPS:" + Math.floor(1000 / event.delta);

	count--;
	lBuf = ['', '', '', '', '', ''];
	star = [". ", " ゚", "* ", " ;", "+ ", "☆", " "];
	for(i=384;i--;){
		if (count <= 0) {
			Z[i]=(i>=16)?Z[i-16]:parseInt(Math.random()*1000)%6;
			S[i]=(i>=16)?S[i-16]:parseInt(Math.random()*1000)%7;
		}
		for(j=0;j<6;j++)lBuf[j]=((Z[i]==j)?star[S[i]]:' ')+lBuf[j];
		if(i%16==0)for(j=0;j<6;j++)lBuf[j]="\n"+lBuf[j];
	}
	for (j=0;j<6;j++) myApp.vconsole[j].text = lBuf[j];
	if (count <= 0) count = 2;
});

(function() {
	Ti.UI.setBackgroundColor('#000');
	var win = Ti.UI.createWindow({});
	win.add(myApp.gameView);
	win.open();
})();