課題

Similar documents
課題

課題

課題

情報メディア基盤ユニット用資料 (2015 年 7 月 14 日分 ) Processing 言語による情報メディア入門 はじめに オブジェクト指向入門 神奈川工科大学情報メディア学科 近のプログラミング言語では オブジェクト指向 (object 最 oriented) と呼ばれる機能を持っているも

課題

課題

2 個の円の移動サンプル 9-2 float y0,y1; // 円の中心の Y 座標 float x0,x1; // 円の中心の X 座標 float v0,v1; // 円の縦方向の移動速度 int radius; size(300,400); radius = 10; v0 = random(


もう少し数学っぽい関数もあります 関数名 abs(x) sqrt(x) sq(x) pow(x,n) exp(x) log(x) dist(x1, y1, x2, y2) constrain(v, m0, m1) lerp(v0,v1,t) map(v, low1, high1, low2, hig

スライド 1

挙動チェックポイントなどセミコロン ; を忘れていませんか? 黄色なんだか動かないで表示されている部分またはその少し前 Syntax error, maybe a missing にセミコロンを忘れている場所はありま semicolon? などと表示されます せんか? なんだか動作がおかしい の部分

Processing入門マニュアル17

課題

Processingをはじめよう


問 1 図 1 の図形を作るプログラムを作成せよ 但し ウィンドウの大きさは と し 座標の関係は図 2 に示すものとする 図 1 作成する図形 原点 (0,0) (280,0) (80,0) (180,0) (260,0) (380,0) (0,160) 図 2 座標関係 問 2

課題

r3.dvi

10K pdf

<4D F736F F D B B83578B6594BB2D834A836F815B82D082C88C60202E646F63>

Java演習(9) -- クラスとメソッド --

JavaプログラミングⅠ

r6.dvi

設問 println はそこで指定されている内容を出力して改行するものである. 一方,print は内容を出力して改行しないものである. 下記のプログラムそれぞれについて出力結果がどうなるか回答せよ. 下記のプログラム - を実行すると, fms という文字列が 回表示される. プログラム - vo

pp2018-pp4base

Java学習教材

pp2018-pp9base

tn_soturon_sjis.dvi

Processing による ポーカーゲームについて 八神孝嗣

配付資料

Microsoft PowerPoint - lec06 [互換モード]

情報システム設計論II ユーザインタフェース(1)

r3.dvi

IT プロジェクト


Processingをはじめよう

Microsoft PowerPoint P演習 第10回 関数.ppt [互換モード]

CG

K227 Java 2

情報システム設計論II ユーザインタフェース(1)

やさしいJavaプログラミング -Great Ideas for Java Programming サンプルPDF

10K

C# ++ MASA C# ( ) XNA 1.1 C# ( ) VisualStuio XNA 4.0 VisualStuio XNA 3.1 * * *3 2.1 VisualStuio Windows ( TextGam

HCI プログラミング 5 回目ウィンドウに画像を表示してみよう 今日の講義で学ぶ内容 画像の表示 画像のエフェクト 画像のビューポート指定 画像の表示 1 画像を表示してみましょう 画像の表示はクラス ImageView により管理されます ソースファイル名 :Sample5_1.java //

: : : TSTank 2

メンバ変数とインスタンス

情報システム設計論II ユーザインタフェース(1)

大容量情報検索論

I java A

JavaプログラミングⅠ

情報システム設計論II ユーザインタフェース(1)

19 3!! (+) (>) (++) (+=) for while 3.1!! (20, 20) (1)(Blocks1.java) import javax.swing.japplet; import java.awt.graphics;

Java 基礎問題ドリル ~ メソッドを理解する ~ 次のプログラムコードに 各設問の条件にあうメソッドを追加しなさい その後 そのメソッドが正しく動作することを検証するためのプログラムコードを main メソッドの中に追加しなさい public class Practice { // ここに各設問

プログラミング入門1

玉転がしタブレット端末の特徴の一つとして, センサを使った動作や, 指による画面操作がある. それらを活用して, 図形を動かすアプリの例を示す. 1. プロジェクトを作る Tama アプリケーションを作る,Tama プロジェクトを作る. 図 1 プロジェクト作成 プロジェクトの構成を設定する. 図

p5.js p5.js p5.js Tetris Tetris

第117期報告書

Java演習(4) -- 変数と型 --

Javaプログラムの実行手順

ch31.dvi

プログラミング演習 Ⅰ 第 14 回 2017/6/5( 月 ) ゲームを作る クイズ 担当 : 紅林林

アルゴリズムとデータ構造1

GUIプログラムⅣ

Microsoft PowerPoint ppt

ソフトゼミA 2015 第0回

スライド 1

年組番号名前点数 設問 設問 設問 設問 設問 設問

ALG ppt

2009 T

スライド 1

Java (7) Lesson = (1) 1 m 3 /s m 2 5 m 2 4 m 2 1 m 3 m 1 m 0.5 m 3 /ms 0.3 m 3 /ms 0.6 m 3 /ms 1 1 3

Microsoft PowerPoint - diip ppt

教材ドットコムオリジナル教材 0から始めるiアフ リ リファレンス i アプリ簡易リファレンス ver i アプリ Java 独自のメソッド (1)iアプリの命令を使えるようにする import com.nttdocomo.ui.*; (2) 乱数を使う import java.u

問 次の Fortran プログラムの説明及びプログラムを読んで、設問に答えよ。

Taro-twokansu3.jtd

明解Javaによるアルゴリズムとデータ構造

ファイルを直接編集する画面を切り替えることができる. 図 3 標準のレイアウトを削除する (2) グラフィカル レイアウト画面で LinearLayout(Vertical) を追加するパレットウィンドウの レイアウト の中にある LinearLayout(Vertical) をドラッグして, 編集

Microsoft PowerPoint Java基本技術PrintOut.ppt [互換モード]

アルゴリズムとデータ構造1

cpp4.dvi

3 4 17:00 Address: ( ) (Subject) ( ) LeapMotion EyeTribe Processing LeapMotion EyeTribe 1. Mac OS X, LeapMotion, EyeTribe, Proces

Microsoft PowerPoint ppt

piyo0702a.rtfd

8 if switch for while do while 2

r2.dvi


任意の加算プログラム

手書認識 グラフ描画 Step2-2 手書認識 : 認識結果を PaintPanel で描画する < 属性付き文字列 AttributedString> 標準出力では分かりにくいうえに認識結果を使えないので 認識するごとに PaintPanel に文字を描画することにする ここで 数式はただの文字列

r4.dvi

Microsoft PowerPoint - chap10_OOP.ppt

< F2D834F838C A815B A CC>

Prog2_12th

人工知能入門

< F2D B838A835882CC8CF68EAE2E6A7464>

Java言語 第1回

新・明解Java入門

ALG2012-A.ppt

r14.dvi

0720

Java講座

Transcription:

float xball;// 円の中心の X 座標 float yball; // 円の中心の Y 座標 float rball; // 円の半径 color cball; // 円の色 // 円を移動させる void updateball(){ yball -= 1; if(yball+rball< 0){ yball = height+rball; // 円を描く void drawball(){ stroke(cball); fill(cball); ellipse(xball,yball,2*rball,2*rball); colormode(hsb,359,99,99); // 円の初期状態の決定 rball = random(10,20); xball = random(rball,width-rball); yball = height+rball; cball =color(random(360), random(50,100), random(50,100)); background(0,0,99); updateball(); drawball(); 1 class Ball { (a) x;// 円の中心の X 座標 (b) y;// 円の中心の Y 座標 (c) r;// 円の半径 (d) c; // 円の色 (e) (){ // コンストラクタの設定 r = random(10,20); x = random(r,width-r); y = height+r; c = color(random(360), random(50,100), random(50,100)); (f) myball; // 円を移動させる void updateball(){ (g) -= 1; if( (h) + (i) < 0){ (j) = height+ (k) ; // 円を描く void drawball(){ stroke( (l) ); fill( (m) ); (n) ; colormode(hsb,359,99,99); myball = new (o) ();

background(0,0,99); updateball(); drawball(); class Ball { (a) x;// 円の中心の X 座標 (b) y;// 円の中心の Y 座標 (c) r;// 円の半径 (d) c; // 円の色 (e) (){ // コンストラクタの設定 r = random(10,20); x = random(r,width-r); y = height+r; c = color(random(360), random(50,100), random(50,100)); // 円を移動させる void update(){ (g) -= 1; if( (h) + (i) < 0){ (j) = height+ (k) ; // 円を描く stroke( (l) ); fill( (m) ); (n) ; (f) myball; colormode(hsb,359,99,99); myball = (o) ; background(0,0,99); (p).update(); (q).draw(); 2

class Ball { (a) x;// 円の中心の X 座標 (b) y;// 円の中心の Y 座標 (c) r;// 円の半径 (d) c; // 円の色 // コンストラクタの設定 (e) (float x0,float y0, float r0,color c0){ x = x0; y = y0; r = r0; c = c0; // 円を移動させる void update(){ (g) -= 1; if( (h) + (i) < 0){ (j) = height+ (k) ; // 円を描く stroke( (l) ); fill( (m) ); (n) ; 3 (f) myball; colormode(hsb,359,99,99); myball = new Ball(width/2, height, 20, color(0,99,99)); background(0,0,99); (p).update(); (q).draw(); (f) myball; colormode(hsb,359,99,99); myball = new Ball(width/2, height, 20, (z) );

background(0,0,99); (p).update(); (q).draw(); color c; int xpos; int ypos; int xspeed; size(200,200); c = color(255); xpos = width/2; ypos = height/2; xspeed = 1; void display(){ rectmode(center); stroke(c); fill(c); rect(xpos,ypos,20,10); (a) Car (b) color c; int (c) ; int (d) ; int (e) ; Car(){ // デフォルトコンストラクタ c = color( (f) ); xpos = (g) ; ypos = (h) ; xspeed = 1; void display(){ rectmode(center); stroke( (i) ); fill( (j) ); rect( (k), (l),20,10); void drive(){ (m) += (n) ; if( (o) > (p) ){ (r) = 0; void drive(){ xpos += xspeed; if(xpos > width){ xpos = 0; 4

background(0); drive(); display(); Car (r) ; size(200,200); // Car オブジェクトを作る mycar = (r) ; background(0); (s) (); (t) (); (a) Car (b) color c; int (c) ; int (d) ; int (e) ; // デフォルトコンストラクタ Car(){ c = color( (f) ); xpos = (g) ; ypos = (h) ; xspeed = 1; // 引数付きのコンストラクタ Car (color carcolor,int x,int y,int s){ c = carcolor; xpos = x; ypos = y; xspeed = s; void display(){ rectmode(center); stroke( (i) ); fill( (j) ); rect( (k), (l),20,10); void drive(){ (m) += (n) ; if( (o) > (p) ){ (r) = 0; Car (s) ; Car (t) ; mycar1 = (u) ; mycar2 = new (v) (color( (w) ), width/2,height/4,1); background(0); (x).drive(); (y).display(); (z).drive(); (aa).display(); 5

float x = 100; float y = 0; float speed = 3; float gravity = 0.5; size(200,400); background(100); fill(255); nostroke(); rectmode(center); rect(x,y,10,20); y = y+speed; speed = speed + gravity; if(y+10 > height){ speed = -0.95*speed; y = height-10; 6

float xcenter; // 円の中心の X 座標 float ycenter; // 円の中心の Y 座標 float xspeed; // X 軸方向の移動速度 float yspeed; // Y 軸方向の移動速度 float radius; // 円の半径 radius = 10; xcenter = -radius; ycenter = -radius; xspeed = 0.5; yspeed = 1.2; class (a) { float xcenter; // 円の中心の X 座標 float ycenter; // 円の中心の Y 座標 float xspeed; // X 軸方向の移動速度 float yspeed; // Y 軸方向の移動速度 float radius; // 円の半径 // デフォルトコンストラクタ (b) (float vx0,float vy0){ radius = 10; xcenter = radius; ycenter = radius; xspeed = vx0; yspeed = vy0; 7

background(255); // move xcenter += xspeed; ycenter += yspeed; // draw stroke(0); fill(0); ellipse(xcenter,ycenter,2*radius,2*radius); void move(){ xcenter += xspeed; ycenter += yspeed; stroke(0); fill(0); ellipse(xcenter,ycenter,2*radius,2*radius); (c) aball; aball = new (d) ( (e), (f) ); background(255); aball.move(); aball.draw(); 8

float xcenter; // 円の中心の X 座標 float ycenter; // 円の中心の Y 座標 float xspeed; // X 軸方向の移動速度 float yspeed; // Y 軸方向の移動速度 float radius; // 円の半径 radius = 10; xcenter = -radius; ycenter = -radius; xspeed = 0.5; yspeed = 1.2; background(255); if(isoutofrange()){ xcenter = -radius; ycenter = -radius; xspeed = random(0.4,2.0); yspeed = random(0.4,2.0); // move xcenter += xspeed; ycenter += yspeed; // draw stroke(0); fill(0); ellipse(xcenter,ycenter,2*radius,2*radius); class (a) { float xcenter; // 円の中心の X 座標 float ycenter; // 円の中心の Y 座標 float xspeed; // X 軸方向の移動速度 float yspeed; // Y 軸方向の移動速度 float radius; // 円の半径 // デフォルトコンストラクタ (b) (float vx0,float vy0){ radius = 10; xcenter = radius; ycenter = radius; xspeed = vx0; yspeed = vy0; void move(){ xcenter += xspeed; ycenter += yspeed; stroke(0); fill(0); ellipse(xcenter,ycenter,2*radius,2*radius); (c) isoutofrange(){ if(xcenter-radius > width){ return true; else if(ycenter-radius > height){ return true; return false; 9

boolean isoutofrange(){ if(xcenter-radius > width){ return true; else if(ycenter-radius > height){ return true; return false; (d) aball; aball = new (e) ( (f), (g) ); if(aball.isoutofrange()){ aball.xcenter = (h) ; aball.ycenter = (i) ; aball.xspeed = (j) ; aball.yspeed = (k) ; aball.move(); aball.draw(); 10