Sunday, June 03, 2007

Volunteering = Priceless

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:
  1. Get familiar with KPL interface (Hello world..!)
  2. Get familiar with KPL.
  3. If-then-else
  4. While Loop
  5. Sprite animation
  6. 2-player mode interaction
  7. 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.!

Lessons Learned:
  1. 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.
  2. 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...


Aya R. El-Gebeely said...

Actually , your experience and trial to learn kids programming is great,
I'm also doing the same thing, till now i have made two classes, but using a program called roboMind :, just to get their attention and give them the basic concepts of the loops and if then else structures easily, our third class will be using KPL. I have spent a lot of time in collecting images of cars, spider man, football teams , Barbie and flowers to get the attention of both boys and girls.
I think our course is somehow similar as we face the same coincidences.

Hope to share thoughts and any problems you have faced or i may face during my course together..

And by the way course is for free too ..

Best Regards,
Aya R.

Arnulfo Wing said...

Thanks Aya, I will be glad to share the labs and stuff with you. One of the main reason I chose KPL vs the other programs out there is the fact that it can export the code to either VB.NET or C#. Also, it's syntax and functionality is very close to Visual Studio 2005. So that the kids will get familiar with the interface that we use on the real world.

Casey Stamper said...

Wow! Kids nowadays are much more advanced than when I was that age (course, back then it was punch cards, TI-99s, etc.) Introduce them to the Bourne again shell (bash), and you'll have a bunch of new "script kiddies" overnight. :) Good job, man.