Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Script is not working properly after scoring more than 3 points.
- Nochalski
-
New Scratcher
1 post
Script is not working properly after scoring more than 3 points.
Hi, Could you help me with my game?
https://scratch.mit.edu/projects/876815405
If you hit the ball with a bat you will get 1 point, if not it will be stopped at catchers hands and score will be set to 0.
It works as it should till you get 3 points. Ball is not stopping at catchers hands anymore, and it's still moving after reaching border.
I wrote this script few times in different ways with same result.
I cant undestand whats the cause of this
Thanks!
https://scratch.mit.edu/projects/876815405
If you hit the ball with a bat you will get 1 point, if not it will be stopped at catchers hands and score will be set to 0.
It works as it should till you get 3 points. Ball is not stopping at catchers hands anymore, and it's still moving after reaching border.
I wrote this script few times in different ways with same result.
I cant undestand whats the cause of this
Thanks!
- scratchcode1_2_3
-
Scratcher
1000+ posts
Script is not working properly after scoring more than 3 points.
I see the problem. You are using <color is touching > blocks, and at least for me, these are a bad choice and not reccomended to use. Instead, you can take out the whole catcher's hand and make it a separate sprite, so that we can use the <touching ?> block with no problem. Here's some gifs and screenshots I recorded to help you with the process:

Old block - color blocks are not a good choice

Step 1- Separate the glove/hand from the catcher sprite

Step 2- Match the catcher and the glove's coordinates. Don't forget to match the sizes too, I just forgot while recording XD

Step 3- Repeat step 1 and two but with the batter and the bat. (all not finished in the gif because of scratch's gif limit)

Step 4- rename each bat costume to the corresponding batter one.

Step 5- Add this code to the new bat sprite; this will make it so that the bat and batter are synchronized.

Step 6- Delete all the bats from the original batter sprite.

Step 7- reprogram the baseball sprite.
That's it! Your code should now be working as intended.
Hope this helps!

Old block - color blocks are not a good choice

Step 1- Separate the glove/hand from the catcher sprite

Step 2- Match the catcher and the glove's coordinates. Don't forget to match the sizes too, I just forgot while recording XD

Step 3- Repeat step 1 and two but with the batter and the bat. (all not finished in the gif because of scratch's gif limit)

Step 4- rename each bat costume to the corresponding batter one.

Step 5- Add this code to the new bat sprite; this will make it so that the bat and batter are synchronized.

Step 6- Delete all the bats from the original batter sprite.

Step 7- reprogram the baseball sprite.
That's it! Your code should now be working as intended.
Hope this helps!
- Discussion Forums
- » Help with Scripts
-
» Script is not working properly after scoring more than 3 points.

