Discuss Scratch

Pixiedust115
Scratcher
5 posts

Scratch to Javascript converter

I agree on a java script converter, but there is an alternative. Tynker is another coding software that uses the same blocks as Scratch (with a few others), but can convert to JavaScript and Python. Just saying.
————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————
when green flag clicked
if <<[No JavaScript Converter] = [Yes]>> then
say [Try Tynker] for (2) secs
end

Hey, pixies! Let's unite and help return the fairies to their former state!
#Returnthehollow
jokebookservice1
Scratcher
1000+ posts

Scratch to Javascript converter

Pixiedust115 wrote:

I agree on a java script converter, but there is an alternative. Tynker is another coding software that uses the same blocks as Scratch (with a few others), but can convert to JavaScript and Python. Just saying.
————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————<>————
when green flag clicked
if <<[No JavaScript Converter] = [Yes]>> then
say [Try Tynker] for (2) secs
end
Not really.

From what I can tell, Tynker assumes functions like “blast()” are already defined. While this is fine for teaching syntax, you can't actually run the code without importing extra code.
havefunbefun
Scratcher
44 posts

Scratch to Javascript converter

I think that Scratch is unique for the block coding, so if you want to do Java script, you may wanna find another website.
<[Scatch] = [Awesome]>
Charles12310
Scratcher
1000+ posts

Scratch to Javascript converter

Scratch is not the same as JavaScript. Scratch has stuff JavaScript doesn't. JavaScript has stuff that Scratch doesn't. In fact, there is NO other existing programming language that Scratch can convert their codes into. Therefore, you won't get your support from me.

Last edited by Charles12310 (Dec. 13, 2017 23:00:37)



A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
MathlyCat
Scratcher
1000+ posts

Scratch to Javascript converter

Charles12310 wrote:

Scratch is not the same as JavaScript. Scratch has stuff JavaScript doesn't. JavaScript has stuff that Scratch doesn't. In fact, there is NO other existing programming language that Scratch can convert their codes into. Therefore, you won't get your support from me.
I recommend to develop a legitimate reason to not support through the process of finding evidence to support points like:

Charles12310 wrote:

NO other existing programming language[s] that Scratch can convert their codes into.

Now as it seems, you clearly have completely jumped to a conclusion as fast as you could. In reality:

1. Scratch is developed in ActionScript, which is itself another programming language Source.
2. The conversion is not impossible, but is an extraneous amount of work. The implementation of such would be interesting and somewhat useful in the future. However, there are other resources that work similar to Scratch, but are indeed based on JavaScript code. (Code.org should have most of these)

Think before you act.
Actions speek louder than words.

hi there fella
EPICPIKAGUY
Scratcher
100+ posts

Scratch to Javascript converter

kittycat841 wrote:

…JavaScript can be hard to learn…

Not really. As a person who knows JavaScript, I’d say it’s one of the easiest languages to learn.

Still, I can kind of see your point. Actually, this could be a future project of mine!
EPICPIKAGUY
Scratcher
100+ posts

Scratch to Javascript converter

MathlyCat wrote:

Charles12310 wrote:

Scratch is not the same as JavaScript. Scratch has stuff JavaScript doesn't. JavaScript has stuff that Scratch doesn't. In fact, there is NO other existing programming language that Scratch can convert their codes into. Therefore, you won't get your support from me.
I recommend to develop a legitimate reason to not support through the process of finding evidence to support points like:

Charles12310 wrote:

NO other existing programming language[s] that Scratch can convert their codes into.

Now as it seems, you clearly have completely jumped to a conclusion as fast as you could. In reality:

1. Scratch is developed in ActionScript, which is itself another programming language Source.
2. The conversion is not impossible, but is an extraneous amount of work. The implementation of such would be interesting and somewhat useful in the future. However, there are other resources that work similar to Scratch, but are indeed based on JavaScript code. (Code.org should have most of these)

Agreed. Also, while it’s true that JavaScript has some stuff Scratch doesn’t, Javascript has everything that Scratch has, and more. JS has:

Basic programming structures (if, while, etc.)
Sound support (though it’s not as simple as scratch)
Pen capabilities (ctx.rect, ctx.lineTo, etc.)
Sensing (microphone, camera, gyroscope, etc.)
Operators
Variables
Lists (arrays)
And Functions are pretty much “more blocks”

It shouldn’t be impossible. Scratch is really basic compared to actual programming languages.
Sheep_maker
Scratcher
1000+ posts

Scratch to Javascript converter

JavaScript can't really display or detect anything by itself, so the converter'll have to output an HTML file instead (with the JS in a script tag and the images and sounds in data URIs, or have the JS in a separate file zipped together with the HTML and images)

Would the converter insert a green flag (+ turbo mode) and stop sign button or would the project run with the green flag clicked automatically on load (and can be clicked again by reloading the page)?

