Pythagotchi

Learning Objectives

Mystery Egg

An Egg

What will hatch from the mystery egg? Let’s write some code to find out!

First Things First

Before we write some code, we’d better make an egg sprite to display.

Start off in Fireworks with a 16x16 pixel canvas and draw your egg. It doesn’t have to be egg shaped, but it should be suggestive of something that will ‘hatch’. It could be a little cardboard box, or a present with bow. As always, push your imagination. Beat it with a stick to make it give you something interesting if you have to. Once you have an ‘egg’ that you’re happy with, you need to make it 4x bigger.

Make sure your fireworks settings are right or it will look rubbish:

From the ‘Edit’ menu, choose ‘Preferences…’

Nearest Neighbour

Choose ‘Nearest Neighbour’ for the interpolation option, then click ‘OK’.

Next use the ‘Numeric Transform’ option, under the ‘Modify > Transform’ menu to scale your ‘egg’ up to about 400%.

Resize the canvas to fit the new size

You need to save your ‘egg’ as a .gif file, not .png or .jpg because those won’t work for our simple program. The best way to do this is with the ‘Image Preview…’ option in the ‘File’ menu.

Image Preview

Click ‘Export…’ and save your egg image in a new ‘Pythagotchi’ folder somewhere. Call it egg.gif (even if it’s not an egg!).

Ok, now we can write some code. Move on to the next page to find out what.