Exemplo n.º 1
0
 /** Draw the person with current specifications on screen. */
 private void draw() {
   int bh = (int) (height * 0.7); // body height
   int hh = (height - bh) / 2; // half head height
   int hw = width / 2; // half width
   int x = xPosition;
   int y = yPosition;
   if (isVisible) {
     Canvas canvas = Canvas.getCanvas();
     int[] xpoints = {
       x - 3,
       x - hw,
       x - hw,
       x - (int) (hw * 0.2) - 1,
       x - (int) (hw * 0.2) - 1,
       x - hw,
       x - hw + (int) (hw * 0.4) + 1,
       x,
       x + hw - (int) (hw * 0.4) - 1,
       x + hw,
       x + (int) (hw * 0.2) + 1,
       x + (int) (hw * 0.2) + 1,
       x + hw,
       x + hw,
       x + 3,
       x + (int) (hw * 0.6),
       x + (int) (hw * 0.6),
       x + 3,
       x - 3,
       x - (int) (hw * 0.6),
       x - (int) (hw * 0.6)
     };
     int[] ypoints = {
       y,
       y + (int) (bh * 0.2),
       y + (int) (bh * 0.4),
       y + (int) (bh * 0.2),
       y + (int) (bh * 0.5),
       y + bh,
       y + bh,
       y + (int) (bh * 0.65),
       y + bh,
       y + bh,
       y + (int) (bh * 0.5),
       y + (int) (bh * 0.2),
       y + (int) (bh * 0.4),
       y + (int) (bh * 0.2),
       y,
       y - hh + 3,
       y - hh - 3,
       y - hh - hh,
       y - hh - hh,
       y - hh - 3,
       y - hh + 3
     };
     canvas.draw(this, color, new Polygon(xpoints, ypoints, 21));
     canvas.wait(10);
   }
 }
Exemplo n.º 2
0
 /** Draw the circle with current specifications on screen. */
 private void draw() {
   if (isVisible) {
     Canvas canvas = Canvas.getCanvas();
     canvas.draw(
         this,
         color,
         new Ellipse2D.Double(
             xPosition, yPosition,
             diameter, diameter));
     canvas.wait(10);
   }
 }
Exemplo n.º 3
0
 /*
  * Draw the circle with current specifications on screen.
  */
 private void draw() {
   Canvas canvas = Canvas.getCanvas();
   canvas.setForegroundColour(color);
   canvas.fill(new Ellipse2D.Double(xPosition, yPosition, diameter, diameter));
   canvas.wait(10);
 }