Discuss Scratch
- Discussion Forums
- » Questions about Scratch
- » Scratch to Java
- puppygirlroxatart02
-
Scratcher
100+ posts
Scratch to Java
I have a Scratch project that I created that I'd like to figure out how to create a Java script for, but I'm not quite sure how. Here's the link: https://scratch.mit.edu/projects/67636760/#editor (I made it on a side account). If you can help me figure out the corresponding “commands” in Java for each part of the Scratch code, that would be greatly appreciated! Thanks! ^.^
- ChocolatePi
-
Scratcher
1000+ posts
Scratch to Java
It's not that simple.
Java has tons of libraries, other whole programming elements to complicate things. Your best shot is to make a player to play any Scratch project.
Java has tons of libraries, other whole programming elements to complicate things. Your best shot is to make a player to play any Scratch project.
- jvvg
-
Scratcher
1000+ posts
Scratch to Java
If you make the project in Scratch 1.4 or earlier, you can probably make it work in the old Java viewer (though not as a Java program). However, if it's newer, you're kind of out of luck. Also, as ChocolatePie points out, Java is very different from Scratch (I say this being fairly knowledgeable in both) and do not really correspond at all. You would basically have to rewrite your entire project to make it work in Java.
- PrincessPanda_test_
-
Scratcher
1000+ posts
Scratch to Java
http://wiki.scratch.mit.edu/wiki/Porting_Scratch_Projects#SB_to_JAR_.28Java_executable.29
It only works with Scratch 1.4 or older.
It only works with Scratch 1.4 or older.
- djdolphin
-
Scratcher
1000+ posts
Scratch to Java
http://wiki.scratch.mit.edu/wiki/Porting_Scratch_Projects#SB_to_JAR_.28Java_executable.29That does create a Java program by bundling the project and the Java player, but puppygirlroxatart02 was asking how to translate the code from Scratch to Java. If you don't need to see the Java code, this will work just fine.
It only works with Scratch 1.4 or older.
- CatsUnited
-
Scratcher
1000+ posts
Scratch to Java
Java is a text-based langauge, and with any text-based langauge, there aren't any motion, costumes, sounds, pen or sensing blocks. Even though it's just one block in Scratch, it can be a whole library in Java. The people at Oracle (the ones who wrote Java) have a good tutorial here.
- GermaphobicCoder
-
Scratcher
45 posts
Scratch to Java
TRY THIS:
def fib(n):
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
x = 1
while True:
print(fib(x))
if x < 21:
x += 1
else:
break
def fib(n):
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
x = 1
while True:
print(fib(x))
if x < 21:
x += 1
else:
break
- CatsUnited
-
Scratcher
1000+ posts
Scratch to Java
TRY THIS:Please don't necropost. Plus, that's Python, which is the wrong programming language for this situation. Also, what's with the fibonacci sequence?
def fib(n):
a, b = 0, 1
for i in range(n):
a, b = b, a + b
return a
x = 1
while True:
print(fib(x))
if x < 21:
x += 1
else:
break
- GermaphobicCoder
-
Scratcher
45 posts
Scratch to Java
that's Python, which is the wrong programming language for this situation. Also, what's with the fibonacci sequence?
Oops. Sorry about the python.
The fibonacci sequence is the project he made: https://scratch.mit.edu/projects/67636760/#editor
Last edited by GermaphobicCoder (Oct. 16, 2015 23:34:16)
- Harakou
-
Scratcher
1000+ posts
Scratch to Java
Well, that would probably work, but they weren't looking for Python. Plus this thread is pretty old, so I don't think they're still looking for responses. (If OP is still around and wants this open, they can just report it and ask.) Please check the date before posting.that's Python, which is the wrong programming language for this situation. Also, what's with the fibonacci sequence?
Oops. Sorry about the python.
The fibonacci sequence is the project he made: https://scratch.mit.edu/projects/67636760/#editor
- Discussion Forums
- » Questions about Scratch
-
» Scratch to Java