We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8cafb7 commit 6bc5c4fCopy full SHA for 6bc5c4f
Example/MLKit/GameScene.swift
@@ -460,11 +460,21 @@ class GameScene: SKScene, SKPhysicsContactDelegate {
460
461
// Check to see if the pipe in front has gone behind the bird
462
// if so, make the new pipe in front of the bird the target pipe
463
- if pipes.children[currentPipe].position.x < bird.position.x {
+ if pipes.children.count > 1 {
464
+ if pipes.children[currentPipe].position.x < bird.position.x {
465
- currentPipe = closestPipe(pipes: pipes.children)
466
+ currentPipe = closestPipe(pipes: pipes.children)
467
+ }
468
469
+
470
+ if pipes.children.count == 1 {
471
+ if pipes.children[0].position.x < bird.position.x {
472
473
+ currentPipe = 0
474
475
}
476
477
478
// Distance between next pipe and bird
479
let distanceOfNextPipe = abs(pipes.children[currentPipe].position.x - bird.position.x)
480
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments