回答編集履歴

1

float[] y1

2020/07/18 17:21

投稿

TN8001
TN8001

スコア9317

test CHANGED
@@ -4,7 +4,9 @@
4
4
 
5
5
  ```Processing
6
6
 
7
- float[] x1 = new float[3000];
7
+ float[] x1 = new float[100]; // 同じ数にする
8
+
9
+ float[] y1 = new float[100]; // 同じ数にする
8
10
 
9
11
  //int x, y; // 使っていない
10
12
 
@@ -22,7 +24,9 @@
22
24
 
23
25
  for (int i = 0; i < x1.length; i++) {
24
26
 
25
- x1[i] = random(-1000, 200);
27
+ x1[i] = random(-1500, 200);
28
+
29
+ y1[i] = random(0, height);
26
30
 
27
31
  }
28
32
 
@@ -82,9 +86,7 @@
82
86
 
83
87
  x1[i] += 3;
84
88
 
85
- float y1 = i * 3;
86
-
87
- arc(x1[i], y1, 60, 60, 0.52, 5.76);
89
+ arc(x1[i], y1[i], 60, 60, 0.52, 5.76);
88
90
 
89
91
 
90
92
 
@@ -92,7 +94,7 @@
92
94
 
93
95
  //if ((x-x1[i])*(x-x1[i])+(y-y1)*(y-y1)<=(60+10)*(60+10)) {
94
96
 
95
- if (dist(mouseX, mouseY, x1[i], y1) <= 60 + 10) {
97
+ if (dist(mouseX, mouseY, x1[i], y1[i]) <= 35) {
96
98
 
97
99
  text("GAME OVER", 300, 300);
98
100
 
@@ -102,7 +104,7 @@
102
104
 
103
105
  }
104
106
 
105
-
107
+
106
108
 
107
109
  if (12 * 1000 <= millis()) { // プログラムを開始してからの秒数(ms)
108
110