Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Leopard: Edit Scratch projects as JavaScript code
- Pr_Testing
-
Scratcher
8 posts
Leopard: Edit Scratch projects as JavaScript code
PullJosh how are u so clever
- Remixer56
-
Scratcher
52 posts
Leopard: Edit Scratch projects as JavaScript code
One of my projects did not work: https://scratch.mit.edu/projects/363945491/
- -InsanityPlays-
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
It's called forkphorus not phosphorus now. And btw does it have dark mode?
- BearSlothCoding
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
It's called forkphorus not phosphorus now. And btw does it have dark mode?No, those are two separate things, Forkphorus is based off of Phosphorus. And Forkphorus has it but Phosphrous doesn't. Also, this is for Leopard, not Forkphorus or Phosphorus.
Yes, I made sure I said both Forkphorus and Phosphorus in each sentence.
- Pr_Testing
-
Scratcher
8 posts
Leopard: Edit Scratch projects as JavaScript code
ur definitely one of em!PullJosh how are u so cleverIt isn't just me!
isn’t it u who thought of the leopard idea? (apart from all ur tutorials which are useful and in depth - u are a clever lad) of course there are loads of ppl out there 
- theXliner
-
Scratcher
83 posts
Leopard: Edit Scratch projects as JavaScript code
Hmm I have a VERY MINOR suggestion:
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
- apple502j
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
Hmm I have a VERY MINOR suggestion:Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.

- DecaTen
-
Scratcher
4 posts
Leopard: Edit Scratch projects as JavaScript code
I've noticed that the trigonometric functions do not take Scratch's 90 degree offset into account.
- theXliner
-
Scratcher
83 posts
Leopard: Edit Scratch projects as JavaScript code
I'm making one right now! It's a private GitHub repo for now. If you have a GitHub account, tell me your username! Then we could work on this together. The thing is, I plan to make it pure python. It is basically scratch-to-pygame.Hmm I have a VERY MINOR suggestion:Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.
EDIT: I also use Atom, so we can use the Teletype ability. I'm also working on parsing the JSON to tokens, so any language can benefit. Psst, I only know python thoroughly.
Last edited by theXliner (July 8, 2020 16:42:15)
- Pr_Testing
-
Scratcher
8 posts
Leopard: Edit Scratch projects as JavaScript code
call it purrrI'm making one right now! It's a private GitHub repo for now. If you have a GitHub account, tell me your username! Then we could work on this together. The thing is, I plan to make it pure python. It is basically scratch-to-pygame.Hmm I have a VERY MINOR suggestion:Maybe I can make it - but let me fix some bugs in parse-sb3-blocks first
Could you make a Python3 API? I mostly code python, and is currently trying to understand Swift & C++. JavaScript/Other languages are on the bottom of my list. So a Python3 API for sh-edit would be nice.

- PullJosh
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
I've noticed that the trigonometric functions do not take Scratch's 90 degree offset into account.Good catch! The issue is actually that the trig functions do use Scratch's directional system when they should use regular degrees (where 0 = right).
I've updated Leopard so that this is no longer an issue.

- Bears8
-
Scratcher
9 posts
Leopard: Edit Scratch projects as JavaScript code
This is great!. I've noticed that some of my projects don't work with leopard. When the code is converted nothing happens and it just remains a black screen. Then when I click “Edit as javascript” it has me download “codesandbox.json”
- BamBozzle
-
Scratcher
4 posts
Leopard: Edit Scratch projects as JavaScript code
Very impressive my guy! Well done! I just want to highlight that this monstrosity doesn't work on it (https://scratch.mit.edu/projects/395414289/) although I don't recommend filtering through all the 4000ish blocks but if youre interested 

- theXliner
-
Scratcher
83 posts
Leopard: Edit Scratch projects as JavaScript code
How does sb-edit work? Which JSON does it get input from? The unzipped sb3 or the project.scratch link? Because I want to fork that JavaScript into return a list of tokens which then anyone can parse.
- Sheep_maker
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
Very impressive my guy! Well done! I just want to highlight that this monstrosity doesn't work on it (https://scratch.mit.edu/projects/395414289/) although I don't recommend filtering through all the 4000ish blocks but if youre interestedIt seems that in Sprite1's Map custom block, it's trying to get item rm of map1, but since rm starts at zero and hasn't yet been changed, it tries to get the length of a nonexistent string item in the list, which throws an error in JS
*map() { this.stage.vars.rm = 0; for (let i = 0; i < this.stage.vars.map1.length + 1; i++) { this.stage.vars.rl = 0; for ( let i = 0; i < this.stage.vars.map1[this.stage.vars.rm - 1].length + 1; // ^^^^^^ // TypeError: Cannot read property 'length' of undefined i++ ) {
I wonder if Leopard will be hip and modern and use the optional chaining operator ?. to avoid this
How does sb-edit work? Which JSON does it get input from? The unzipped sb3 or the project.scratch link? Because I want to fork that JavaScript into return a list of tokens which then anyone can parse.You can use Project.fromSb3 and pass in a buffer of the zipped .sb3 file or Project.fromSb3JSON with the project.json from projects.scratch.mit.edu
Last edited by Sheep_maker (July 8, 2020 19:42:30)
- PullJosh
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
This is great!. I've noticed that some of my projects don't work with leopard. When the code is converted nothing happens and it just remains a black screen. Then when I click “Edit as javascript” it has me download “codesandbox.json”That's interesting.
Could you post some broken project links?- PullJosh
-
Scratcher
1000+ posts
Leopard: Edit Scratch projects as JavaScript code
I updated the first post with this new section called “Upcoming Improvements”.
Upcoming ImprovementsHave I sorted these priorities correctly? I'd love to hear any comments you might have.
Based on the feedback I'm seeing on the forums and in comments, these are the top-priority issues to solve (most important first):
- Sprite layering doesn't work! go to front/back & go forward/backward blocks need to be implemented.
- Projects run too fast! Leopard projects currently run at 60fps, but it should also be possible to slow them down to 30fps.
- If touching edge and if on edge, bounce blocks don't work.
- Lots of little bugs that all add up to cause issues
- Discussion Forums
- » Advanced Topics
-
» Leopard: Edit Scratch projects as JavaScript code