Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Trying to finish my project faster
- spemil
-
Scratcher
5 posts
Trying to finish my project faster
Basically, I am working on a game called “Random Spelling Bee Word Generator”. It generates random words for my local spelling bee, to help kids study. I had to make 559 costumes. I am trying to code it for all 559 words so it will change to a different word everytime I click the generate button. I have so far coded 140 words and I have to be done before Tuesday. I'm running out of time to do this and don't know what to do. I was wondering if somebody could maybe find out a way to get this done faster. Help would be appreciated highly, and I will probably put you in my credits section for this game. Thanks for reading, heres the link. https://scratch.mit.edu/projects/305774186/ -spemil
- DaEpikDude
-
Scratcher
1000+ posts
Trying to finish my project faster
this should probably be in the “Help with Scripts” section
If you just want it to switch to a random costume when you press the button, then I think all you really need to do is, in the generate button:
I don't think you have to rename the costumes for that to work, but if it doesn't work try renaming the costumes to 1, 2, 3, 4, 5, 6, and so on (so they're just numbers).
If you want to make sure it never goes to the same word twice, then you could instead make a list with all the numbers from 1 to 559 in it, then you pick something from the list and switch to that costume.
That should get you a new word every single time, but the 1st way is much simpler and probably gives you more or less the same result, so it may be better.
If you just want it to switch to a random costume when you press the button, then I think all you really need to do is, in the generate button:
when this sprite clickedThen, in the sprite with the words in it:
broadcast [new word v]
when I receive [new word v]
switch costume to (pick random (1) to (559))
I don't think you have to rename the costumes for that to work, but if it doesn't work try renaming the costumes to 1, 2, 3, 4, 5, 6, and so on (so they're just numbers).
If you want to make sure it never goes to the same word twice, then you could instead make a list with all the numbers from 1 to 559 in it, then you pick something from the list and switch to that costume.
//to reset the list
when gf clicked
delete (all v) of [list v]
set [i v] to [1] // counter variable to help reset the list
repeat (559)
add (i) to [list v]
change [i v] by (1)
end
// in the generate button
when this sprite clicked
broadcast [new word v]
//in the sprite with the words
when I receive [new word v]
set [i v] to (pick random (1) to (length of [list v]))
switch costume to (item (i) of [list v])
delete (i) of [list v]
That should get you a new word every single time, but the 1st way is much simpler and probably gives you more or less the same result, so it may be better.
- mstone326
-
Scratcher
1000+ posts
Trying to finish my project faster
Basically, I am working on a game called “Random Spelling Bee Word Generator”. It generates random words for my local spelling bee, to help kids study. I had to make 559 costumes. I am trying to code it for all 559 words so it will change to a different word everytime I click the generate button. I have so far coded 140 words and I have to be done before Tuesday. I'm running out of time to do this and don't know what to do. I was wondering if somebody could maybe find out a way to get this done faster. Help would be appreciated highly, and I will probably put you in my credits section for this game. Thanks for reading, heres the link. https://scratch.mit.edu/projects/305774186/ -spemil
You should look into text engines. Then you have one sprite with the alphabet and the text engine will go letter by letter and find the appropriate costume and either clone or stamp it.
Here is one I made, there are MANY, WAY better but it will give you an idea. Making 600 costumes..that is quite an undertaking. Type a word, then press 1 or 2 to use either clones or stamps.
https://scratch.mit.edu/projects/226234813/
Last edited by mstone326 (Sept. 2, 2019 02:09:29)
- deck26
-
Scratcher
1000+ posts
Trying to finish my project faster
@mstone326 is right, you should be generating the text rather than creating costumes. Then you just need a list of words. You can avoid having to create a text engine if you just get a sprite to say the current word.
All those costumes are making your project slow to load.
All those costumes are making your project slow to load.
- Discussion Forums
- » Help with Scripts
-
» Trying to finish my project faster