
How will we do our truck to run?
A design, an object in the Squeak world has a position defined at the Cartesian axises : X and Y.
We will design a new object (at a new layer) : the designed button you are seeing in the figure.
It is an Squeal object like others and, opening its Viewer, we will change its name to "Ahead" and open a Script glued to it.
Like we will use the object "Truck" (the name we have assigned for our truck) we drag any line of the Viewer of Truck to the script of the button.
The program is very simple. Remember to "accept" it! When it runs it will execute:
Truck setX := Truck getX + 1.
To run the program we open the Menu clicking in the area after the clock. The menu: "When this script run". We will choose: "mouseStillDown". This means that: when we remains with the pointer over the button (the designed button) and the left button down, the program will run in loop!
Very easy. Try the demo. Look the "layer thing". Try to create a new truck...
PREVIOUS LESSON NEXT LESSON T. CONTENTS HOMEPAGE
