view webGL/src/Note.js @ 2:55702e139f69 draft

3rd,show Notes and set Timing, but it is not completely.
author e105711 <yomitan.ie.u-ryukyu.ac.jp>
date Thu, 03 May 2012 00:52:06 +0900
parents
children a22ff379000f
line wrap: on
line source

var Note = function(time,lane,BPM){

    this.time = time;
    this.lane = lane;

    this.locate = - (time*BPM/(Interval*0.1));
    this.alive = true;
};

Note.prototype.getTime = function(){
    return this.time;
};

Note.prototype.getLane = function(){
    return this.lane;
};

Note.prototype.getLocate = function(){
    return this.locate;
};

Note.prototype.updLocate = function(BPM,sp){
    //sp:HI-SPEED,BPM:Music's BPM
    console.log(this.locate);
    this.locate += BPM*0.01*sp;
};

Note.prototype.isAlive = function(){
    return this.alive;
};

Note.prototype.kill = function(){
    this.alive = false;
    switch(this.lane){
    case 1:
	break;
    case 2:
	if(HCloseCnt%2==0){
	    audioStop(audioHClose2);
	    audioHClose.play();
	}
	else{
	    audioStop(audioHClose);
	    audioHClose2.play();
	}
	HCloseCnt++;
	break;
    case 3:
	if(SnareCnt%2==0){
	    audioStop(audioSnare2);
	    audioSnare.play();
	}
	else{
	    audioStop(audioSnare);
	    audioSnare2.play();
	}
	SnareCnt++;
	break;
    case 4:
	if(KickCnt%2==0){
	    audioStop(audioKick2);
	    audioKick.play();
	}
	else{
	    audioStop(audioKick);
	    audioKick2.play();
	}
	KickCnt++;
	break;
    case 5:
	break;
    case 6:
	break;
    case 7:
	break;
    case 8:
	break;
    }
};