import java.io.IOException; import javax.microedition.lcdui.Canvas; import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; public class test6 extends Canvas implements Runnable { Image planeImg,mapImg; int n=1,i; int planeIndex[]={0,1,2,3}; int mapIndex[][]={ {4,5,5,5,5,5,6}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {7,8,8,8,8,8,9}, {10,11,11,11,11,11,12}, }; public test6() { super(); // TODO Auto-generated constructor stub try { mapImg=Image.createImage("/20.png"); planeImg=Image.createImage("/200528141737203r"+n+".png"); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } new Thread(this).start(); } protected void paint(Graphics g) { // TODO Auto-generated method stub g.setColor(200,200,200); g.fillRect(0,0,176,208); g.setClip(40,80,64,64); g.drawImage(planeImg,40,80,Graphics.LEFT|Graphics.TOP); } public void run() { //TODO Auto-generated method stub while(true){ try { Thread.sleep(20); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(planeIndex[i]==3) planeIndex[i]=0; else planeIndex[i]+=1; n++; repaint(); } }
http://www.guaiguaier.com 乖乖儿-育儿工具资源网 }