main.py
def on_update(self, delta_time):
        """
        Update sprites movement and collisions if the game has started
        """
        # if ball has started movement
        if self.ball_sprite.change_y != 0:
            # update the ball's position
            self.ball_list.update()

            # update ball's speed in x,y directions based on collision with the walls or ceiling
            self.wall_collisions()

            # update the ball's speed in the x,y directions based on collision with the paddle
            self.paddle_collisions()

            # handle collisions between the ball and bricks
            self.brick_collisions()

            # if all bricks have been cleared, then advance levels
            if len(self.brick_list) == 0 and self.level < MAX_LEVEL:
                self.advance_levels()
            elif (len(self.brick_list) == 0):
                self.game_over = True
            
            # if ball has gone off the bottom of the screen
            if self.ball_sprite.top < 0:

                # lose points if ball goes off screen
                if not self.game_over:
                    self.score -= 10

                # decrement lives and reset ball if there are still lives remaining
                if self.lives > 1:
                    self.lives -= 1
                    self.reset_ball()
                # update game_over variable if no lives remaining
                elif self.lives == 1:
                    self.lives -= 1
                    self.game_over = True

        Update sprites movement and collisions if the game has started
        
Update sprites movement and collisions if the game has started
Update sprites movement and collisions if the game has started
def on_update(self, delta_time):
        if self.ball_sprite.change_y != 0:
            self.ball_list.update()
            self.wall_collisions()
            self.paddle_collisions()
            self.brick_collisions()
            if len(self.brick_list) == 0 and self.level < MAX_LEVEL:
                self.advance_levels()
            elif (len(self.brick_list) == 0):
                self.game_over = True
            if self.ball_sprite.top < 0:
                if not self.game_over:
                    self.score -= 10
                if self.lives > 1:
                    self.lives -= 1
                    self.reset_ball()
                elif self.lives == 1:
                    self.lives -= 1
                    self.game_over = True
def on_update ( self , delta_time ) : if self . ball_sprite . change_y != 0 : self . ball_list . update ( ) self . wall_collisions ( ) self . paddle_collisions ( ) self . brick_collisions ( ) if len ( self . brick_list ) == 0 and self . level < MAX_LEVEL : self . advance_levels ( ) elif ( len ( self . brick_list ) == 0 ) : self . game_over = True if self . ball_sprite . top < 0 : if not self . game_over : self . score -= 10 if self . lives > 1 : self . lives -= 1 self . reset_ball ( ) elif self . lives == 1 : self . lives -= 1 self . game_over = True
Update sprites movement and collisions if the game has started
Update sprites movement and collisions if the game has started
"""
        Update sprites movement and collisions if the game has started
        """ # if ball has started movement # update the ball's position # update ball's speed in x,y directions based on collision with the walls or ceiling # update the ball's speed in the x,y directions based on collision with the paddle # handle collisions between the ball and bricks # if all bricks have been cleared, then advance levels # if ball has gone off the bottom of the screen # lose points if ball goes off screen # decrement lives and reset ball if there are still lives remaining # update game_over variable if no lives remaining
self
delta_time