Skip to content

Commit 1c2412d

Browse files
committed
obstacle-race: 鳥の出現パターンを調整。静止していてもたまに出現。
1 parent 4448c0a commit 1c2412d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

11-obstacle-race/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ def reset(self):
293293
self.obstacles.append(Flower2(x+8, 72, self.img))
294294
else:
295295
self.obstacles.append(Flower1(x, 72, self.img))
296-
self.obstacles.append(Bird(x, random.randint(48, 72), self.img, speed=3))
296+
if i % 3 != 0:
297+
self.obstacles.append(Bird(x, random.randint(48, 72), self.img, speed=3))
297298

298299
reset()
299300

@@ -306,6 +307,10 @@ def update(self):
306307

307308
if pyxel.btnp(pyxel.KEY_4):
308309
reset()
310+
311+
if pyxel.frame_count % 30 == 0 and random.randint(0, 6) == 0:
312+
self.obstacles.append(Bird(player.x + 127, random.randint(16, 64), self.img, speed=random.randint(1, 3)))
313+
309314
for cloud in self.clouds:
310315
cloud.update()
311316
player.update()

0 commit comments

Comments
 (0)