CLASS OBJECTIVE
Practice the loop and draw_line call using the graph window in Raptor, by creating a given image, using lines and loops.
INTRODUCTION
Today, you'll create two different products, the first with some assistance and the second completely alone.
In the first program you'll have to use a new Call:
draw_line(x1,y1,x2,y2,color)
- x1,y1 are the coordinates for the starting point of the line
- x2,y2 are the coordinate for the ending point of the line
For example, in a 500x500 graph windows we can use the draw_line Call like this:
draw_line(100,50,450,350,blue)
and the result should look like:
INSTRUCTIONS
First program
Now, you'll have to create a program, using lines and loops, to draw a grid like the one in the image.
To draw the vertical lines you have to increase the X value, by 10.
To draw the horizontal lines, you have to increase the Y value, by 10.
Second progam
After you create the grid, now you'll use lines and loops once again to create the next product in the graph window.
Obvioulsy you'll need two variables because while the X value increases, the Y value decreases.
CLASS NOTES
Write down in your notebook the title of the class, the objective and follow the instructions.
- Draw the final flow charts, shown in both Raptor programs.
- Explain the loops structures and the draw_line coordinates.