Discuss Scratch
- ChocolatePi
-
1000+ posts
JavaScript / Scratch flashcards
I'm currently working on a series of flashcards to help the conversion to Scratch to JavaScript go smoothly for other Scratchers.
Here's a sample card:

I'm gonna be working on stuff like control structures, variables, lists, etc, but not stuff that includes media such as sounds, looks, or pen. Right now I only have the “if” one done but if anyone wants more I'd be more motivated to make these.
Some blocks I'd want to add:
Here's a sample card:

I'm gonna be working on stuff like control structures, variables, lists, etc, but not stuff that includes media such as sounds, looks, or pen. Right now I only have the “if” one done but if anyone wants more I'd be more motivated to make these.
Some blocks I'd want to add:
- Repeat
- Repeat until
- Forever
- Wait
- Wait until
- Variable blocks
- List blocks
- Operators blocks
- CatsUnited
-
1000+ posts
JavaScript / Scratch flashcards
I'm mainly focusing on learning Java but I need to know more JS. 

- ChocolatePi
-
1000+ posts
JavaScript / Scratch flashcards
Most basic control structure syntax is the same in curly-brace languages. I'm mainly focusing on learning Java but I need to know more JS.
- NickyNouse
-
1000+ posts
JavaScript / Scratch flashcards
That is super gorgeous (I'm always amazed by how great blocks look on different backgrounds lol) and I bet it'd be really handy too!
One thing to note: In JS, any structure that works like “forever” is probably a really bad idea. Something like while (true) {…} will just freeze up your code or crash the tab. The closest you can get away with is setInterval, but I'd strongly recommend something event-based instead.
One thing to note: In JS, any structure that works like “forever” is probably a really bad idea. Something like while (true) {…} will just freeze up your code or crash the tab. The closest you can get away with is setInterval, but I'd strongly recommend something event-based instead.
- ChocolatePi
-
1000+ posts
JavaScript / Scratch flashcards
lol you're right! i hadn't thought about that. maybe in the “forever” card i'll just put something about trying to work around it. That is super gorgeous (I'm always amazed by how great blocks look on different backgrounds lol) and I bet it'd be really handy too!
One thing to note: In JS, any structure that works like “forever” is probably a really bad idea. Something like while (true) {…} will just freeze up your code or crash the tab. The closest you can get away with is setInterval, but I'd strongly recommend something event-based instead.
- djdolphin
-
1000+ posts
JavaScript / Scratch flashcards
And if you're using a canvas, you should do something like The closest you can get away with is setInterval, but I'd strongly recommend something event-based instead.
function step() { // leedle requestAnimationFrame(step); } step();
Last edited by djdolphin (May 3, 2015 00:46:38)
- DigiTechs
-
500+ posts
JavaScript / Scratch flashcards
is more like this in JS:
function code(){ -- body setTimeout(code, 10); } code();
EDIT: Whoops. I forgot that [code js] exists.
Last edited by DigiTechs (May 3, 2015 11:40:45)
- MegaApuTurkUltra
-
1000+ posts
JavaScript / Scratch flashcards
I guess forever is a problem. My original post stated that it should just be a while(true) but I guess I see how that wouldn't really work.
I support djdolphins requestAnimationFrame idea, that can be used for any DOM-manipulation or canvas related loops, the only problem is that defocusing the browser tab can cause the frames to stack up and crash once you switch back, so you have to be careful.
Maybe to keep it easy and simple, you should use setInterval instead. Make sure people know about clearInterval though
I support djdolphins requestAnimationFrame idea, that can be used for any DOM-manipulation or canvas related loops, the only problem is that defocusing the browser tab can cause the frames to stack up and crash once you switch back, so you have to be careful.
Maybe to keep it easy and simple, you should use setInterval instead. Make sure people know about clearInterval though

Last edited by MegaApuTurkUltra (May 3, 2015 15:39:18)
- jayhss
-
46 posts
JavaScript / Scratch flashcards
Forever block would be like var draw = function() { };
is more like this in JS:function code(){ -- body setTimeout(code, 10); } code();
EDIT: Whoops. I forgot that [code js] exists.
- iamunknown2
-
1000+ posts
JavaScript / Scratch flashcards
Nope. It's more like
is more like this in JS:function code(){ -- body setTimeout(code, 10); } code();
EDIT: Whoops. I forgot that [code js] exists.
while(true) { // Your code here! };
Last edited by iamunknown2 (June 25, 2015 05:24:26)
- iamunknown2
-
1000+ posts
JavaScript / Scratch flashcards
Then the smaller Scratchers will demand how to move sprites and make costumes etc…
- ChocolatePi
-
1000+ posts
JavaScript / Scratch flashcards
Why would smaller Scratchers even use these anyway? Then the smaller Scratchers will demand how to move sprites and make costumes etc…
Read the posts above. If I ever finish these, the forever block won't be in the cards.Nope. It's more like
is more like this in JS:function code(){ -- body setTimeout(code, 10); } code();
EDIT: Whoops. I forgot that [code js] exists.while(true) { // Your code here! };
- iamunknown2
-
1000+ posts
JavaScript / Scratch flashcards
Their starter projects probably feature a moving Scratch Cat.Why would smaller Scratchers even use these anyway? Then the smaller Scratchers will demand how to move sprites and make costumes etc…
Last edited by iamunknown2 (June 27, 2015 04:11:03)
- djdolphin
-
1000+ posts
JavaScript / Scratch flashcards
Their starter projects probably feature a moving Scratch Cat.Why would smaller Scratchers even use these anyway? Then the smaller Scratchers will demand how to move sprites and make costumes etc…
Why would smaller Scratchers even use these [JavaScript/Scratch flashcards] anyway?
Last edited by djdolphin (June 27, 2015 13:57:32)
- NickyNouse
-
1000+ posts
JavaScript / Scratch flashcards
uhm JS isn't usually used for the same things Scratch is. Personally, I use JS more for processing data and displaying it than for moving elements around the page. If I wanted to make a visual game, I'd probs use canvas, which is a whole 'nother ballpark, rather than move elements around.Their starter projects probably feature a moving Scratch Cat.Why would smaller Scratchers even use these anyway? Then the smaller Scratchers will demand how to move sprites and make costumes etc…
- chuckdaboss
-
100+ posts
JavaScript / Scratch flashcards
cool, but what about function not in scratch, like rect(13,37,13,37); ?
- ev3coolexit987654
-
1000+ posts
JavaScript / Scratch flashcards
This is awesome! The reason there's a comma is because setTimeout takes 2 arguments
could be
window.setTimeout(, 1*1000);
- iamunknown2
-
1000+ posts
JavaScript / Scratch flashcards
But New Scratchers won't understand. Plus, they would say: uhm JS isn't usually used for the same things Scratch is. Personally, I use JS more for processing data and displaying it than for moving elements around the page. If I wanted to make a visual game, I'd probs use canvas, which is a whole 'nother ballpark, rather than move elements around.
BUT EVERYBODY'S MAKING COOL GAMES IN HTML5! I DON'T WANT TO MAKE AN ADVENTURE GAME! I DON'T WANT TO MAKE WEBSITES! I WANT TO LEARN HOW TO MAKE A SCRATCH CAT MOVE NOWWWWWWW!!!!!!!!!!!!!! I WANT TO LEARN HOW TO MAKE MINECRAFT MODS IN JAVASCRIPT!!! I WANT TO KNOW HOW TO MAKE 3D MARIO IN JAVASCRIPT!!!So…
Last edited by iamunknown2 (June 27, 2015 23:57:08)
- Firedrake969
-
1000+ posts
JavaScript / Scratch flashcards
Better than using Flash xDuhm JS isn't usually used for the same things Scratch is. Personally, I use JS more for processing data and displaying it than for moving elements around the page. If I wanted to make a visual game, I'd probs use canvas, which is a whole 'nother ballpark, rather than move elements around.Their starter projects probably feature a moving Scratch Cat.Why would smaller Scratchers even use these anyway? Then the smaller Scratchers will demand how to move sprites and make costumes etc…
If you want to do serious data processing, something FO is best like Haskell/F# or even Python w/Numpy (and Django if you want it to be a webapp).
- Rumanti
-
1000+ posts
JavaScript / Scratch flashcards
@iamunknown2, I believe @ChocolatePi does not intend these for “just anyone”, but more for peoples moving on who knows what they are doing..