[]tiledmap 可以在图块层的指定格子上添加Sprite吗
如题
我的tiledmap 有Bottom和Top两个图块层 Top层在Bottom层上方
现在想在Bottom层的某个格子上添加一个Sprite 请问 有什么方案呢
我的tiledmap 有Bottom和Top两个图块层 Top层在Bottom层上方
现在想在Bottom层的某个格子上添加一个Sprite 请问 有什么方案呢
没有找到相关结果
已邀请:
3 个回复
layabox
赞同来自:
cuixueying
赞同来自:
nazgul
赞同来自:
constructor(mapname:string, x:number, y:number){
楼上您好,我照着你的代码写的,但是还是看不到我自己的sprite,请问是怎么回事呢?super();
//显示登陆界面
this.tMap = new Laya.TiledMap()
this.tMap.antiCrack = true
//创建Rectangle实例,视口区域
var viewRect:Laya.Rectangle = new Laya.Rectangle(0, 0, Conf.App_Width, Conf.App_Height);
//创建TiledMap地图
this.tMap.createMap("map/"+mapname+".json",viewRect, laya.utils.Handler.create(this, this.test));//, null, new Laya.Point(1600, 816));
}
private test(){
var testLayer:Laya.MapLayer = this.tMap.getLayerByName("player");
this.tMapPlayer = new Laya.Sprite();
this.tMapPlayer.graphics.drawRect(0, 0, 100, 100, "#FF0000", "#0000FF", 1);
//this.tMapPlayer.loadImage("unit/test.png");
this.tMapPlayer.zOrder = 1000;
testLayer.addChild(this.tMapPlayer);
}
我可以确定player层是在最上面层的