I teach an after school activity on computer programming for kids in grades 3 to 5 using Scratch. I want to know if there is an upper limit on the values that can be entered in the input areas. I also want to know if there is a maximum number for the sprites that can be included in a project.
When I introduce the move block to the students and tell them that they can change the value in the white area, immediately I get asked the following questions: Can I enter a million? How about a billion? and so on.
I decided to do a little experiment. I painted a dot for sprite and I put together the following blocks
[blocks]<go to x 0 )y 0
<move( )steps> [/blocks]
I increased the number of steps from 10 to 100 to 1000 and so on and ran the script. I monitored the x position each time and here's what I got
After [blocks]<move(10 )steps> [/blocks] x position was 10
[blocks]<move(100 )steps> [/blocks] x position was 100
[blocks]<move(1000 )steps> [/blocks] x position was 240
[blocks]<move(10000 )steps> [/blocks] x position was 240
and so on till the number of steps was 1 followed by 16 zeroes. The sprite was visible on the stage.
When I increased the steps to 1 followed by 17 zeroes, the x position changed to 234, and the sprite became invisible. The x position kept changing with the number of zeroes
For 1 followed by 18 zeroes, x position was 250
For 1 followed by 19 zeroes, x position was -774
For 1 followed by 20 zeroes, x position was -774
This kept on as I added more zeroes.
Can someone explain why this is happening?
I also tried putting the move block inside the forever as below. I used the butterfly1-a sprite from animals folder for this code.
[blocks]<when green flag clicked>
<forever>
<move( )steps>
<if on edge, bounce>
[/blocks]
end<forever>
When the number of steps was less, the y position remained constant. When the number of steps was increased to 1 followed by 14 zeroes, the y position started changing with the bounce. In other words, the sprite kept sliding down when it bounced.
Can someone also explain why this is happening?
My 8 year old son saw this project and named it "why y butterfly"
My next question is whether there is a limit on the number of sprites that can be put in a project. Please let me know.
Thanks
Offline
Hi xyzabc.
you're right in observing that sprites will not completely disappear from the stage, even if you set their coordinates to values which are beyond the stages's boundaries (either by assigning them directly or by letting the move in looped steps). A small part of the sprite will mostly always stay visible. This has been a design decision by the Scratch Team following the "stage" metaphor in Scratch, rather than to have "offscreen" worlds or "wrapped" movements (where a sprite would reenter the stage from the opposite side, like in LOGO). So, how far exactly can a sprite move over the stage's edge before it stops moving? I'm not sure, to be honest, the limit seems to be shifting depending on the sprite's overall size.
As far as the number of total sprites (or costumes, sounds, scripts) is concerned there is no absolute limit I'm aware of. Just remember that if you want to share a project on this site it can't be bigger than 10 MB.
Offline
You are right. There's no upper limit on integer numeric inputs, since Scratch
supports infinite precision integers.
According to the Scratch team, "the upper limit on a decimal numbers is is roughly +/- 1.7977 × 10^308. (Scratch uses double-precision, 64-bit floating point numbers). Some Scratch commands may not handle very large numbers gracefully, but you are unlikely to run into those cases in normal operation."
There is also limit on the number of sprites. We've seen projects that use several hundred sprites. However, Scratch can become slower when there are too many sprites.
Good luck!
Claudia
Offline
Thank you Jens Mönig and Claudia for your reply.
The quote by Claudia "Scratch commands may not handle very large numbers gracefully, but you are unlikely to run into those cases in normal operation" explains the odd behavior that I was getting in the projects. Meanwhile the students in my class are having fun experimenting and looking at the odd outcomes. One of the students keeps hitting "Get surprise sprite" button to figure out the maximum number of sprites a project can handle. I can explain to him that there is no maximum limit and that it will just increase the file size.
Thanks
-Kanthi
Offline
This is very interesting... soon they will have the real answer to your question because they really found it. Let us know!
Offline