DIR : /home/kozerus/public_html/jkwii/js/jsdoit/index.js

/home/kozerus/public_html/jkwii/js/jsdoit

var WIDTH = 500;
    var HEIGHT = 500;
	var score=0;
	var hits=0;
	var life=75;
	var f_b=[false,false,false,false];
	var time=0;	
	var etime=0;
	var combo=0;
	var maxCombo=0;
	var title="";
	var nodeset=[];
	var nodes=[];
	var hiteff=[0,0,0,0];
	var musicnum=0;
	var k=0;
	var musicnumMax=3;
	var nanido=0;
	var ftime=0;
	var atime=0;
	var ahantei=0;
	var list=[];
	var nlist=[];
	var elist=[];
	var hlist=[];
	var mSrc="";
	var starttime=new Date();
	var yetstart=5;
	var hightScore=new Array((musicnumMax+1)*3);
	var clearFlag=new Array((musicnumMax+1)*3);
	var lankSet=new Array((musicnumMax+1)*3);
	var mgcg=[0,0,0,0];
	var tmp=getCooke();
	var img=new Image();
	img.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/cleared.png";
	var great=new Image();
	great.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/great.png";
	var good=new Image();
	good.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/good.png";
	var cool=new Image();
	cool.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/cool.png";
	var miss=new Image();
	miss.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/miss.png";
	var combodraw=new Image();
	combodraw.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/combo.png";
	var da=new Image();
	da.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/a.png";
	var db=new Image();
	db.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/b.png";
	var dc=new Image();
	dc.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/c.png";
	var dd=new Image();
	dd.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/d.png";
	var de=new Image();
	de.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/e.png";
	var df=new Image();
	df.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/f.png";
		var top = new Image();
	top.src="http://www.u.tsukuba.ac.jp/~s0911654/html5/start.png";
	var num=new Array(10);
	for (var i=0; i < num.length; i++) {
	num[i]=new Image;
	num[i].src="http://www.u.tsukuba.ac.jp/~s0911654/html5/num"+String(i)+".png";
	}
	if (tmp){
		var hightScore=tmp[0];
		var clearFlag=tmp[1];
		var lankSet=tmp[2];
	}else{
		for (var n=0;n<(musicnumMax+1)*3;n++){
			hightScore[n]=0;
			clearFlag[n]=0;
			lankSet[n]=-1;
		}
	}
