前提・実現したいこと
eyeオブジェクトを作り、マウスの方向に黒目が向くプログラムを作成しています。数式を用いてプログラムしています。displayの中でfloat型の"l"(エル)を宣言したのですが読み取れてないみたいです。
発生している問題・エラーメッセージ
ローカル関数"l"(エル)の値は使われていません。
該当のソースコード
processing
1Eye eye; 2 3void setup(){ 4 size(200,200); 5 eye=new Eye(100,100,50,20); 6} 7 8void draw(){ 9 background(255); 10 eye.display(); 11} 12 13class Eye{//classname 14 int x;//feild 15 int y; 16 int w;//white width 17 int b;//black width 18 Eye(int tempX,int tempY,int tempW,int tempB){ 19 x=tempX; 20 y=tempY; 21 w=tempW; 22 b=tempB; 23 } 24 void display(){ 25 fill(255);//white 26 ellipse(x,y,w,w); 27 int dx; 28 int dy; 29 dx=mouseX-x; 30 dy=mouseY-y; 31 float l; 32 l=sqrt(sq(dx)+sq(dy));//sqrt=rute2 sq=^2 33 float ex; 34 float ey; 35 ex=x+((w-b)*dx)/2l; 36 ey=y+((w-b)*dy)/2l; 37 fill(0);//black 38 ellipse(ex,ey,b,b); 39 } 40} 41 42 43 44
試したこと
"l"を別の文字にした。
補足情報(FW/ツールのバージョンなど)
Windows
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/12 22:25