class IntBall2D extends IntObj2D { float r; //ボールの半径 boolean is_over; //カーソルが当たっているか AudioChannel[] channel; IntBall2D (IntEnv2D env, float in_x, float in_y, float in_r, color in_col){ super(env, in_x, in_y, pow(in_r, 3), true, in_col, false, 0, env.TYPE_BALL); r = in_r; is_over = false; conf_rate = 0.9; fric_rate = fric_rate_org = 50; stop_vel = 1; channel = new AudioChannel[2]; float tone = map(r, 5, 35, 10, -10); RateShift myrate = new RateShift( Ess.calcShift(tone) ); for(int i=0; i<2; i++){ channel[i] = new AudioChannel("pon1.wav"); channel[i].softClip = true; myrate.filter(channel[i]); } } boolean over(float mx, float my){ if( dist(x, y, mx, my) <= r ) is_over = true; else is_over = false; return is_over; } void disp(){ //ボールを描く if( strk ) stroke(col_strk); else noStroke(); if( fil ) fill(col_fill); else noFill(); ellipse(x, y, r*2, r*2); } void play(float eng){ for( int i=0; i<2; i++){ if(channel[i].state == Ess.STOPPED){ float clip = 600*600; channel[i].volume( constrain( eng, 0, clip) / clip ); channel[i].play(); break; } } } }