文件名称:Java程序实现坦克移动
文件大小:3KB
文件格式:JAVA
更新时间:2013-11-02 04:45:00
Java 坦克移动
用Java实现坦克移动 import javax.microedition.lcdui.Graphics; import javax.microedition.lcdui.Image; import javax.microedition.lcdui.game.GameCanvas; import javax.microedition.lcdui.game.LayerManager; import javax.microedition.lcdui.game.Sprite; public class MultiLayerCanvas extends GameCanvas implements Runnable { private static int INDEX_OF_UP=0; private static int INDEX_OF_DOWN=1; private static int INDEX_OF_LEFT=3; private static int INDEX_OF_RIGHT=2; private boolean isPlay; private long delay; private int currentX,currentY; private int width; private int height; private LayerManager lm=null; private Sprite spriteTank; private Sprite couple; private Sprite currentSprite; boolean visualFlag=false; public MultiLayerCanvas(){ super(true); lm = new LayerManager(); width=getWidth(); height=getHeight(); currentX=width/2; currentY=height/2; delay=20; try