![]() |
||||||
Introduction to programming for young minds
Mad Code shows you how small animations and games are programmed, and lets you try your hand at it. |
|
|||||
![]() |
||||||
When you tap the rabbit on the iPad’s screen, it jumps ahead. The blue panel shows the rabbit’s script. As most scripts in Mad Code, it is simple and uses common English words—except mouseUp, which means tap. There are three rabbit images. You get the animation by hiding and showing them in turn. Move the mouse over the picture to see the beginning of the animation. You can modify blue scripts in Mad Code. Here, you could tell the rabbit to move faster or slower. |
||||||
![]() |
||||||
This is part of a page introducing a powerful control structure, common to all programming languages, that lets you repeat events. Move the mouse over the picture to see the basic event: hiding one image reveals another image behind it. When you tap the drill on the iPad, the event is repeated six times and the drill’s bit seems to be rotating. |
||||||
![]() |
||||||
This example introduces another basic control structure: an event takes place if a certain condition is met. On the iPad, you drag the cab with your finger. The script tells the program to measure the distance between your finger and the left edge of the page (which it calls it) and to set the location (or loc) of the cab to it and 200 pixels, the distance between the top of the page and the orange road. The if… then structure limits the cab’s range: not less than 300 pixels from the left edge, not more than 695. Move the mouse over the picture to see the cab move |
||||||
![]() |
||||||
Another kind of animation. The objects on a page—images, text fields, buttons—all belong to their own layer. Here, six images are stacked at the same location. The script brings each of them in turn to the top layer. Move the mouse over the picture to see two of the images. Mad Code has sixty pages with examples such as these. It introduces basic programming features: variables, functions, object properties, and so on. |
||||||
|
|
|