If you ask me how to improve the programming skills of Scratch, I would recommend two methods. One is to read and analyze the well-designed Scratch projects, and the other is to remix the projects written by others. When we are remixing the existing Scratch projects, we would not only understand the code better, but also identify the issues and think out ways to solve them.
In this post, I will analyze an interesting project and then remix it to enhance its functionality. What it does is very straight forward. It identifies the silhouette of a sprite and then prints its silhouette on the stage, kind of like what the scanner and printer do.
The original version: https://scratch.mit.edu/projects/397091282/
The remixed project is like this: https://scratch.mit.edu/projects/406556432/
The structure of the project is not complicated. There are three sprites and I will introduce them one by one.
Scratch Cat Sprite
In the original project, this sprite displays an image of the Scratch cat. When arrow keys are pressed down, the sprite could move to the direction where the arrow keys are indicating.
In the re-mixing version, I adjust the following aspects:
- Add several costumes for this sprite, so the sprite could change costume when mouse clicks on it.
- Remove the code of handling key press of Up, Down, Left and Right.
- Allow the dragging of the sprite. When dragging is done, the scanner and projector sprites begin rendering.
- Make this sprite broadcast a message to begin rendering process.
The Scanner sprite is responsible for scanning the Scratch Cat sprite and stores its silhouette information in a Scanner list. The key issue in the original project is that it creates multiple clones to mark the scanned position, but does not delete the clones in time. The program could not work properly when too many clones exist simultaneously, which might be due to the memory limitation of the program. I guess that is why the author only sets a 10*10 scanning grid. When exceeding this precision, the scanner clones just could not work.
In the remixing project, I worked around this limitation:
- Use Stamp block (from Pen extension) to mark the scanning position, so the clones only need to exist for a very short time and could be deleted soon.
- Increase scanning precision by reducing the sprite actual size and increasing the grid size.
This sprite is used to show the enlarged pixel silhouette in the left blue frame. The code structure is very similar to that of Scanner sprite. In the original project, the scanning and projecting are done sequentially. However, there is much more data in the remixed project since I increased the grid size from the original 10*10 = 100 to 60*60 = 3600 data items. If I continue using the sequential way, it could be a bit too long for the player to wait for the final projected silhouette.
In the remixed project, the Projector sprite still responds to the same event of “when I receive scanning”, but waits for an extra 3 seconds. It is to ensure that Scanner list has been filled partially by Scanner sprite, so that the Projector sprite clone could begin to read the data. The effect is that projection could almost synchronize with scanning.
That is all for the remixing project. There are lots of remixing projects on the Scratch website (https://www.scratch.mit.edu). However, if you do not want to wait for others to have interest in your project and remix it, you could choose to enroll into our paid program: Professional Advice on Your Scratch Project. Enjoy the one-on-one analysis, commentary and remixing of your project and improve your programming skills right now!
More information about this paid service, please visit this page for detailed introduction. Anyway, don’t forget to enjoy the coding and have fun!
Note: All the analysis articles are copyright products of http://www.thecodingfun.com. Anyone re-posting them should credit author and original source. Anyone using them for commercial purposes or translating them into other languages should notify TheCodingFun and get confirmation first. All Rights Reserved.