It's been a grueling 7 weeks. My son was initially talking to some of his classmates about him learning how to write computer games. Talking to one of the moms (Lisa L.), she suggested that maybe I could offer to teach the same to some of the kids at school. Well, to make the story short, I agreed to give it a try. After going through all of the pre-requisites to become a volunteer (Protecting God's childrens seminar, finger printing, etc.) I was finally slated to start teaching kids how to write computer games.
I have chosen Kids Programming Language for its ease of use and fun approach to programming. In the beginning, discussing with Mrs. Frecker (Computer Teacher) about the target audience, we decided to open it to students from the 4th to the 8th grade on a first-come-first serve basis. So we open it to the first 35 kids that sign up (there are 35 computers in the computer lab). To my surprise, we had over 20+ signed up by the end of the first day after the invitation flier went out...!!
This was an after school activity so all of the logistic were worked out by the wonderful Mrs. Frecker and the help of Ms. Taylor. I got the list of kids and the spread of ages was very large. Using this information, I came out with a temptative schedule that would try to fit all of them, and at the same time get the concept across.
The schedule was:
- Get familiar with KPL interface (Hello world..!)
- Get familiar with KPL.
- While Loop
- Sprite animation
- 2-player mode interaction
- Interacting with background
How to introduce KPL to kids? Well KPL's interface is just like VStudio 2005.
It is all structured in one single file. All programs start from the MAIN routine. It even has intellisense.!
The assignments that I gave the students were nothing more that scavenger hunts. I modified the original games and added new functionality. I then proceed to delete some of the code and have the students follow instructions to find where the missing code was, and to type the code back in.
The purpose for this approach, was that they would get familiar with moving around the KPL interface and typing code. Fortunately KPL is not case sensitive. However, kids very soon discovered that spaces and "_" are not the same. ;D
They (Morrison Schwartz) did an excellence job at making KPL very simple to write games. Once you pass the intellisense and the the VB-like syntax, then loading a sprite and animating it, is just as easy.
Explaining the concept of multiple frames in a single sprite
To get this sprite to animate, this is the code needed:
Handling User input is very straight forward:
As you can see, there are already constants defined.
Sprite intersections and IF-THEN-ELSE logic. To explain the IF-THEN concept, I've used a very useful system function called SpritesIntersect. This function takes on the name of 2 sprites and return True/False if they are touching at any point. This function makes it very easy to explain graphics collision without getting into all of the calculations behind. The code that I used to explain this logic was:
it was not very hard to see their faces *clicking* right away with this concept.!
- Kids can't type that fast: To this end, by week 5, I start dividing the labs into 2 parts. One that was mandatory, and a *bonus* section. The mandatory was for them to learn the main focus I was trying to convey. The Bonus section was for those advanced enough that wanted to get some more functionality.
- Keeping kids attention is hard.! I discovered very soon, that some of the kids did not wanted to do the labs. Instead they just wanted to go on their own and change the program and the sprites by themselves. This was probably the most difficult part to handle. Specially, since I had a wide range of ages in the class. So I spent a couple of hours every night prior to the class, customizing some of the games that came with KPL. For instance, the racing cars. I had modified it in such a way, that after you typed in your assigment, there will be a *cheat* code that will allow your car to be driven at 3x the speed of the other cars. So while you could play the original racing car, there was an incentive to do the lab, so that you can get the extra capabilities.
In average, I have spent close to 3hrs every night for the past 7 weeks just to prepare the labs and the concepts. However, at the end of week 4 my hard work was finally rewarded. While waiting for some of the students to ask for assistance in finishing the lab. We saw a couple of students from the 4th grade making changes to some of the KPL original games. It was just awesome to see them moving around the program with confidence. Initially, they were afraid of changing anything. However, by now they are changing the sounds, colors, words, sprites, sizes, scales, etc.
Hours spent volunteering programming classes: 7.0 hrs.
Hours spent becoming a volunteer: 6hrs
Hours preparing for classes: 20+ hrs.
Time spent discussing how to write a computer game with 10-to-14-year-olds = priceless...