public FightingSprite(int resType, int index) { if (resType == DatLib.RES_ACP) { // 怪物的 mImage = (ResImage) DatLib.GetRes(DatLib.RES_ACP, 3, index); } else if (resType == DatLib.RES_PIC) { // 玩家角色的 mImage = (ResImage) DatLib.GetRes(DatLib.RES_PIC, 3, index); } else { throw new IllegalArgumentException("resType 有错."); } }
/** 载入号码n,类型m的地图,初始位置(x,y) */ public void loadMap(int type, int index, int x, int y) { Point tmpP = null; if (mPlayer != null && mMap != null) { tmpP = mPlayer.getPosOnScreen(mMapScreenPos); } mMap = (ResMap) DatLib.getInstance().getRes(DatLib.RES_MAP, type, index); mMapScreenPos.set(x, y); if (tmpP != null) { mPlayer.setPosOnScreen(tmpP.x, tmpP.y, mMapScreenPos); } SaveLoadGame.MapType = type; SaveLoadGame.MapIndex = index; SaveLoadGame.MapScreenX = x; SaveLoadGame.MapScreenY = y; }
/** 建一个宝箱,宝箱号码boxindex(角色图片,type为4), 位置为(x,y),id为操作号(与NPC共用) */ public void createBox(int id, int boxIndex, int x, int y) { SceneObj box = (SceneObj) DatLib.GetRes(DatLib.RES_ARS, 4, boxIndex); box.setPosInMap(x, y); mNPCObj[id] = box; }
/** * 创建配角号码npc,位置为(x,y),id为操作号 * * @param id * @param npc * @param x * @param y */ public void createNpc(int id, int npc, int x, int y) { NPC npcobj = (NPC) DatLib.GetRes(DatLib.RES_ARS, 2, npc); npcobj.setPosInMap(x, y); npcobj.setICanWalk(mCanWalk); mNPCObj[id] = npcobj; }
/** * 创建主角号码actor,位置为(x,y) * * @param actorId * @param x * @param y */ public void createActor(int actorId, int x, int y) { mPlayer = (Player) DatLib.GetRes(DatLib.RES_ARS, 1, actorId); mPlayer.setPosOnScreen(x, y, mMapScreenPos); sPlayerList.add(mPlayer); mPlayer = sPlayerList.get(0); }