view webGL/src/f4notes.js @ 7:c5455ae6cd70 draft

8th,change a way of update to notes,support ogg and wav sound
author e105711 <yomitan.ie.u-ryukyu.ac.jp>
date Sat, 05 May 2012 23:57:18 +0900
parents a730b51d59eb
children 040c922bd7ff
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;
	
	if(note.getLane()%2!=0){
	    PutSpriteF(ctx,58.984375+(note.getLane()-1)*11.71875,note.getLocate(),1,imgs[4]);
	}
	else{
	    PutSpriteF(ctx,58.984375+(note.getLane()-1)*11.71875,note.getLocate(),1,imgs[5]);
	}
    }
}

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

function loadNotes(){

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

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

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

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

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

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

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

    notesArray.push(new Note(14.0,4,testBPM));
    notesArray.push(new Note(15.0,4,testBPM));
    notesArray.push(new Note(15.375,4,testBPM));
    notesArray.push(new Note(15.75,4,testBPM));
    notesArray.push(new Note(15.0,2,testBPM));
    notesArray.push(new Note(15.375,2,testBPM));
    notesArray.push(new Note(15.75,2,testBPM));

    notesArray.push(new Note(16.0,4,testBPM));
    notesArray.push(new Note(16.0,6,testBPM));
}