teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

情報の追加

2020/07/11 15:37

投稿

bump_of_pool
bump_of_pool

スコア7

title CHANGED
File without changes
body CHANGED
@@ -3,4 +3,103 @@
3
3
  ![イメージ説明](20d0349b49cb67ba0b41d34ac1ba79d7.png)
4
4
  ![イメージ説明](983d7e1b226723edb30e858d4a4a9fbd.png)
5
5
  processingで画像のようなプログラムをつくりたいです。
6
- 1枚目の画像をクリックすると、2枚目の画像が出てきて、利根川進をクリックするとクリア、木村資生を押すと残念がでるようなプログラムを作成したいです。画像を表示するのではなく、プログラムでテキストなどを表示したいです。これにBGMをつけたいです。クラスを定義し,オブジェクトを生成し,オブジェクトを活用するプログラムという条件では、どのようにすればよいのかわからないです。
6
+ 1枚目の画像をクリックすると、2枚目の画像が出てきて、利根川進をクリックするとクリア、木村資生を押すと残念がでるようなプログラムを作成したいです。画像を表示するのではなく、プログラムでテキストなどを表示したいです。これにBGMをつけたいです。クラスを定義し,オブジェクトを生成し,オブジェクトを活用するプログラムという条件では、どのようにすればよいのかわからないです。
7
+
8
+ class Opening{//画像1
9
+ int x;
10
+ int y;
11
+ Opening(int tempX,int tempY){
12
+ x = tempX;
13
+ y = tempY;
14
+ }
15
+ void display(){
16
+ pushMatrix();
17
+ translate(x,y);
18
+ background(0,255,255);
19
+ textAlign(CENTER);
20
+ fill(0);
21
+ textSize(25);
22
+ text("ルイザ・グロス・ホロウィッツ賞",width/2, 250);
23
+ text("日本人受賞者を覚えよう!",width/2, 285);
24
+ textSize(18);
25
+ text("ルイザ・グロス・ホロウィッツ賞",width/2, 500);
26
+ text("日本人受賞者を全員答えられたらクリアだよ",width/2, 530);
27
+ popMatrix();
28
+ }
29
+ }
30
+
31
+
32
+ class Question{//画像2
33
+ int x;
34
+ int y;
35
+ Question(int tempX,int tempY){
36
+ x = tempX;
37
+ y = tempY;
38
+ }
39
+ void display(){
40
+ pushMatrix();
41
+ translate(x,y);
42
+ background(245,100,170);
43
+ textAlign(CENTER);
44
+ fill(0);
45
+ textSize(25);
46
+ text("生物学や生化学の研究者に贈られる",width/2, 250);
47
+ text("ルイザ・グロス・ホロウィッツ賞を",width/2, 285);
48
+ text("現在、日本人で唯一受賞したのは誰?",width/2, 320);
49
+ fill(255);
50
+ noStroke();
51
+ rect(x1,y1,w,h);
52
+ fill(0);
53
+ textAlign(CENTER);
54
+ textSize(30);
55
+ text("利根川進",115,600);
56
+ fill(255);
57
+ rect(x2,y2,w,h);
58
+ fill(0);
59
+ text("木村資生",335,600);
60
+ popMatrix();
61
+ }
62
+ }
63
+
64
+
65
+ class Correct{//画像3
66
+ int x;
67
+ int y;
68
+ Correct(int tempX,int tempY){
69
+ x = tempX;
70
+ y = tempY;
71
+ }
72
+ void display(){
73
+ pushMatrix();
74
+ translate(x,y);
75
+ background(255,255,0);
76
+ textAlign(CENTER);
77
+ textSize(80);
78
+ text("クリア",width/2,300);
79
+ textSize(25);
80
+ text("1不可説不可説転点",width/2,500);
81
+ text("獲得",width/2,535);
82
+ popMatrix();
83
+ }
84
+ }
85
+
86
+ class Incorrect{//画像4
87
+ int x;
88
+ int y;
89
+ Incorrect(int tempX,int tempY){
90
+ x = tempX;
91
+ y = tempY;
92
+ }
93
+ void display(){
94
+ pushMatrix();
95
+ translate(x,y);
96
+ background(255,255,0);
97
+ textAlign(CENTER);
98
+ textSize(80);
99
+ text("残念",width/2,300);
100
+ textSize(20);
101
+ text("あなたはルイザ・グロス・ホロウィッツ賞の",width/2,500);
102
+ text("日本人受賞者を1人も覚えていません",width/2,535);
103
+ popMatrix();
104
+ }
105
+ }