I am teaching Scratch for the first time to a group of Gr 10 students. I'd like them to create a game involving a basket (or whatever) catching a series of balls / eggs / whatever that slide straight down. It would be nice if level 1 had 10 balls, level 2 had 20 and so on. How do I create a number of sprites based on a certain variable value?
Thanks
Offline
The easiest solution would be to have the maximum number of balls already made and have each show up according to a variable (so ten would say "if level >0 then show" another ten would say "if level >1 then show" and so on).
Unfortunately right now in Scratch you cannot create a sprite while the program is running, so you can't make more during the game, so you can't have an infinite number of balls.
There are other solutions that involve stamping and lists (which can create infinite balls albeit with some lag) but they would be a bit too complex for first time Scratchers.
Last edited by Kileymeister (2011-09-25 17:28:44)
Offline
cabennet wrote:
I am teaching Scratch for the first time to a group of Gr 10 students. I'd like them to create a game involving a basket (or whatever) catching a series of balls / eggs / whatever that slide straight down. It would be nice if level 1 had 10 balls, level 2 had 20 and so on. How do I create a number of sprites based on a certain variable value?
Thanks
Scratch has no "make a sprite" block. If you have a set number of levels, make the maximum needed, and use "show" and "hide".
If you want an infinite number of levels, well, you'll have some trouble. Stamping would lag a lot after a while. If you really need infinite levels without lagging, I would suggest using a Scratch Modification that has cloning capabilities.
Edit: Kileymeister beat me to it. See his/her post (above mine).
Last edited by Greenatic (2011-09-25 17:28:45)
Offline