Manual

CodeMotion is designed to be self-explanatory. If you just start it up and begin reading and doing exercises, it will introduce you to the features of its interface as you need them.

However, sometimes a manual can still be a nice thing to have. Reading up on a program before you start using it makes you feel a lot more in control. Plus, if you forget how to do something, you might not remember what module you need to go back to to see the description of how to do it. This manual exists to give you all the information you need about using CodeMotion, all in one place.

Creating a user

When you run CodeMotion for the first time on a new computer, it will ask you to set up a place to store your user settings. CodeMotion automatically saves all the programs that you work on, so that you don't need to worry about managing all those files. You can run CodeMotion without setting a user, but then all your progress will be lost when you quit.

The text view

Most of the CodeMotion window is taken up by the text of the module you are currently working on. This is designed to read like a textbook, but an interactive one, with runnable examples embedded in the text.

You should run each example as you come to it and watch carefully what it does. After all, the best way to learn how a program works is to observe it in action. Most computer programming textbooks devote huge amounts of text to explaining how you ought to imagine a program running. With CodeMotion, you don't have to imagine; you can directly observe. This not only saves a lot of reading, it also makes it easier to understand.

Examples are embedded in a "code box" that looks like this:

The tabs at the top allow you to choose one of many examples. Most of the tabs will have a "play" button that allows you to run that program. While the program is running, this button turns into a "stop" button, in case you want to stop the progam before it finishes.

Other program controls

There are other controls for program running that appear in the middle of the left side of the window. The pause button allows you to pause and then resume the program. The button next to it is the "step" button; it moves the program forward just one step and then pauses it again. With more complicated programs, it is often heelpful to go through the program one step at a time and make sure you understand what is happening in each step.

There is also a speed control next to the pause button. If you feel overwhelmed by how much is going on in the program, going step by step is probably a better solution, but you can also slow down the speed instead. When the slider is set to the fastest speed, programs will run almost instantly without letting you see what is actually happening in the program. This is useful for running a program that should react promptly to events.

The canvas

Most programs that you will write and read in CodeMotion are designed to draw things on the canvas. This is the blank area in the top right of the CodeMotion window. The canvas has a coordinate system where the top left is (0, 0) and the y coordinate increases as you go down the screen. To help you identify positions on the screen, you can turn on the grid and rulers using the View menu.

The canvas also provides tools to allow you to draw shapes on the canvas with the mouse. Often an exercise will ask you to write your answer in this way. You can turn on the shape palette also using the View menu, and then you can click on a shape type and click and drag on the canvas to draw. Most of the shapes have both a filled and a framed version; you can switch between them by clicking the button again.

When a shape is first created or is later selected, little circular "handles" appear on part of the shape that can be adjusted, such as the corners of a box or the start and end of an arc. You can click and drag one of these with the mouse to adjust it.

The middle tool on the palette is the selection tool. It allows you to click and drag a box to select multiple objects, or to just click individual objects to select them. You can add and subtract objets from the selection by holding down the shift key as you select them. You can also copy the selected objects by holding down the Alt key (Option, on a Mac) while clicking and dragging an object.

The remaining tools are color tools. Black, red, green, and blue are the colors you will use most often, and so have their own buttons; all other colors can be chosen with the color wheel button. The color wheel button can also be used to examine the color of the selected object.

By default, all drawing you do will "snap" to the ten-pixel grid, and all angles will snap to thirty degree increments. This is to make it easier to correctly answer the exercises, which only use objects on that grid. If you like, it is possible to turn off this option using the View menu.

The module view

The last part of the main CodeMotion window is the module view, in the lower right. This allows you to see your progress through the current unit, as well as to see where you are trying to get to.

Each of the boxes shown in here is a "module", a lesson covering one particular topic. The modules go roughly in order from top to bottom. Often there is a choice of which path you want to follow first, but eventually you will have to do all the modules to complete the unit.

Modules will appear in one of three colors. Grey means that you do not yet have access to that module. Red means that that module is unlocked, but not yeat completed. Once you complete teh module, it will turn green.

Modules are unlocked by completing some required amount of exercises in other modules that they are dependent on. For example, since the Compound Objects module is teaching a more advanced version of what you did in Object Creation, you need to make a certain amount of progress in Object Creation before you can move on. The arrows that you see linking modules show that one module is required for another. When that requirement is met, the arrow will turn green.

It is up to you whether you want to always complete all modules, or just do enough to unlock the next one. You will probably learn better if you take the time to practice more, but if you are impatient to learn new things and are sure you understand what's going on, you can usually skip a number of exercises and still get enough done to unlock what you need to.

If you ever want to see how much progress you are making in the current module, you can click on it again and a window will pop up that allows you to see the names of all the stars you have earned, as well as a list of how many stars from this module are needed to unlock each later module. This is the same window that shows up when you complete an exercise. You can click on a star to jump to that exercise in the text.

Other features

A big part of learning to program is just getting used to the various types of objects you are working with. For example, if you want to draw rectangles on the screen, there are particular instructions for creating and moving them. The Library feature in CodeMotion gives you a concise way to see all these capabilities.

You can open the Library from the View menu. In it, you will see a list of all the object types available to you, sorted by what "package" they belong to. The list is daunting, to say the least - most programmers only know a few percent of the objects types in it - but that's why you have a library, so that you don't actually have to memorize all that information.

It is possible to "cheat" in CodeMotion if you really have to. This is generally a dumb idea, since the goal is to learn, you're not being graded on how many exercises you do, and skipping anything will hurt you in the long run. But there may be legitimate reasons to want to get around the module locking. To force CodeMotion to load a module whether it is locked or not, shift-click the name. Alternately, you can edit your user file to award yourself stars: to figure out how, do some of the exercises in a module, then open "user.xml", in your user directory, in a text editor, and stare at it until inspiration strikes.