view webGL/src/f4notes.js @ 8:040c922bd7ff draft

keyChar -> keyCode,add sounds
author e105711 <yomitan.ie.u-ryukyu.ac.jp>
date Mon, 14 May 2012 16:19:40 +0900
parents c5455ae6cd70
children 52045eb7a220
line wrap: on
line source

testBPM = 120;

function drawNote(ctx){
    for(i=0;i<notesArray.length;i++){
	var note = notesArray[i];
	if(note.getLocate()<0) //note isn't in the screen.
	    return;
	
	PutSpriteF(ctx,58.984375+(note.getLane()-1)*11.71875,note.getLocate(),1,imgs[5-(note.getLane()%2)]);

    }
}

function updNote(){
    for(i=0;i<notesArray.length;i++){
	var note = notesArray[i];
	note.updLocate(testBPM,1.0);
	if(note.getLocate() >= 105 && note.isAlive() && AUTO){//105:line's locate
	    note.autoSound();
	    note.kill();
	    notesArray.splice(i,1);
	}
    }
}

function loadNotes(){

    notesArray.push(new Note(0.0,3,testBPM));
    notesArray.push(new Note(1.75,3,testBPM));

    notesArray.push(new Note(2.0,3,testBPM));
    notesArray.push(new Note(3.75,3,testBPM));

    notesArray.push(new Note(4.0,3,testBPM));
    notesArray.push(new Note(4.25,3,testBPM));
    notesArray.push(new Note(5.625,3,testBPM));
    notesArray.push(new Note(5.875,3,testBPM));

    notesArray.push(new Note(6.0,3,testBPM));
    notesArray.push(new Note(7.0,3,testBPM));
    notesArray.push(new Note(7.375,3,testBPM));
    notesArray.push(new Note(7.75,3,testBPM));

    notesArray.push(new Note(8.0,3,testBPM));
    notesArray.push(new Note(9.75,3,testBPM));

    notesArray.push(new Note(10.0,3,testBPM));
    notesArray.push(new Note(11.75,3,testBPM));

    notesArray.push(new Note(12.0,3,testBPM));
    notesArray.push(new Note(12.25,3,testBPM));
    notesArray.push(new Note(13.625,3,testBPM));
    notesArray.push(new Note(13.875,3,testBPM));

    notesArray.push(new Note(14.0,3,testBPM));
    notesArray.push(new Note(15.0,3,testBPM));
    notesArray.push(new Note(15.375,3,testBPM));
    notesArray.push(new Note(15.75,3,testBPM));
    notesArray.push(new Note(15.0,1,testBPM));
    notesArray.push(new Note(15.375,1,testBPM));
    notesArray.push(new Note(15.75,1,testBPM));

    notesArray.push(new Note(16.0,3,testBPM));
    notesArray.push(new Note(16.0,8,testBPM));
}