import javax.microedition.lcdui.*; import javax.microedition.lcdui.game.*; import java.io.*; import java.util.*; public class Game extends Canvas implements Runnable { boolean keyFire, keyLeft, keyRight, keyUp, keyDown; boolean rn, next, attack, ladder; int w,h; int x,y,y2; int k; Image hero, pl, lad; Sprite Hero, Pl, Pl2, Lad; Random r = new Random(); private volatile Thread T; private final long OFT=500/25; public Game() { setFullScreenMode(true); w=getWidth(); h=getHeight(); try { hero=Image.createImage("/hr1.png"); pl=Image.createImage("/pl.png"); lad=Image.createImage("/ladder.png"); } catch (IOException ex) { ex.printStackTrace(); } Hero=new Sprite(hero,hero.getWidth(),hero.getHeight()); Pl=new Sprite(pl,pl.getWidth(),pl.getHeight()); Pl2=new Sprite(pl,pl.getWidth(),pl.getHeight()); Lad=new Sprite(lad,lad.getWidth(),lad.getHeight()); x=40; y=h-Hero.getHeight()-10; y2=y; ladder=false; rn=true; T=new Thread(this); T.start(); } public void paint(Graphics g) { checkKeys(); Hero.setPosition (x,y); Pl.setPosition (w-Pl.getWidth(),200); Pl2.setPosition (0,200); Lad.setPosition (Pl.getWidth()-30,195); g.setColor(250,250,250); g.fillRect(0,0,w,h); g.setColor(0,100,0); g.fillRect(0,300,w,h); Pl.paint(g); Pl2.paint(g); Lad.paint(g); Hero.paint(g); g.drawString(""+ladder, 5, 5, 0); ladder(); } public void ladder() { if (Hero.collidesWith(Lad, true)) if (x>Pl.getWidth()-Lad.getWidth()*2 && xPl.getWidth()-Lad.getWidth() || x