This week has been quite busy at work with finishing report cards and all the end of the year assemblies and activities. Just 4 teaching days and 1 PA day to go.
On to my CCOW activities this week.
Cumulative Activity: Games: In this week’s “big project”, you’ll develop a game — a Scratch project that includes interactions between sprites, score, and levels.
I was quite excited to try coding a classic pattern game like Simon. I also wanted it to be a bit of a musical primer so I based the tones on a pentatonic scale. The game does not have overt scores or levels but it does change in difficulty and speed as the pattern gets longer and longer. This game is a classic. Simple enough to need no instructions other than “Follow My Song”, but difficult enough to keep people wanting to play it more.
My imagination kept introducing `feature creep’ with ideas like making alternate costumes for the sprites like piano keys, guitar frets and flute and trumpet fingerings, and making a standard set of variables so that I could code a kind of framework or API to make music games using scratch. In the end, it was enough of a challenge just to try to make compact, simple code to show the sprites, change their colors, and detect key presses and see if they match a pre determined pattern. I ended up making 8 almost identical sprites (one for each note in a major scale). I am pretty sure I could have done this using lists, multiple clones of one sprite, and variables to change the color and tone of each sprite. In the end it was just easier to duplicate 1 sprite 8 times and change the code for each individual note.
Somewhere between the keypress and my broadcast to check it against the random list of the computer’s pattern, a glitch appeared in that it does not call game over until one press after you make a mistake. Thus if you make a mistake on the last note of a pattern, you get to go to the next level. I have not figured out how to solve it because I can’t find the error in my reasoning or in my code to check the pattern.
One of my third grade students told me that I should just say that this is part of the game, because it is fair to give people 2 chances. I think I’ll stick with her answer, although the glitch is still bugging me.
I have not had alot of time to flesh out my thoughts, but I’ve been thinking about how much Illych’s article on education webs foretold what we are doing here. We have a MOOC with over 1900 members, from all over the world. We are the self selected peer group, the facilitators are expert support. We have wikipedia, coursera, and quick access to almost all academic literature, books, and media throughout history at our fingertips. I think Illych would have quickly grasped the possibilities of the Internet for self-directed learning. How else does our experience in this course resemble what Illych was describing?
- I made a post with this week’s Debug it activities on Sunday.
- Levels— I read through this activity and but did not do the assignment of looking for different ways people code levels using scratch. I think I have a good handle on different ways to have levels in games with increasing speed, increasing difficulty, a change of scene or more adversaries with greater skills.
- Score: In this activity, we needed to remix Fish Chomp by adding a score using variables. Here is mine:
I added a countdown timer to make the game last for 60 seconds, and gave one point for each fish caught. I also added a global High Score Variable stored in the cloud. That means that you can compete against other scratchers for world bragging rights.
I added a Start Game broadcast for the purple fish because for some reason I had to press the green flag twice to get them to move and react with the yellow fish. It didn’t do that in the sample code, so I think it was something to do with my timer code or my if-then-else blocks.
Questions: What is a variable? A variable is a letter or name that can have a “variety” of values. Its value can vary.
How would you explain variables to young learners? I think that giving variables literal names like ‘score’ and ‘time-left’ can help them to make the connection between what is going on in the game and the idea of variables in math class. I think the first time the concept of variables really clicked for me was when I was 12 or 13 and learning to program simple games in BASIC. I think the same thing could happen using SCRATCH with young children.
- Questions: Which puzzles did you work on?, What was your strategy for solving the puzzles? Which puzzles, if any, helped you think about your game project?
I got cute and tried to do them all in one project. This was actually more difficult because some of the activities interacted with the others, creating more complexity. After about 2-1/2 hours, I stopped with about 6 of them done. Below each task I reflect on how I did it and answer the questions.
- Whenever you press the B key, the sprite gets a little bigger. Whenever you press the S key, the sprite gets a little smaller. This was pretty straightforward. I programmed the cat to grow and shrink with these keys, and made it move with the arrow keys.
- Whenever the sprite hears a loud sound, it changes color. I did not do this one, but I have a pretty good idea how I would do it with the sensing blocks.
- Whenever the sprite is in the top 25% of the screen, it says “I like it up here.”
I made a sloping background and had the cat say this above about y 100. The hardest part of coding this was the code to make sure the characters could not walk into the sky. I did this with a `not touching green statement` so that it would also not walk through other sprites.
- When the sprite touches something blue, it plays a high note. When the sprite touches something red, it plays a low note.
I did not code this one either.
- Whenever two sprites collide, one of them says: “Excuse me.”
- Whenever the cat sprite gets near the dog sprite, the dog turns and runs from the cat.
I had the dog move towards the cat then turn a 180 and move back 50 steps. It fulfils the task but makes for a yo-yo frenetic effect.
- Whenever you click on the background, a flower appears at that spot.
I used clones of one flower sprite. When the stage is clicked it chooses a random color and size. I also had a random location, then changed it to the position of the mouse pointer as per then instructions.
- Whenever you click on a sprite, all other sprites do a dance.
I did not do this, but I think I was going to do a loop with the whirl effect forward and back on the flowers. I did end up using this technique with a looks block in my `Follow my song` game the next day so thinking about this challenge helped.
- Whenever you move the mouse-pointer, the sprite follows but doesn’t touch the mouse-pointer. At first I had the cat then the dog follow the mouse pointer, then I added the butterfly because it was tricky to add this code along with the other things I had the cat and dog doing.
Random Coding Fun
Last week, the facilitators introduced a change to the process of submitting and reviewing design notebooks. Now we just need to submit the link to our design notebook (or noteblog), then choose peer notebooks ourselves from a numbered list of all the submitted notebooks for the week. One of the participants on the forums requested a way to choose a random notebook on the forums. kb8ywp used SCRATCH to code a perfectly useful, but visually plain Random Notebook Number Generator
On a whim, I remixed it to add a bunch of randomly placed notebooks, and included a cloud variable which remembers when someone enters the number of notebooks for the week, so you only need to re-enter that number if it has changed. My changes were mostly cosmetic, and not needed, but it made for a fancier Random Notebook Number Generator remix.
Here it is nearly midnight on a Friday night. I think my CCOW week 3 is finished. I`m looking forward to the next three weeks and my self-directed project, but I still have no idea what that might be. I`m sure something will come to me. And only one more week of doing both schoolwork and workshop work. Yipee.