The month of December has seen the addition of some exciting new features to Kojo.
To begin with, we had Pictures. To use Pictures, kids make simple shapes with turtles, and then convert these shapes to Pictures. They can then combine pictures to come up with composite Pictures, which can be used as building blocks for further composition (and so on). Pictures can be combined using two different mechanisms:
- A Picture building DSL (which is a Declarative API).
- Good old Functions.
Transformations like translation, rotation, scaling, and flipping are available during the picture building process.
This was followed by customizable unit lengths (centimeters, inches, and pixels) and local picture axes – to enable kids to make complex picture objects using rational number lengths and a nice visual reference frame (the local axes) within which transformations like translation, rotation, and scaling can be applied.
And now, with this release, we have the ability to make realistic animations and games using Pictures. This is supported by the following features:
- Collision Detection.
- Vectors for specifying speeds and directions.
- Fine grained definition of animation behavior via act methods for Pictures.
- Gradient Paints for colorful backgrounds.
- Commands to easily set the canvas background color.
- Better keystroke handling.
- Better support for MP3 playback.
Here’s a sample game that shows most of these features in action.
To run the game:
- Copy the game script over from the above link and save it to a file called game.kojo on your computer.
- Copy the background music file from here: http://kojo.googlecode.com/files/Cave.mp3, and save it to the same directory as the game script.
- Open the game script within Kojo, and run it.
Update – the game uses a unit length of centimeters. If you run other Kojo examples after running the game, they will look blown up. To revert to default behavior, run this command: setUnitLength(Pixel). The next version of Kojo will automate this.
As always, the new version is available from the Kojo Download Page.
Enjoy! And let me know if you run into any issues. Suggestions for additional features in the Game/Animation API are also welcome.