Search code examples
backgroundcs50mit-scratch

Why is it that when the ball touches the goalie the backdrop(background) does not change to game over background?


Ball Movement Code: Goalie Movement Code: The code was working before, however it is not working now.

I tried to rework my code change my blocks for when the ball touches the goalie to send a message to the goalie and the goalie to send a message to change the backdrop(background) to game over backdrop.


Solution

  • According to the screenshots, it's possible you are not calling Ball Movement.

    To improve your code, make it so that the soccer ball does not have the "When background switches to Game Over", since there is already a function in the same sprite that changes background.

    Put the code in the ball sprite that is under "When background switches to Game Over " inside the "if touching goalie" statement.

    100% Make sure you're calling ball movement in a forever loop under its own green flag clicked.