bugfix: tutorials pong score countup on right side (#7603)

The ball wasn't acting correctly when touching the right side:
The score countup occured when the ball's left side touched the right
wall.
This commit is contained in:
SubaruArai 2021-09-20 00:39:41 +09:00 committed by GitHub
parent 390cffa3fc
commit c2471d3098
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ class PongGame(Widget):
if self.ball.x < self.x:
self.player2.score += 1
self.serve_ball(vel=(4, 0))
if self.ball.x > self.width:
if self.ball.right > self.width:
self.player1.score += 1
self.serve_ball(vel=(-4, 0))

View File

@ -52,7 +52,7 @@ class PongGame(Widget):
if self.ball.x < self.x:
self.player2.score += 1
self.serve_ball(vel=(4, 0))
if self.ball.x > self.width:
if self.ball.right > self.width:
self.player1.score += 1
self.serve_ball(vel=(-4, 0))