龟壳倒是能走,但是脚不能动
import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Toolkit; import javax.swing.JFrame; public class Tt extends JFrame implements Runnable { WG[] wg = new WG[4]; Dimension screen; public Tt() { screen=Toolkit.getDefaultToolkit().getScreenSize(); this.setBounds(0, 0, (int)screen.getWidth(), (int)screen.getHeight()); this.setVisible(true); this.setDefaultCloseOperation(EXIT_ON_CLOSE); wg[0] = new WG(); wg[1] = new WG(); wg[2] = new WG(); wg[3] = new WG(); wg[3].v = 5;// wg[0].x = 110; wg[0].y = 400; wg[1].x = 410; wg[1].y = 400; wg[2].x = 710; wg[2].y = 400; wg[3].x = 1010; wg[3].y = 400; Thread t = new Thread(this); t.start(); } public static void main(String[] args) { new Tt(); } public void paint(Graphics g) { g.fillRect(0, 0, 1366, 768); int j1 = 400; int j2 = 400; int j3 = 400; int j4 = 400; for (int i = 0; i < 4; i++) {// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x, wg[i].y, 70, 100); g.setColor(Color.BLACK); g.fillOval(wg[i].x + 10, wg[i].y + 30, 10, 10); g.fillOval(wg[i].x + 50, wg[i].y + 30, 10, 10);// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x, wg[i].y + 290, 60, 80); g.setColor(Color.LIGHT_GRAY); g.fillOval(wg[i].x + 20, wg[i].y + 300, 60, 80);// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x - 90, j1 + 75, 110, 70);// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x + 85, j2 + 70, 70, 70);// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x - 80, j3 + 235, 70, 70);// g.setColor(Color.getHSBColor(169, 40, 3)); g.fillOval(wg[i].x + 80, j4 + 235, 70, 70);// g.setColor(Color.GREEN); g.fillOval(wg[i].x - 66, wg[i].y + 69, 200, 230);// g.setColor(Color.black); g.drawOval(wg[i].x - 65, wg[i].y + 70, 200, 230); g.setColor(Color.black);// g.drawLine(wg[i].x + 5, wg[i].y + 130, wg[i].x + 75, wg[i].y + 130); g.drawLine(wg[i].x - 10, wg[i].y + 82, wg[i].x + 5, wg[i].y + 130); g.drawLine(wg[i].x + 75, wg[i].y + 130, wg[i].x + 100,wg[i].y + 95); g.drawLine(wg[i].x - 67, wg[i].y + 200, wg[i].x + 135,wg[i].y + 200); g.drawLine(wg[i].x + 5, wg[i].y + 250, wg[i].x + 75, wg[i].y + 250); g.drawLine(wg[i].x + 5, wg[i].y + 250, wg[i].x - 20, wg[i].y + 278); g.drawLine(wg[i].x + 100, wg[i].y + 275, wg[i].x + 75,wg[i].y + 250); g.drawLine(wg[i].x + 40, wg[i].y + 70, wg[i].x + 40, wg[i].y + 300); } } @Override public void run() { while (true) { for (int i = 0; i < 4; i++) { if (wg[i].y > 0) wg[i].y = wg[i].y - wg[i].v; else //wg[i].y += wg[i].v;// wg[i].y=400; } repaint(); try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } } class WG { int x, y;// int v=0;// }