Turtlegraphics for Smartphones and Tablets

Bern University of Teacher Education  
HomeStart Online EditorPrintAndroid GamesJava-Online

Serie 9: Touch-events


By touching the display in the draft S9a1 a turtle, that is already able to draw, is created. Change the program so the turtles
a) draw starry formed figures (see drawing a)
b ) draw red coloured 6-sided figures (see drawing b)

To set a red line and fill-colour, the following lines need to be inserted:
To fill the figures, the following line needs to be inserted:
t.fillToPoint(x, y);

c) Use the while(true) -loop to move the turtles on the circle formed blanks.


Edit draft with online-editor







Draw first 7 vertical and 7 horizontal lines, so that a background of 64 areas is developed. With each touch of the display, a turtle that colours the touched area in red, will be created.

As a draft you may use the following example:


Edit draft with online-editor



Substitute in the draft playgroudPressed() with the method playgroundDragged() to program a freehand-drawing-program.


By using the method fillToPoint() filled-figures can be drawn.

Edit draft with online-editor