开发工具:
文件大小: 95kb
下载次数: 0
上传时间: 2011-01-09
详细说明: import java.io.IOException; 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; import javax.microedition.lcdui.game.TiledLayer; public class WalkGameCanvas_18 extends GameCanvas implements Runnable{ private Graphics g; private Image i1,i2; private Sprite splayer; private LayerManager lm; private int [][]map; private int []right=new int[]{3,4,5}; private int []left=new int[]{9,10,11}; private int []up=new int[]{0,1,2}; private int []down=new int[]{6,7,8}; private TiledLayer t; private int viewX,y,x,viewY; private int keyState; private boolean rightFlag; private boolean leftFlag; private boolean upFlag; private boolean downFlag; WalkGameCanvas_18(){ super(true); g=this.getGraphics(); try{ i1=Image.createImage("/item01.png"); i2=Image.createImage("/walk.png"); }catch(IOException e){ e.printStackTrace(); } t=new TiledLayer(20,18,i1,16,16); map=new int[][]{ { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 1, 2, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 6, 7, 11, 12, 11, 12, 3, 4, 5, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 17, 16, 17, 8, 9, 10, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 17, 16, 17, 13, 14, 15, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 18, 19, 20, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 21, 21, 21, 22, 22, 21, 21, 17, 24, 25, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 21, 21, 23, 21, 21, 21, 21, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 26, 27, 28, 29, 30, 17, 16, 17, 16, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 17, 16, 17, 33, 34, 16, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 35, 36, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 17, 16, 22, 16, 17 }, { 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 12 }, { 16, 22, 16, 17, 16, 17, 16, 31, 32, 17, 16, 17, 16, 17, 16, 17, 16, 22, 16, 17 } }; for(int i=0;i<18;i++) for(int j=0;j<20;j++) t.setCell(j, i, map[i][j]); splayer=new Sprite(i2,i2.getWidth()/12,i2.getHeight()); lm=new LayerManager(); lm.append(splayer); lm.append(t); new Thread(this).start(); } ...展开收缩
(系统自动生成,下载前可以参看下载内容)
下载文件列表
相关说明
- 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
- 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度。
- 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
- 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
- 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
- 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.