Sunday, September 2, 2012

Shooter With Joystick


Since it's Labor Day weekend, I had some time to work with my son on game concepts.  I went back to the lesson on pygame.joystick, that my son worked on last year.  So far, we put about two hours into the lesson.  It's a fun, easy and rewarding lesson that uses simple math.  It's also short enough so that we didn't use functions or classes.

The background is a simple static image that doesn't move. The gun sight is also a single image with transparent background enabled. My student didn't develop any targets yet because he went out to a Labor Day BBQ.

Here's the code:

Saturday, September 1, 2012

Matching Game


This is an educational program written by a middle school student, my son.  It was a fairly tough project to tackle for these reasons:

  • The images were more difficult to randomize than we expected;
  • We didn't have a good algorithm to see if the second image had been selected;
  • The program is a bit too long for the intended learning purpose.
In the end, my son used objects.  It's all a bit clunky, but it works. 


I decided to archive the video and code on this blog so that we can see how the student progresses over time.

VPython Revisited and the Problems with 3D Projection


I previously wrote about VPython close to a year ago as a bit of fun eye candy for my student, who at the time was 12 years old.  After a break due to soccer, track, and summer activities, I started to focus on a memory game first and then a racer game.  It took an entire summer of sporadic weekends to finish two games and I feel we bit off more than we could handle.

After the problems with the memory game data structures and the headaches of 3D projection, the videos on VPython were fun and immediately rewarding.   I highly recommend these videos for 11 to 13 year old children.

Unfortunately, I can't recommend 3D projection until they get a bit further along in math.

So, why was 3D projection so tough?

Well, for one thing, complexities of 3D projection were getting a bit too tedious.  I didn't realize this, but my student hadn't studied the z-axis in school yet.  He had covered cross multiplication, but wasn't an expert at it.    The key to figuring out a simple projection method was to  use Louis Gorenfeld's Pseudo 3D page.


The application revolves around this deceptively simple formula.

Y_screen = (Y_world / Z) + (y_resolution / 2)
There are numerous libraries that can handle the 3D calculations for the student.  VPython is super easy to use.  Perhaps we'll revisit 3D projection after my students gets further along in math.

Tuesday, October 25, 2011

Major Languages Used for Teaching and Working


According to Wesley Chun from Google,  the main languages used at Google for production work are:

  • C++
  • Java
  • Python
Main languages used for teaching children are:
  • scratch
  • Alice
  • Visual Basic
  • Python
In this video, Wesley Chun is using video to teach a class to children.  It gives an overview of Google App Engine.  There's also some examples of how Python is used at places like Google and Yahoo.  

for loops


I've been working with my student on for loops.  The concept is taking some time to fully understand.

I spent some of the day researching other teaching guides, including videos from the Khan Academy.

the main python.org site also has a nice list of learning material for beginners that are non-programmers.

The materials that I've looked at and like are:


Friday, October 21, 2011

pygame audio problems

Last night, my student was having problems loading differing audio formats into pygame.mixer.Sound("filename").  We tried mp3, ogg, and wav formats.  After researching this on the web, I found out that other people have this same problem.  I downloaded audacity and saved the audio files as .wav files, even the .wav files that I got from the Internet.  We got the sound to work on Mac OS X and Linux Ubuntu.

The pygame.mixer.music.load() and pygame.mixer.music.play modules seem to be more robust.  We've got Linkin Park playing as the background music.  I recently noticed that the song has explicity lyrics in it.  I need to get my student to change the music.