Draws the projectile. Required for Drawable interface. @param drawingPanel @param g
(DrawingPanel drawingPanel, Graphics g)
| 81 | * @param g |
| 82 | */ |
| 83 | @Override |
| 84 | public void draw(DrawingPanel drawingPanel, Graphics g) { |
| 85 | int xpix = drawingPanel.xToPix(state[0]); |
| 86 | int ypix = drawingPanel.yToPix(state[2]); |
| 87 | g.setColor(Color.red); |
| 88 | g.fillOval(xpix-pixRadius, ypix-pixRadius, 2*pixRadius, 2*pixRadius); |
| 89 | g.setColor(Color.green); |
| 90 | int xmin = drawingPanel.xToPix(-100); |
| 91 | int xmax = drawingPanel.xToPix(100); |
| 92 | int y0 = drawingPanel.yToPix(0); |
| 93 | g.drawLine(xmin, y0, xmax, y0); // draw a line to represent the ground |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | /* |