- Sheep_maker This is a kumquat-free signature. :P
This is my signature. It appears below all my posts. Discuss it on my profile, not the forums. Here's how to make your own.
.postsignature { overflow: auto; } .scratchblocks { overflow-x: auto; overflow-y: hidden; }
-ShadowOfTheFuture-
Scratcher
1000+ posts

Scratch to Javascript converter

I thought that Scratch doesn't really convert that well to JS.

<Insert uncreative signature here>









██       ██  ██            ██  ██       ██
██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
██ ██ ██ ██ ██ ██ ██
███ ███ ██ ████ ██ ███ ███
█████████ █████ █████ █████████

“Though the seasons come and go, and sunshine turns to snow, we will always have tomorrow up ahead.”
Khoeckman
Scratcher
1 post

Scratch to Javascript converter

for the if <> then block in javaScript it seems like this:
<!DOCTYPE html>
<html>
      <body>
      <p id="text"></p>
      <script> var x = 5; var y = 10
            if (x < y) {
                 document.getElementById("text").innerHTML =" true"; 
            }
      </script>
      </body>
</html>
The <script></script> thing is an example how i should work.
Enzopig88
Scratcher
5 posts

Scratch to Javascript converter

me too i would love to see a java to scratch and a scratch to java because i fond a emulator of the x86 prossert in java scrpit call pcjs it open source here the link https://www.pcjs.org/ and i want a see what it would look like i scratch and billd of the block and add more feters plz scratch make a convert.
DaEpikDude
Scratcher
1000+ posts

Scratch to Javascript converter

Enzopig88 wrote:

me too i would love to see a java to scratch and a scratch to java because i fond a emulator of the x86 prossert in java scrpit call pcjs it open source here the link https://www.pcjs.org/ and i want a see what it would look like i scratch and billd of the block and add more feters plz scratch make a convert.
java ≠ javascript

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
Botcho_Otkho
Scratcher
1000+ posts

Scratch to Javascript converter

No support at all. Scratch is a programming language by its own, and doesn't have a Python or Javascript version. If you want to program with blocks and then know the code, use Code.org. And what if you make a change with Javascript and Scratch doesn't have that feature, while Javascript has? And, last but not least, Scratch has things that JS hasn't, and JS has things Scratch hasn't.

Last edited by Botcho_Otkho (April 14, 2018 11:24:30)


I see now that the circumstances of one's birth are irrelevant. It is what you do with the gift of life that determines who you are. - Mewtwo
neeb132
Scratcher
500+ posts

Scratch to Javascript converter

jokebookservice1
Scratcher
1000+ posts

Scratch to Javascript converter

neeb132 wrote:

What would be the equivalent of
 
wait () secs
?
Not compatible, I think.
You could do a quick
setTimeout(furtherActions, time);

Or, you could rewrite that with asynchronous functions and promises, and then utilise the “await” keyword to make the actions in the callback appear in a separate statement below the “wait block” equivalent.

Scratch is definitely compatible with JavaScript, for it's implemented in ActionScript, which is a dialect of ECMAScript (and so is JavaScript).
EPICPIKAGUY
Scratcher
100+ posts

Scratch to Javascript converter

Botcho_Otkho wrote:

No support. Scratch hasn't a Javascript version with all blocks translated,and for example,how would you convert a costume or a sound? That's just impossible.

All “Costumes” can be represented by various image formats (e.g. png), which javascript supports. To draw them, you just need a <canvas> element.

Audio is a bit harder, but still doable. Just append <audio> elements to the dom and load in the audio files (e.g. mp3).

I’ve made javascript programs with sound and images. It’s possible.
spraybottle101
Scratcher
1 post

Scratch to Javascript converter

The problem is changing costumes that will be hard but great idea
EPICPIKAGUY
Scratcher
100+ posts

Scratch to Javascript converter

spraybottle101 wrote:

The problem is changing costumes that will be hard but great idea

Changing costumes isn't too hard either.

On the javascript game I'm working on right now, each object has a variable called “fill” that dictates its “costume”.

To change the fill, I do something like this:


this.fill = imageOne;
this.fill = imageTwo;
PuffballYoshi
Scratcher
2 posts

Scratch to Javascript converter

kittycat841 wrote:

Oh, hello!
I'm here to discuss a new feature that should be added to Scratch: A Scratch to Javascript converter!
Now, you may be thinking, how would this be useful?
I'll tell you why.
There are other applications out there, and most of them use JavaScript. JavaScript can be hard to learn, so why not make a converter? Then, Scratchers can take their project and put it into another application. This would make things a lot easier for scratchers.

Well?
I'm not keeping track of Supporters this time, so PLEASE give reasons why it should or shouldn't be added into Scratch.
Thanks for reading this.

I Think So
EPICPIKAGUY
Scratcher
100+ posts

Scratch to Javascript converter

Well, dang.

Someone already made one!

It's called phosphorus.

Here's the link

Powered by DjangoBB