/////////////////////////////////////////クッキーによるフラグ立て
function setCooke(hightScore,clearFlag,lankSet){
	var exp=new Date();
	exp.setTime(exp.getTime()+1000*60*60*24*20);
	var setScore=hightScore.join();//0曲目の簡単、普通、難、一曲目の簡単...
	var setFlag=clearFlag.join();//0曲目の簡単、普通、難、一曲目の簡単... クリア=1、ノットクリア=0
	var setLank=lankSet.join();
	document.cookie="score=" +escape(setScore)+"%00"+ escape(setFlag)+"%00"+escape(setLank)+";expires=" + exp.toGMTString();
	
}
function getCooke(){
	var tmp1=document.cookie.split(";");
	if (tmp1[1]==null)return 0;
	var tmp2=tmp1[0].split("=");
	var tmp3=tmp2[1].split("%00");
	if (tmp2[0] != "score"){
		return 0;
	}
	var score=unescape(tmp3[0]).split(",");
	var flag=unescape(tmp3[1]).split(",");
	var lank=unescape(tmp3[2]).split(",");
	
	return [score,flag,lank];
}
/////////////////////////////////////////ゲーム本体
window.onload = function ()
{
	var canvas = document.getElementById("field");
	var ctx = canvas.getContext("2d");
/////////////////////////////////////////オブジェクト関係
	var Node = function ()
	{
		var rand=Math.floor(Math.random()*4+1);
		var createTime= new Date();
		this.x = 48*rand;
		this.y = 520;
		this.tim=0;
		this.now= function (c){
			var nowTime=new Date();
			this.tim=(nowTime.getTime()-c);
		}
		this.move = function ()
		{
			this.now(createTime.getTime());
			this.y = 520*(1-this.tim/3500);
			if (36 > this.y){
				ahantei=0;
				atime=1;
				life -=3;
				mgcg[0]++;
				combo =0;
				if (life<0) life=0;
				 return false;
				}
			
			return true;
		}
		this.num= rand;
		this.draw = function (ctx)
		{
		yajirusi(this.x,this.y,ctx,this.num,0)
		}
	}

	var moveObjs = function (objs)
	{
		for (var n = 0; n < objs.length; n++)
		{
			if (!objs[n].move())
			{
				objs.splice(n, 1);
				n--;
			}
		}
	}
	var move = function ()
	{
		moveObjs(nodes);
	}

	var drawObjs = function (objs, ctx)
	{
		for (var n = 0; n < objs.length; n++)
		{
			objs[n].draw(ctx,4);
		}
	}
//描写
	var draw = function (ctx)
	{
		ctx.beginPath();
		ctx.clearRect(0, 0, WIDTH, HEIGHT);
		field();
		drawObjs(nodes, ctx);
		lifeDraw();
		ataridraw();
		for (var i=0;i<4;i++){	
			if (hiteff[i])hiteffect(i);
			}
	}
////////////////////////////////////////////操作関係
//マウスタッチダウン使えないので消去
//キー入力
	document.onkeydown = function(e) {
		var code = e.keyCode;
	if (yetstart==5){
		yetstart=0;
		musiclist(0);
		select();
	}else{
		if(code==39){
			if (yetstart==0){
				if (musicnum==musicnumMax){
					musicnum=0;
				}else{
					musicnum+=1;
				}
				musiclist(musicnum);
				select();	
			}else if (yetstart==1){
		 		atari(4);
				f_b[3]=true;
			}else if (yetstart>=2){
				
			}
		}
		if (code==38){
			if (yetstart==0){
				if (nanido==2){
					nanido=0;
				}else{
					nanido+=1;
				}
				musiclist(musicnum);
				select();	
			}else if (yetstart==1){
				atari(2);
				f_b[1]=true;
			}else if (yetstart>=2){
				k+=1;
				clear_over(yetstart);
			}
		}
		
		if (code==37){
			if (yetstart==0){
				if (musicnum==0){
					musicnum=musicnumMax;
				}else{
					musicnum-=1;
				}
				musiclist(musicnum);
				select();	
			}else if (yetstart==1){
				atari(1);
				f_b[0]=true;
			}else if (yetstart>=2){
				
			}
		}
		if (code==40){
			if (yetstart==0){
				if (nanido==0){
					nanido=2;
				}else{
					nanido-=1;
				}
				musiclist(musicnum);
				select();	
			}else if (yetstart==1){
				atari(3);
				f_b[2]=true; 
	   		}else if (yetstart>=2){
	   			k+=1;
					clear_over(yetstart);
	   		}
	   }
	   if (code==13){
	   		if (yetstart==0){
	   			yetstart=1;
				start();
			}else if (yetstart==1){
				nodeset.push(Math.floor(document.getElementById(mSrc).currentTime*1000-3231));
			document.getElementById("pos").innerHTML=nodeset;
			}else if (yetstart>=2){
				if ((k%2)==0){
					yetstart=1;
					start();
				}else{
					yetstart=0;
					select();
				}
			}
		}
	}
	}
//離したら
	document.onkeyup = function(e) {
  		f_b=[0,0,0,0];
	}
	//////////////////////////////////////////////////個々の描写
	CanvasRenderingContext2D.prototype.roundRect = function(
  x, 
  y, 
  width, 
  height, 
  radius
){ 
  this.moveTo(x+radius,y);
  this.lineTo(x+width-radius,y);
  this.quadraticCurveTo(x+width,y,x+width,y+radius);
  this.lineTo(x+width,y+height-radius);
  this.quadraticCurveTo(x+width,y+height,x+width-radius,y+height);
  this.lineTo(x+radius,y+height);
  this.quadraticCurveTo(x,y+height,x,y+height-radius);
  this.lineTo(x,y+radius);
  this.quadraticCurveTo(x,y,x+radius,y);
};
	//矢印
	function yajirusi(x,y,ctx,i,c){
			if (i==1){
			ctx.save();
			ctx.beginPath();
			if (c==0){
			ctx.strokeStyle = "rgb(40, 250, 250)";
			}else{
				ctx.strokeStyle = "rgb(255, 255, 255)";
				ctx.fillStyle = "rgb(255, 255, 255)";
			}
			ctx.lineWidth =4;
			
			ctx.translate(x,y);
			ctx.moveTo(0, 23);
			ctx.lineTo(23,0);
			ctx.lineTo(23+5*Math.SQRT2,5*Math.SQRT2);
			ctx.lineTo(23+5*Math.SQRT2-(18-5*Math.SQRT2),18);
			ctx.lineTo(45,18);
			ctx.lineTo(45,28);
			ctx.lineTo(23+5*Math.SQRT2-(18-5*Math.SQRT2),28);
			ctx.lineTo(23+5*Math.SQRT2,45-5*Math.SQRT2);
			ctx.lineTo(23,45);
			ctx.closePath();
			if (c>2)ctx.fill();
			ctx.moveTo(30,18);
			ctx.lineTo(30-5*Math.SQRT2,23);
			ctx.lineTo(30,28);
			ctx.moveTo(40,18);
			ctx.lineTo(40-5*Math.SQRT2,23);
			ctx.lineTo(40,28);
			ctx.stroke();				
			ctx.restore();
		}else if (i==2){
			ctx.save();
			ctx.beginPath();
				if (c==0){
			ctx.strokeStyle = "rgb(250, 250, 102)";
			}else{
				ctx.strokeStyle = "rgb(255, 255, 255)";
				ctx.fillStyle = "rgb(255, 255, 255)";
			}
			ctx.lineWidth = 4
			ctx.translate(x,y);
			ctx.moveTo(23, 0);
			ctx.lineTo(0, 23);
			ctx.lineTo(5*Math.SQRT2,23+5*Math.SQRT2);
			ctx.lineTo(18,23+5*Math.SQRT2-(18-5*Math.SQRT2));
			ctx.lineTo(18,45);
			ctx.lineTo(28,45);
			ctx.lineTo(28,23+5*Math.SQRT2-(18-5*Math.SQRT2));
			ctx.lineTo(45-5*Math.SQRT2,23+5*Math.SQRT2);
			ctx.lineTo(45,23);
			ctx.closePath();
			if (c>2)ctx.fill();
			ctx.moveTo(18,30);
			ctx.lineTo(23,30-5*Math.SQRT2);
			ctx.lineTo(28,30);
			ctx.moveTo(18,40);
			ctx.lineTo(23,40-5*Math.SQRT2);
			ctx.lineTo(28,40);
			ctx.stroke();
			ctx.restore();
		}else if (i==3){
			ctx.save();
			ctx.beginPath();
			ctx.lineWidth = 4
			ctx.translate(x,y);
			ctx.moveTo(23, 45);
			ctx.lineTo(45, 23);
			ctx.lineTo(45-5*Math.SQRT2,23-5*Math.SQRT2);
			ctx.lineTo(28,23-5*Math.SQRT2+(18-5*Math.SQRT2));
			ctx.lineTo(28,0);
			ctx.lineTo(18,0);
			ctx.lineTo(18,23-5*Math.SQRT2+(18-5*Math.SQRT2));
			ctx.lineTo(0+5*Math.SQRT2,23-5*Math.SQRT2);
			ctx.lineTo(0,23);
			ctx.closePath();
			ctx.moveTo(18,15);
			ctx.lineTo(23,15+5*Math.SQRT2);
			ctx.lineTo(28,15);
			ctx.moveTo(18,5);
			ctx.lineTo(23,5+5*Math.SQRT2);
			ctx.lineTo(28,5);
			if (c==0){
			ctx.strokeStyle = "rgb(250, 95, 243)";
			}else{
				ctx.strokeStyle = "rgb(255, 255, 255)";
				ctx.fillStyle = "rgb(255, 255, 255)";
			}
			if (c<3){
			ctx.stroke();
			}else{
				ctx.fill();
			}
			ctx.restore();
		}else if (i==4){
			ctx.save();
			ctx.beginPath();
			ctx.lineWidth = 4
			ctx.translate(x,y);
			ctx.moveTo(45,23);
			ctx.lineTo( 23,45);
			ctx.lineTo(23-5*Math.SQRT2,45-5*Math.SQRT2);
			ctx.lineTo(23-5*Math.SQRT2+(18-5*Math.SQRT2),28);
			ctx.lineTo(0,28);
			ctx.lineTo(0,18);
			ctx.lineTo(23-5*Math.SQRT2+(18-5*Math.SQRT2),18);
			ctx.lineTo(23-5*Math.SQRT2,0+5*Math.SQRT2);
			ctx.lineTo(23,0);
			ctx.closePath();
			ctx.moveTo(15,18);
			ctx.lineTo(15+5*Math.SQRT2,23);
			ctx.lineTo(15,28);
			ctx.moveTo(5,18);
			ctx.lineTo(5+5*Math.SQRT2,23);
			ctx.lineTo(5,28);
			if (c==0){
			ctx.strokeStyle = "rgb(64, 255, 64)";
			}else{
				ctx.strokeStyle = "rgb(255, 255, 255)";
				ctx.fillStyle = "rgb(255, 255, 255)";
			}
			if (c<3){
			ctx.stroke();
			}else{
				ctx.fill();
			}
			ctx.restore();
		}
	}
	//背景
	function field(){
	var polarCanvas = document.getElementById("field");
	var ctx2 = polarCanvas.getContext("2d");
	ctx2.beginPath();
	ctx2.moveTo(250,0);
	ctx2.lineTo(250,500);
	ctx2.strokeStyle="#ffffff";
	ctx2.stroke();
	ctx2.font = "20px 'MS Pゴシック'";
	ctx2.fillStyle = "white";
	ctx2.fillText("MusicNo:"+String(musicnum+1),260,30);
	ctx2.font = "25px 'MS Pゴシック'";
	ctx2.fillText(title,260,65);
	ctx2.font = "20px 'MS Pゴシック'";
	ctx2.fillText("MaxCombo "+maxCombo,260,130);
	ctx.fillText("Hight Score:"+hightScore[musicnum*3+nanido],260,190);
	ctx2.fillText("Score "+score,260,220);
	drawNanido(nanido,260,84);
	//タッチボタン	
	ctx.beginPath();
  	ctx.roundRect(350,230,50,70,20);
	
  	ctx.stroke();
	if (f_b[1]) ctx.fill();
	ctx.beginPath();
  	ctx.roundRect(270,310,70,50,20);
  	ctx.stroke();
	if (f_b[0]) ctx.fill();
	ctx.beginPath();
  	ctx.roundRect(410,310,70,50,20);
  	ctx.stroke();
	if (f_b[3]) ctx.fill();
	ctx.beginPath();
  	ctx.roundRect(350,370,50,70,20);
  	ctx.stroke();
	if (f_b[2]) ctx.fill();
	//あたりライン	
			yajirusi(48,40,ctx,1,1);
			yajirusi(48*2,40,ctx,2,1);
			yajirusi(48*3,40,ctx,3,1);
			yajirusi(48*4,40,ctx,4,1);
}
function hiteffect(k){
	if ((etime>0)&&(etime<10)){
		var canvas = document.getElementById("field");
	var ctx = canvas.getContext("2d");
	
		yajirusi(48*(k+1),40,ctx,k+1,3);
		//ctx.arc(48*(k+1)+23,40+23,etime*2,0,2*Math.PI,true);
		ctx.beginPath();
		ctx.fillStyle="white";
		ctx.lineWidth=2;
		ctx.moveTo(48*(k+1)+23-25,40+23-25);//左上の頂点
		ctx.lineTo(48*(k+1)+23-8,40+23);//左のくぼみ
		ctx.lineTo(48*(k+1)+23-25,40+23+25);//左下
		ctx.lineTo(48*(k+1)+23,40+23+8);//下のくぼみ
		ctx.lineTo(48*(k+1)+23-8,40+23);//右下
		ctx.lineTo(48*(k+1)+23+25,40+23+25);
		ctx.lineTo(48*(k+1)+23+8,40+23);
		ctx.lineTo(48*(k+1)+23+25,40+23-25);
		ctx.lineTo(48*(k+1)+23,40+23-8);
		ctx.closePath();
		ctx.fill();
		etime++;
	}else{
		etime=0;
		hiteff[k]=0;
	}
}
	//ライフゲージ描写
	function lifeDraw(){
		var lifeCanvas = document.getElementById("field");
		var lifectx = lifeCanvas.getContext("2d");
		  var grad  = lifectx.createLinearGradient(0,0, 200,25);
		  	grad.addColorStop(0,'rgb(255, 80, 77)');    // 赤
  			grad.addColorStop(1,'rgb(49,31,255)'); // 緑
		lifectx.beginPath();
  		lifectx.fillStyle = grad;
		lifectx.roundRect(47,5,life*2,25,5);
		lifectx.fill();		
	}
	//clear&gameover
	function clear_over(i){
	document.getElementById(mSrc).pause();
	document.getElementById(mSrc).currentTime = 0;
	var  clearCanvas= document.getElementById("field");
	var clear = clearCanvas.getContext("2d");
	clear.beginPath();
	clear.clearRect(0, 0, WIDTH, HEIGHT);
	clear.font = "20px 'MS Pゴシック'";
	clear.fillStyle = "white";
	clear.fillText("MusicNo:"+String(musicnum+1),60,30);
	clear.fill();
	drawNanido(nanido,60,84);
	clear.beginPath();
	clear.font = "25px 'MS Pゴシック'";
	clear.fillText(title,60,65);
	clear.fill();
	clear.beginPath();
	clear.font = "20px 'MS Pゴシック'";
	clear.fillStyle = "white";
	clear.fillText("YOURE SCORE IS "+score+" !!!",100,230-80);
	clear.fillText("Great:"+mgcg[1],100,260-80);
	clear.fillText("Cool:"+mgcg[2],100,290-80);
	clear.fillText("Good:"+mgcg[3],100,320-80);
	clear.fillText("Miss:"+mgcg[0],100,350-80);
	clear.fill();
	
	clear.roundRect(50,300,400,100,20);
	clear.strokeStyle="white";
	clear.stroke();
	clear.beginPath();
	clear.fillStyle="white";
	clear.beginPath();
	if ((k%2)==0)clear.font = "30px 'MS Pゴシック'";
	clear.fillText("restart",60,340);
	clear.fill();
	clear.beginPath();
	clear.font = "20px 'MS Pゴシック'";
	if ((k%2)==1)clear.font = "30px 'MS Pゴシック'";
	clear.fillText("select music",60,370);
	clear.fill();
	lank((hits/(list.length+mgcg[0]+mgcg[1]+mgcg[2]+mgcg[3]))*100,400,10);
	if(i==3) clearFlag[musicnum*3+nanido]=1;
	if(hightScore[musicnum*3+nanido]<score) hightScore[musicnum*3+nanido]=score;
	setCooke(hightScore,clearFlag,lankSet);
	}
	//難易度表示
	function drawNanido(nanido,x,y){
		ctx.beginPath();
			if (nanido==0){
			ctx.fillText("Easy",x,y);
		}else if (nanido==1){
			ctx.fillText("Normal",x,y);
		}else if (nanido==2){
			ctx.fillText("Hard",x,y);
		}
		ctx.fill();
	}
	//lank表示
	function lank(par,x,y){
		if (par>=90){
			ctx.drawImage(da,x,y);
			}
		else if(par>=80){
			ctx.drawImage(db,x,y);
			}
		else if(par>=70){
			ctx.drawImage(dc,x,y);
			}
		else if(par>=60){
			ctx.drawImage(dd,x,y);
			}
		else if(par>=50){
			ctx.drawImage(de,x,y);
			}
		else if(par>=0){
			ctx.drawImage(df,x,y);
			} 
		if(lankSet[musicnum*3+nanido]<par)lankSet[musicnum*3+nanido]=par;
	}
	//select画面
	function select(){
		var canvas = document.getElementById("field");
		var ctx = canvas.getContext("2d");
		ctx.beginPath();
		ctx.clearRect(0, 0, WIDTH, HEIGHT);
		ctx.lineWidth=3;
  		ctx.roundRect(50,300,400,100,20);
  		ctx.strokeStyle="white";
  		ctx.stroke();
  		ctx.beginPath();
		ctx.font = "20px 'MS Pゴシック'";
		ctx.fillStyle = "white";		
		ctx.fillText("Music select",40,40);
		ctx.fillText("Music No."+String(musicnum+1),40,60);
		ctx.fillText("↑↓で難易度選択",100,330);
		ctx.fillText("←→で曲選択",100,350);
		ctx.fillText("EnterでStart!",100,370);
		ctx.font = "30px 'MS Pゴシック'";
		ctx.fillText(title,40,100);
		ctx.fill();
		ctx.beginPath();
		ctx.font = "20px 'MS Pゴシック'";
		ctx.fillText("Mode:",40,140);
		ctx.fillText("Hight Score:"+hightScore[musicnum*3+nanido],40,160);
		if (clearFlag[musicnum*3+nanido]==1){
			ctx.drawImage(img,150,100);
		}
		drawNanido(nanido,100,140);		
		lank(lankSet[musicnum*3+nanido],40,200)
	}
	/////goodとかbadとかcombotoka
	function ataridraw(){
		var canvas = document.getElementById("field");
		var ctx = canvas.getContext("2d");
		if ((atime>0)&&(atime<50)){
				ctx.beginPath();
				ctx.fillStyle="white";
				if (ahantei==0)ctx.drawImage(miss,5,270);
				if (ahantei==1)ctx.drawImage(great,5,270);
				if (ahantei==2)ctx.drawImage(cool,5,270);
				if (ahantei==3)ctx.drawImage(good,5,270);
				if (combo>0){
					var scombo=String(combo);
					for(var i=0;i<scombo.length;i++){
						ctx.drawImage(num[parseInt(scombo[scombo.length-i-1])],120-35*i,335);
					}
				
					ctx.drawImage(combodraw,150,335);
				}
				ctx.fill();				
			atime+=1;
		}else{
			atime=0;
		}
	}
	////////////////////////////////////////////////////処理関係
	function musiclist(l){
		switch (l){
			case 0://山の魔王の宮殿にて
				title="山の魔王の宮殿にて";
				elist=[628,2464,4303,5367,6267,6939,8035,8918,9892,10815,11745,12255,12712,13630,14576,15540,16520,17385,18341,19267,19759,20187,21145,22034,23057,23979,24876,25797,26756,27683,28640,29506,30526,30960,31432,32412,33370,34328,35192,36149,37084,38002,38928,39885,40820,41768,42293,42725,43627,44583,45517,46466,47392,48318,49258,49721,50216,51118,52035,52498,53085,53979,54905,55860,56756,57681,58544,59562,60034,60550,61485,62380,63283,64239,64764,66113,67071,67998,68955,69855,70841,71273,71730,72738,73663,74598,75053,75514,76439,77373,78360,79236,80192,81087,82105,83029,83985,84910,85804,86737,87261,88610,89533,90490,91435,92381,93285,93800,94261,94786,96421,97346,98372,98919,99503,100336,101076,101785,102218,102680,103851,104846,105792,107558,109800,110232,111349];
				nlist=[907,1959,2909,4734,5706,6598,7053,7501,7959,8477,8904,9370,9822,10322,10781,11238,11695,12215,12683,13135,14086,14547,15006,15437,15936,16423,16888,17336,17833,18272,18728,19153,19648,20105,20598,21542,22037,22477,22777,23008,23409,23936,24398,24884,25307,25772,26203,26451,26666,27161,27624,28096,29037,29531,29985,30448,30957,31420,31853,32747,33272,33766,34660,35155,35625,36583,37409,37687,37942,38395,39322,40247,41173,41667,42160,42623,43063,44111,44981,45198,45475,45914,46847,47803,48698,49160,49653,50146,50580,51597,52475,52938,53454,54379,55305,56210,56682,57176,57668,58139,59003,59958,60474,60945,61860,62755,63741,64296,64666,65130,65600,66515,67471,68365,68890,69352,70247,71202,72104,72628,73113,74038,74932,75888,76813,77740,78693,79650,80143,80582,81529,82484,83440,83665,83917,84362,85317,86273,87167,87629,88092,89015,89941,90905,91852,92777,93732,94625,95150,95581,96763,97721,98529,98920,99384,99823,100493,101448,102189,102682,103144,103605,104284,105218,106134,106657,107089,107551,111865];
				hlist=[-32,1301,2394,4340,5314,6135,6348,6563,6806,7012,7226,7501,8042,8256,8500,8936,9149,9418,9925,10140,10361,10628,10843,11098,11273,11552,11778,12026,12274,12482,12761,13656,13904,14097,14337,14530,14754,15010,15495,15743,15990,16454,16669,16918,17381,17630,17847,18092,18340,18526,18772,19028,19297,19522,19760,20007,20217,21180,21427,21612,21860,22075,22292,22547,23010,23249,23473,23959,24184,24436,24885,25106,25359,25584,25822,26039,26285,26726,26994,27242,27656,28642,28890,29089,29311,29534,29730,30015,30479,30695,30945,31437,31623,31869,32362,32578,32833,33102,33327,33565,33812,34274,34521,34714,35215,36155,36371,36595,36811,37058,37266,37520,38006,38254,38508,38992,39186,39456,39888,40812,41058,41275,41521,41776,42015,42262,42455,42724,43657,43903,44150,44635,44851,45068,45514,45731,45977,46439,46655,46902,47395,47610,47857,48104,48351,48597,48821,49028,49276,49508,49754,50031,50247,51149,52052,52276,52514,52978,53224,53471,53995,54866,55636,55844,56060,56307,56707,56955,57201,57448,57971,58218,58649,59554,59800,60048,60542,60756,60981,61466,61905,62343,63129,63315,63561,63785,64024,64254,64694,64994,65426,65671,66167,67060,67969,68216,68446,68956,69864,70080,70358,70850,71283,71715,71961,72185,72639,73625,74520,75453,75690,75938,76408,77332,78303,79227,79474,79713,80175,81130,81376,81624,81871,82095,82334,82580,83042,83266,83504,83997,84245,84460,84930,85815,86061,86286,86554,86771,87018,87235,87449,87696,88620,89540,89784,90024,90487,91443,91688,91904,92366,93291,93537,93784,94000,94255,94471,94702,94941,95196,96204,96428,97161,97376,98146,98484,98894,99131,99409,99873,100118,100852,101089,101807,102229,102662,102885,103154,103617,103864,104573,104788,105474,105721,106206,106645,107130,111520];
				ftime=117;
				mSrc="yamanomaou";
				break;
			case 1://jupiter
				title="木星";
				elist=[-1728,14,864,1711,2535,3473,4461,5253,6108,7781,8818,9581,10497,12192,13897,14669,15519,16406,19039,19874,21530,22420,24109,24945,26707,27637,28473,29311,30222,32054,32758,33670,34660,36266,37235,39905,41560,42478,43354,44952,45925,46705,47485,49415,50265,51948,52760,53686,55343,56230,57072,57936,60745,62449,63190,64054,64950,65911,67648,68489,69491,70415,71282,72153,73039,73811,76519,77344,79134,79896,80920,81876,83636,84531,85519,86345,87324,88111,89068,89848,91642,92630,93410,94373,95176,96049,97742,98807,99873,105278,106049,106465];
				nlist=[-739,803,1671,2523,3291,4986,5843,7727,8488,10259,10899,11535,11929,12886,13677,15269,16129,17975,18335,18741,20498,21282,23000,23923,25691,26456,26673,27361,28312,28667,29099,30050,31751,32577,33395,34313,34708,35149,37065,37861,38826,39219,39653,41072,41421,43174,44047,44838,45241,45720,46535,47509,50031,51444,51752,52402,52588,53143,53512,55248,56086,56933,57689,59509,60543,62394,62989,64000,64865,65736,67508,68303,70182,71047,71973,72868,73646,74471,75428,76323,76708,77293,78035,78900,80796,81738,83127,84453,85287,86350,87230,88928,91455,92426,93336,94183,94985,95510,95849,96710,97568,98208,98647,99743,103254,104611,105073,105445,105822,106193,106616];
				hlist=[-64,354,941,1146,1632,2027,2850,3720,4183,4602,5437,6464,7224,7637,8062,8968,9844,10215,10591,11293,11446,11940,12319,13172,14002,14413,14786,15647,16620,17602,18376,18755,19164,20115,21004,21312,21746,22178,22578,23484,23847,24342,25214,26102,26441,26904,27753,28724,29073,29475,30470,31341,32166,32964,33878,34839,35219,35634,36499,37471,38234,39191,39562,40095,41044,41506,41876,42464,42656,43236,43638,44377,45242,45674,45921,46168,47001,47924,48719,49695,50076,50437,51408,51750,52181,52812,53028,53492,53893,54818,55684,56052,56462,57286,58159,59107,59923,60478,60974,61466,61929,62761,63078,63533,64467,64860,65323,65756,66187,67122,67940,68340,68750,69744,70699,71502,72349,72718,73181,74092,75047,75879,76751,77143,77637,78502,79342,80236,81185,81555,82149,82616,82863,83080,83487,83910,84628,84849,85320,85775,86237,86431,86701,87565,87974,88367,88776,88983,89232,90231,90624,91441,91904,92321,92808,93716,94118,94488,95115,95396,95890,96337,96698,96915,97200,98110,98610,99104,100168,103837,105039,105443,105656,105842,106251,106429,106636];
				ftime=110;
				mSrc="jupiter";
				break;
			case 2://動物の謝肉祭-終曲-
				title="動物の謝肉祭-終曲-";
				elist=[3595,3804,4327,4524,4884,5522,5929,6207,6846,7055,7415,10375,10735,11385,11896,12546,13185,13870,14509,15077,15716,16320,17562,18166,20058,20697,21370,22531,23135,23820,25108,25666,26304,27593,28232,28789,29427,31343,32620,32945,33816,35070,36347,37589,38797,40120,41374,42535,43859,45101,45705,46343,47585,48828,50035,51440,51997,52601,53843,54447,55085,56339,56978,57582,58824,60066,61261,61981,62632,63828,64513,65151,66312,66916,67566,68843,70120,71374,72535,73777,75066,76308,76947,77586,78189,78828,80035,81278,81916,82566,83205,83762,85167,86293,87535,88824,90020,91378,92667,93909,95117,95755,96347,96997,97671,98275,98878,99436,100121,101328,102686,103847,105171,105693,106332,107098,108863,110105];
				nlist=[-364,2156,3595,4884,6126,7415,8216,9296,10259,10700,11374,12535,13185,13824,15066,15670,16331,17620,18224,18421,19385,20070,20708,21300,21985,22264,22903,23541,24110,24795,25434,26072,26676,27280,27883,28208,28522,28882,29126,29451,30449,31088,31691,31970,32295,32934,33572,34141,34536,34814,35383,36068,36660,36985,37264,37914,38634,39157,39482,39795,40445,41084,41688,42326,42930,43568,44172,44776,45449,46018,46610,47295,47852,48259,48503,49141,50105,51301,51986,52624,53832,54470,55109,56270,56920,57524,58835,59439,60124,60647,61285,61969,62609,63816,64455,65058,66382,66939,67555,68832,69517,70074,70678,71363,72001,72558,73162,73801,74962,76285,76924,77516,78166,78770,80012,81289,81928,82566,83182,83820,85109,86305,87593,88267,88917,90159,91355,92644,93851,94850,95453,96057,96382,97334,97984,98901,99505,100144,101351,102663,103789,104509,105148,105717,106309,107563,108236,108840,110163];
				hlist=[2632,4315,4640,4954,5557,5882,6196,6800,7125,7450,8169,8773,9412,9981,10735,11374,11978,12256,12581,13266,13905,14427,14787,15112,15716,16355,16958,17272,17597,17910,18235,18874,19199,19443,20081,20766,21405,21684,22009,22125,22334,22566,23251,23855,24493,24702,25178,25782,26339,26943,27187,27303,27628,28266,28545,28870,29230,29461,30147,30786,31076,31436,31715,32040,32353,32632,33003,33282,33595,33920,34164,34478,34768,35488,35766,36080,36370,36684,36962,37322,37972,38251,38564,39133,39493,39818,40097,40422,40782,41107,41386,41699,42303,42628,42907,43545,43917,44195,45124,45716,46401,46645,47040,47318,47609,47887,48247,48607,48851,50093,51335,51986,52624,52938,53147,53228,53866,54517,55074,55434,55550,55759,56397,56955,57640,57883,58081,58197,58847,59486,60136,60414,60728,61017,61332,62017,62620,63259,63537,63863,64501,65140,65743,66022,66347,67032,67589,67903,68228,68553,68866,69238,69551,69877,70120,70759,71038,71316,71920,72558,72884,73162,73801,75043,75403,75565,75728,75890,76053,76367,76645,77249,77887,78050,78212,78770,79699,79861,80105,80976,81185,81347,81986,82543,83228,83391,83867,84435,84795,85074,85678,86038,86316,86688,87001,87361,87686,88000,88244,88569,88882,89172,89613,89927,90171,90496,90809,91053,91378,91773,91935,92098,92377,92702,93062,93259,93375,93700,94025,94339,94466,94861,95186,95500,95825,96150,96382,97067,97427,97706,98031,98878,99192,99517,99795,100155,101398,101723,101885,102048,102919,103128,103290,103929,104486,105171,105449,105728,106332,107052,107377,107655,108178,108619,108932,109559,110198];
				ftime=115;
				mSrc="shanikusai";
				break;
			case 3://ボレロ
				title="ボレロ";
				elist=[2910,3305,3827,4234,5639,6080,6637,6997,9365,9841,10201,11606,12535,13011,13452,14416,16215,17144,17585,18038,18491,18932,19896,20813,21695,22624,23553,24516,24958,25399,25875,26838,27674,28719,29126,30043,30971,31924,32852,33746,34222,34629,35592,36475,37392,38321,39319,39807,40201,41130,42082,43011,43928,44729,45647,46575,47539,48375,48862,49338,50256,51103,52102,53030,53866,54830,55794,56630,57558,58081,58487,58963,60403,60844,61249,62133,62655,63944,64385,64861,65349,66185,66661,67148,67589,68031,69389,69877,72082,72570,73092,74822,75298,75542,77690,78120,78561,80279,80802,81289,82253,83135,83971,84935,85771,86781,87617,88499,89428,90345,91274,92237,92679,94687,95082];
				nlist=[1343,3386,4234,5151,6068,6591,6997,7554,7995,8437,8843,9807,10724,11641,12082,12488,12999,13487,13928,14404,14810,15252,16738,17179,17574,18015,18537,18944,19942,20383,20859,21707,22705,23065,23506,24470,25387,25875,26316,26757,27198,28162,29126,29485,29845,30089,31006,31970,32365,32771,33700,34222,34617,35627,36463,36985,37380,38309,39307,39749,40190,41107,41955,42918,43441,43882,44323,44799,45693,46169,46645,47086,47527,48015,48421,48897,49338,49861,50302,50790,51184,52195,53030,53472,53913,54760,55724,56235,56676,57640,58487,59010,60809,61285,61773,62168,62690,63503,64013,64455,64896,65337,66301,66707,67102,67543,67949,69354,69830,70306,72036,72558,73000,74811,75333,75774,77620,78062,78538,79420,80349,80825,81347,81835,82264,83077,83553,83994,84482,84958,85840,86688,87129,87605,88452,89416,89811,90298,91181,92144,92586,94350,94710,95105];
				hlist=[1947,2829,3827,4675,5557,6033,6637,6765,6997,7566,7717,7844,7995,8437,8646,8762,8924,9319,9841,10283,10445,10608,10770,11165,11293,11490,11652,12047,12570,13057,13255,13371,13533,13940,14056,14253,14381,14892,15298,16459,16622,16900,17144,17341,17585,17817,18026,18549,18746,18990,19872,20151,20314,20511,20790,21277,21428,21591,21788,22160,22438,22682,22926,23576,24075,24238,24365,24516,24923,25445,25840,26328,26804,27291,27697,28208,28580,29137,29497,29822,30054,30542,30739,30983,31424,31668,31865,32063,32341,32632,32794,33026,33270,33746,34187,34675,35151,35639,36080,36521,36962,37403,37845,38042,38251,38413,38808,39331,39818,40178,40654,40852,41061,41571,42059,42372,42698,42976,43220,43464,43696,44346,44869,45263,45426,45635,45786,46273,46715,47156,47597,48038,48514,48712,49002,49199,49397,49884,50360,50801,51243,51719,52566,53007,53448,54331,54818,55329,56653,56978,57175,58464,59021,59544,59904,60020,60229,60345,60867,61308,61703,62191,62632,62829,62945,63154,63549,64037,64513,64873,65116,65360,65836,66312,66800,67241,67636,67833,68123,68518,68959,69122,69319,69482,69923,70364,70805,71247,71688,72164,72408,72605,72895,73092,73534,73696,73859,74010,74451,74892,75380,75577,75821,76262,76425,76575,76738,77179,77667,77864,78189,78352,78596,79072,79234,79397,79548,79908,80395,80918,81312,81800,82241,82717,83124,83518,84006,84563,84726,84888,85086,85492,85887,86328,86769,87175,87733,88127,88615,89056,89451,89939,90136,90252,90496,90902,91262,91738,92261,92620,92864,94490,94722,94931,95082];
				ftime=102;
				mSrc="bolero";
				break;
		}
}	
//得点やらライフやら
function score_life(n,bas,scorepoint,lifepoint){
					mgcg[bas]++;
					hits+=1;
					ahantei=bas;
					combo+=1;
					atime=1;
			         	if (life<100) life +=lifepoint;
					nodes.splice(n,1);
					n--;
					
					if (maxCombo < combo){
						maxCombo=combo;
					}
					score += scorepoint*(1+Math.floor(combo/20));
					if (score>hightScore[musicnum*3+nanido])hightScore[musicnum*3+nanido]=score;
	
}
//musiclistの選択	
function init() {

	ctx.beginPath();
	ctx.drawImage(top,0,0);
}
init();
	function atari(item){
		for(var n=0;n<nodes.length;n++){
			if (nodes[n].num==item){
				if (Math.floor(nodes[n].y) ==40){
					//great
					score_life(n,1,50,2);
					hiteff[item-1]=1;
					etime=1;
					break;
				}
				else if ((Math.floor(nodes[n].y) >=38 )&&(Math.floor(nodes[n].y) <=44)){
					//cool
					score_life(n,2,30,1);
					hiteff[item-1]=1;
					etime=1;
					break;
				}
				else if ((Math.floor(nodes[n].y) >=36 )&&(Math.floor(nodes[n].y) <=50)){
					//good
					score_life(n,3,10,0);
					hiteff[item-1]=1;
					etime=1;
					break;
				}
			}
		}
	}
//ゲーム自体のstart
function start(){
	document.getElementById(mSrc).play();
	score=0;
	maxCombo=0;
	atime=0;
	combo=0;
	life=75;
	mgcg=[0,0,0,0];
	hits=0
	nodes=[];
	musiclist(musicnum);
	
	if (nanido==0){
			list=elist;
		}else if (nanido==1){
			list=nlist;
		}else if (nanido==2){
			list=hlist;
		}
	id = setInterval(function ()
		{
			if (life == 0){
				//gameover
				yetstart=2;
				clear_over(yetstart);
				clearInterval(id);
			}else{		
				if(Math.floor(document.getElementById(mSrc).currentTime)==ftime){
					//clear
					yetstart=3;
				    clear_over(yetstart);
				    clearInterval(id);
			    }else{
			    
			if(document.getElementById(mSrc).currentTime>=list[0]/1000){
			 nodes.push(new Node());
			 list.splice(0,1);
			}
			move();
			draw(ctx);
			}
			}	
		}, 1);
	}
}	
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer