-1

Here is the link to the game so you can see the code.. https://scratch.mit.edu/projects/668072441

I am utterly confused the current setup uses blocks but I have tried dozens of configurations and none of them are working. Goal of the game is when the dog hits the black line (both are sprites) it ups the score by one and resets the dog this part works but when the dog hits cat it's supposed to broadcast the score and end the game. Then I am going to have the cat sprite say the final score later after I figure this out. But it doesn't end the game and I can't figure out why

  • 1
    Hi and welcome to Stack Overflow. With the info you gave us it would be quite hard to understand. Are you able to provide us with a console error? I understand it fails when clicking, but what is it failing and where. Also, without seeing the code it would also be very hard to help you out, the more info the best! – Mese Mar 30 '22 at 11:09
  • 2
    Your Scratch page comes up with a 404. – Arnav Thorat Apr 01 '22 at 07:50

1 Answers1

2

The reason it isn't working is because of the block that says:

[glide (pick random (1) to (1.4)) seconds to x: (-240) y: (-100)]

The scripts below it won't be executed until the block finishes. At that point, the dog will be past the cat, so contact won't be detected. The fix is pretty simple: simply take the two if loops and move them into a single, different forever loop, like this:

when flag clicked:
 forever:
  if (touching (Sprite1)) then:
   End Game
  if (touching (Line)) then:
   Score
Jacob B
  • 64
  • 5