Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » Water Ripple effect from Scratch 1.x
- NoMod-Programming
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
I decided to delve back into the old 1.x days of Scratch (back when it ran on Squeak), and thought about looking into the “Water Ripple” effect and why it didn't work. According to the Scratch Wiki:
Well, looking into the source, I noticed that out of bounds reads and writes were occurring within the following lines of code:
If you didn't notice the issue, it's the <= comparison used for checking that the variable “q” is between 0 and (width * height). Because arrays bArray and aArray are 0-indexed, though, the last element, at width * height, doesn't exist. So the code crashed every time it tried looping over the final element. The fix to this, therefore, was to replace the <= comparison with the < operator, such as in the following snippet:
That one character fix gets the “water ripple” effect working (after recompiling the plugin), and it can be seen in the following gif:
There was also a water ripple effect, which crashed Scratch due to the system not having enough memory
Well, looking into the source, I noticed that out of bounds reads and writes were occurring within the following lines of code:
for (q = 0; q <= (width * height); q += 1) { temp = bArray[q]; bArray[q] = (aArray[q]); aArray[q] = temp; }
If you didn't notice the issue, it's the <= comparison used for checking that the variable “q” is between 0 and (width * height). Because arrays bArray and aArray are 0-indexed, though, the last element, at width * height, doesn't exist. So the code crashed every time it tried looping over the final element. The fix to this, therefore, was to replace the <= comparison with the < operator, such as in the following snippet:
for (q = 0; q < (width * height); q += 1) { temp = bArray[q]; bArray[q] = (aArray[q]); aArray[q] = temp; }
That one character fix gets the “water ripple” effect working (after recompiling the plugin), and it can be seen in the following gif:
- Maximouse
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
Interesting! Someone should correct the wiki article then.
- Jeffalo
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
imagine how different scratch might have been if they didn't mess that up.
for compatibility i'm guessing they would keep the water ripple effect… which might have changed a lot of things. we might have had more advanced effects and stuff. wow!
for compatibility i'm guessing they would keep the water ripple effect… which might have changed a lot of things. we might have had more advanced effects and stuff. wow!
- CatsUnited
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
I could see a lot of people using this in their projects as imagine how different scratch might have been if they didn't mess that up.cool glitch effect woah
- FunE552
- Scratcher
8 posts
Water Ripple effect from Scratch 1.x
i found a project called instant scratch crasher that contains a block that is an effect set that has the option chosen for water ripple effect, it does nothing but is a cool relic and i put it in my backpack so i always have id
ps: i am not lying go there right now
ps: i am not lying go there right now
- ninjaMAR
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
Cool! I hope the ST sees this and re-adds it
- Raihan142857
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
Haha, the ST never adds anything. Cool! I hope the ST sees this and re-adds itAlso why did @FunE552 necropost thats not cool
- CatsUnited
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
Also why did @FunE552 necropost thats not coolbecause it is cool?
- nekoender
- Scratcher
100+ posts
Water Ripple effect from Scratch 1.x
I'm using the system browser thing in 1.x to fix it. where is this line of code?
for (q = 0; q <= (width * height); q += 1) {
temp = bArray[q];
bArray[q] = (aArray[q]);
aArray[q] = temp;
}
- Maximouse
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
It's in I'm using the system browser thing in 1.x to fix it. where is this line of code?a plugin, so you can't change it in the editor itself.for (q = 0; q <= (width * height); q += 1) {
temp = bArray[q];
bArray[q] = (aArray[q]);
aArray[q] = temp;
}
- flyingtrain322
- Scratcher
21 posts
Water Ripple effect from Scratch 1.x
Is there any way to use the plugin file or does it do it automatically?
- RSITYTScratch
- Scratcher
100+ posts
Water Ripple effect from Scratch 1.x
Don't necropost. Is there any way to use the plugin file or does it do it automatically?
- ScratchCatHELLO
- Scratcher
1000+ posts
Water Ripple effect from Scratch 1.x
Don't necropost. Is there any way to use the plugin file or does it do it automatically?
I don’t think it’s possible to necropost in Advanced Topics.
- Andricxa
- Scratcher
94 posts
Water Ripple effect from Scratch 1.x
new effects
change [water ripple v] effect by (25)
change [blur v] effect by (25)
- tyson4621
- Scratcher
29 posts
Water Ripple effect from Scratch 1.x
set [WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW v] effect to (WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWw)just use that
- Discussion Forums
- » Advanced Topics
- » Water Ripple effect from Scratch 1.x