Previous |
Next
More shapes
Let’s draw some more shapes:
//
Right-click to download this codeimport "tagtiles.esp"
main = (
drawShape (Cell (3, 4)) yellow;
drawShape (Rect (1, 11) (2, 2)) green;
drawShape (Line (1, 1) (12, 1)) red
)
If you run this code, you will get the following result:
Let’s have a look at these shapes:
| Cell (x, y) | | The cell at position (x,y) |
| Rect (x, y) (w, h) | | A rectangle at position (x,y), with width w and height h. |
| Line (x1,y1) (x2, y2) | | A line from (x1, y1) to (x2, y2). |
Exercise
Write a program that shows a nice drawing on the TagTiles board. Seperate multiple commands with a semicolon (
;), as shown above in the code example.
Previous |
Next