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

質問編集履歴

1

〈code〉内にソースコードを書きました。

2019/06/28 06:49

投稿

Alex_M
Alex_M

スコア32

title CHANGED
File without changes
body CHANGED
@@ -6,6 +6,7 @@
6
6
  ### found an extra{character without a } to match it.
7
7
 
8
8
  ```
9
+ ```Processing
9
10
  int scene = 1;//ステージ
10
11
 
11
12
  boolean a = false;
@@ -80,59 +81,65 @@
80
81
 
81
82
 
82
83
  //---------------------------------------------------↑ドアの部屋
83
- else if (scene == 2) {
84
+ } else if (scene == 2) {
84
- room();
85
+ room();
85
- fill(#AFAFAF);
86
+ fill(#AFAFAF);
86
- rect(290, 320, 80, 80);//カギ1}
87
+ rect(290, 320, 80, 80);//カギ1}
87
88
 
88
- if (a) {//a = カギ1GET
89
+ if (a) {//a = カギ1GET
89
- room();
90
+ room();
90
- textSize(30);
91
+ textSize(30);
91
- fill(#FF0000);
92
+ fill(#FF0000);
92
- text("YOU GET A KEY1 !", 100, 280);
93
+ text("YOU GET A KEY1 !", 100, 280);
93
- c = true;
94
+ c = true;
94
95
 
95
96
 
96
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑2つ目の部屋+カギ1
97
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑2つ目の部屋+カギ1
97
- else if (scene == 3) {
98
+ } else if (scene == 3) {
98
- room();
99
+ room();
99
100
 
100
- if (d) {//カギ2出現
101
+ if (d) {//カギ2出現
101
- room();
102
+ room();
102
- fill(#03FFF9);
103
+ fill(#03FFF9);
103
- rect(290, 320, 80, 80);//カギ2
104
+ rect(290, 320, 80, 80);//カギ2
104
- e = true;
105
+ e = true;
105
106
 
106
- if (f) {//カギ2GET
107
+ if (f) {//カギ2GET
107
- room();
108
+ room();
108
- textSize(30);
109
+ textSize(30);
109
- fill(#FF0000);
110
+ fill(#FF0000);
110
- text("YOU GET A KEY2 !", 100, 280);
111
+ text("YOU GET A KEY2 !", 100, 280);
111
- g = true;
112
+ g = true;
112
113
 
113
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑3つ目の部屋+カギ2
114
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑3つ目の部屋+カギ2
114
- else if (scene==4) {
115
+ } else if (scene==4) {
115
- room();
116
+ room();
116
- }
117
+ }
117
118
 
118
- if (g) {//カギ3出現
119
+ if (g) {//カギ3出現
119
- room();
120
+ room();
120
- fill(#FAFF03);
121
+ fill(#FAFF03);
121
- rect(290, 320, 80, 80);//カギ3
122
+ rect(290, 320, 80, 80);//カギ3
122
123
 
123
124
 
124
- if (h) {//カギ3GET
125
+ if (h) {//カギ3GET
125
- room();
126
+ room();
126
- textSize(30);
127
+ textSize(30);
127
- fill(#FF0000);
128
+ fill(#FF0000);
128
- text("YOU GET A KEY3 !", 100, 280);
129
+ text("YOU GET A KEY3 !", 100, 280);
129
- b = true;
130
+ b = true;
130
131
 
131
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑4つ目の部屋+カギ3
132
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑4つ目の部屋+カギ3
133
+ }
134
+ }
135
+ }
136
+ }
137
+ }
138
+ }
139
+ }
140
+ }
132
141
  }
133
142
  }
134
- }
135
- }
136
143
  void mousePressed() {
137
144
  if (scene == 1) {
138
145
  if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
@@ -143,16 +150,15 @@
143
150
  scene = 2;
144
151
  }
145
152
 
146
- if (i) {//扉クリック
153
+ //if (i) {//扉クリック
147
- if (mouseX > 330 && mouseX < 440 && mouseY > 140 && mouseY < 370) {
154
+ //if (mouseX > 330 && mouseX < 440 && mouseY > 140 && mouseY < 370) {
148
- b = true;
155
+ //b = true;
149
- }
150
- }
151
- }
152
- }
153
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑ドアの部屋
156
+ //}
154
157
 
158
+
159
+
160
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑ドアの部屋
155
- else if (scene == 2) {
161
+ } else if (scene == 2) {
156
162
  if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
157
163
  scene = 1;
158
164
  }
@@ -160,41 +166,67 @@
160
166
  if (mouseX < 480 && mouseX > 440 && mouseY > 215 && mouseY < 255) {
161
167
  scene = 3;
162
168
  }
163
- if (c) {//カギ1拾ってからカギ2クリック
169
+ //if (c) {//カギ1拾ってからカギ2クリック
164
- if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵1クリック
170
+ //if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵1クリック
165
- d = true;
171
+ //d = true;
166
- }
172
+ //}
167
173
 
168
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑2つ目の部屋
174
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑2つ目の部屋
175
+ } else if (scene == 3) {
176
+ if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
177
+ scene = 2;
178
+ }
169
179
 
170
- else if (scene==3) {
171
- if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
180
+ if (mouseX < 480 && mouseX > 440 && mouseY > 215 && mouseY < 255) {
172
- scene = 2;
181
+ scene = 4;
173
- }
182
+ }
174
183
 
184
+ //if (e) {
175
- if (mouseX < 480 && mouseX > 440 && mouseY > 215 && mouseY < 255) {
185
+ //if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵2クリック
186
+ //f = true;
176
- scene = 4;
187
+ //}
177
- }
178
188
 
189
+ //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑3つ目の部屋
179
- if (e) {
190
+ } else if (scene == 4) {
180
- if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵2クリック
191
+ if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
181
- f = true;
192
+ scene = 3;
182
- }
193
+ }
183
194
 
184
- //ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー↑3つ目の部屋
195
+ if (mouseX < 480 && mouseX > 440 && mouseY > 215 && mouseY < 255) {
196
+ scene = 1;
197
+ }
185
198
 
186
- else if (scene==4) {
199
+ //if (g) {
187
- if (mouseX < 40 && mouseX > 0 && mouseY > 215 && mouseY < 255) {
200
+ //if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵3クリック
201
+ // h = true;
188
- scene = 3;
202
+ //}
189
- }
203
+ }
204
+ }
190
205
 
191
- if (mouseX < 480 && mouseX > 440 && mouseY > 215 && mouseY < 255) {
192
- scene = 1;
193
- }
194
206
 
207
+
208
+
209
+
210
+
211
+ void mouseClicked() {
212
+ if (scene == 1) {
213
+ if (i) {//扉クリック
214
+ if (mouseX > 330 && mouseX < 440 && mouseY > 140 && mouseY < 370) {
215
+ b = true;
216
+ } else if (scene == 2) {
217
+ if (c) {//カギ1拾ってからカギ2クリック
218
+ if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵1クリック
219
+ d = true;
220
+ } else if (scene == 3) {
221
+ if (e) {
222
+ if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵2クリック
223
+ f = true;
224
+ } else if (scene == 4) {
195
- if (g) {
225
+ if (g) {
196
- if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵3クリック
226
+ if (mouseX > 290 && mouseX < 370 && mouseY > 320 && mouseY < 400) {//鍵3クリック
197
- h = true;
227
+ h = true;
228
+ }
229
+ }
198
230
  }
199
231
  }
200
232
  }
@@ -204,10 +236,10 @@
204
236
  }
205
237
  }
206
238
 
239
+ ```
207
240
 
208
241
 
209
242
 
210
-
211
243
  言語はProcessingです。
212
244
 
213
245
  ### }を追加したり、減らしたり試したのですがうまくいきません。