Discuss Scratch
- Discussion Forums
- » Announcements
- » Scratch 2.0 Offline Open Source Code!
- drmcw
-
1000+ posts
Scratch 2.0 Offline Open Source Code!
Yep saw both those!So who will be first to up the clone limit or remove it?
Oh, that one looks easy enough…
In src/primitives/Primitives.as:
public class Primitives {
private const MaxCloneCount:int = 300;
…
One of the first things I'd be happy to do would be:
public function keepOnStage():void {
// removed everything from here…
return;
}
- shadow94
-
11 posts
Scratch 2.0 Offline Open Source Code!
cooolllll!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!





- shadow94
-
11 posts
Scratch 2.0 Offline Open Source Code!
great………………………!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


superb



superb
- FlowOS
-
100+ posts
Scratch 2.0 Offline Open Source Code!
https://github.com/LLK/scratch-flashNice! Now we can make modifications if we want to (but I guess you'd have to be pretty savvy We've open sourced the Scratch 2.0 editor code! You can find the code in the following repository on Github,
Scratch On!
Eric

- griffpatch
-
100+ posts
Scratch 2.0 Offline Open Source Code!
Woah, excellent! Never done anything with Flash/ActionScript before, but maybe I should have a go. (Oh for more hours in the day…)
After a quick scan through, I can already see a number of simple things that might be worth doing.
e.g. some basic checks to prevent unnecessary work if the new direction/size are same as previous:
public function setSize(percent:Number):void {
…
var newscale = Math.max(minScale, Math.min(percent / 100.0, maxScale));
if (scaleX == newscale) return;
scaleX = scaleY = newscale;
…
public function setDirection(d:Number):void {
…
d = (d > 180) ? d - 360 : d;
if (direction == d) return;
direction = d;
…
clearCachedBitmap(); <— will adding this deal with the rotated sprite touching bug…?
updateBubble(); <— also note that speech bubble should change when rotated
}
Would above really ‘just work’ in the way I think, or am I missing something…?
I second that! I also saw the potential for not re-rasterizing costumes when they are not rotated or scaled… Would be excellent, and would save a few lines of script every time I change costume to manually do the check

- griffpatch
-
100+ posts
Scratch 2.0 Offline Open Source Code!
Whoa! Custom reporters!![]()
![]()
-Certainly looking forward to those. Was wondering how the actual “report” might work…
Nice to see the speech bubbles for reporter values also making a comeback.
(Oh, yes, and a bugtracker, too…)
I saw the screenshot of those too a couple of days back… They looked awesome! But if got me thinking that you still need local variables within custom blocks to really make use of recursive calls. Also, I often want to return more than one value from a custom block, so it might not make a huge difference to me after all. The bug fix around set var and change var always missing their caches interested me a lot… I wonder if that will speed things up some. I do wish that list manipulation could be sped up though.
- TheLogFather
-
1000+ posts
Scratch 2.0 Offline Open Source Code!
Yeah, that'd also help the variable creep considerably. Been wondering for a while how such a thing might be able to work/look UI-wise, though… local variables within custom blocks…
True, although, as they (don't quite) say, one head is better than none! Also, I often want to return more than one value from a custom block, so it might not make a huge difference to me after all.
I think list manipulation doesn't seem too bad, until they start to get long (tens of thousands of entries), and then delete/insert/replace operations become quite prohibitive. The bug fix around set var and change var always missing their caches interested me a lot… I wonder if that will speed things up some. I do wish that list manipulation could be sped up though.
However, adding to a long list isn't so bad, meaning it actually ends up being considerably quicker, if you want to insert/replace/delete a lot of items, to copy everything to a new list, adding/not-adding the replaced/inserted/deleted items where appropriate, and then delete the whole of the original list and copy everything back into it from the fully reconstructed list. Bizarre!
I did have a hunt around to see about optimising the costume switch (so it does nothing if it's the same costume). There does appear to be some optimisation for that already: I second that! I also saw the potential for not re-rasterizing costumes when they are not rotated or scaled… Would be excellent, and would save a few lines of script every time I change costume to manually do the check
public function showCostume(costumeIndex:Number):void {
...
var c:ScratchCostume = currentCostume();
if (c == lastCostume) return; // optimization: already showing that costume
...
}

However, running some tests does indeed show that switching to the same costume is significantly faster than switching to a different costume these days (not sure when that happened?) Curiously, though, it's definitely nowhere near a no-op - it is still a significant fraction of the full switch time. I'm not sure yet where it's losing that…
Maybe this change is enough:
public function showCostume(costumeIndex:Number):void {
if (isNaNOrInfinity(costumeIndex)) costumeIndex = 0;
var newIndex = costumeIndex % costumes.length;
if (newIndex < 0) newIndex += costumes.length;
if (newIndex == currentCostumeIndex) return; // <--- optimise: already this costume
currentCostumeIndex = newIndex;
...
From what I've So… who can find and fix the Chrome pepflashplayer keyboard lag issues now!seen elsewhere, I think this has a lot to do with Flash itself, and gets particularly hit by Chrome's implementation for some reason. It seems to be to do with not leaving Flash sufficient time to do its private event processing between frames/refreshes.
I did wonder if this could have some relevance, though:
public function stepThreads():void {
startTime = getTimer();
var workTime:int = (0.75 * 1000) / app.stage.frameRate; // work for up to 75% of one frame time
...
OTOH, I don't know if above makes any difference at all for non-refresh script…
Last edited by TheLogFather (May 14, 2014 11:18:02)
- SeaRider
-
2 posts
Scratch 2.0 Offline Open Source Code!
That sounds cool

move () steps
say [yay]
change [ v] effect by (25)
- nathanprocks
-
1000+ posts
Scratch 2.0 Offline Open Source Code!
I just seen this in a Code Project newsletter email. I might check it it tomorrow. I can't wait to see some awesome 2.0 mods!
- jonigiri
-
23 posts
Scratch 2.0 Offline Open Source Code!
thanks to the scratch team and everyone who has supported me! i would like to say thank you to fishey2001 because he gives me lots of inspiriation for projects!
- tcodina
-
500+ posts
Scratch 2.0 Offline Open Source Code!
Oh, cool! Is that action script? Well, I know some action script, so I could have a peek at the code if I had time
Awesome job! 


- jonigiri
-
23 posts
Scratch 2.0 Offline Open Source Code!
just a quick comment to say thank you but thank you to everybody who has remixed my projects and the scratchers who follow me. everybody who has inspired me to do a warriors project 

- EmeraldDaffodils
-
100+ posts
Scratch 2.0 Offline Open Source Code!
Great! I'm only 10, so I can't code :p (apart from Scratch!) but I'll check it out all the same!
- Discussion Forums
- » Announcements
-
» Scratch 2.0 Offline Open Source Code!