import java.io.IOException; import javax.microedition.lcdui.*; public class tank extends Canvas implements Runnable { private int tankx; private int tanky; private int key; private Image fon; Image[] tanks; private int nap; public tank() { //переменные tankx=112; tanky=112; Image[] tanks=new Image[4]; nap=1; //загрузка фона и танка try { fon=Image.createImage("/fon.png"); tanks[0]=Image.createImage("/u.png"); tanks[1]=Image.createImage("/d.png"); tanks[2]=Image.createImage("/r.png"); tanks[3]=Image.createImage("/l.png"); } catch (Exception ex) {} new Thread(this).start(); } // вывод графики на экран public void paint(Graphics g) { g.drawImage(fon,0,0,20); g.drawImage(tanks[nap],tankx,tanky,20); } public void run() { while (true) { repaint(); try { Thread.sleep(50); } catch (Exception ex) {} } } }