1ipt0n Posted May 10, 2015 Share Posted May 10, 2015 Hi,I have tiles layer and I'm trying to make minimap from my layer like this: var minimap = game.add.sprite(100, 100, layer_walls.generateTexture()); minimap.scale.setTo(0.2); minimap.fixedToCamera = true; layer should hold a sprite but this sprite contain only part that is displayed right now (nothing that is outside camera) . how to get whole layer texture?I tryed to add layer_walls.renderSettings.enableScrollDelta=false; before but it doesn't helped. Link to comment Share on other sites More sharing options...
1ipt0n Posted May 11, 2015 Author Share Posted May 11, 2015 question is still unsolved, but I make my minimap using bitmapData and it works fine:function generateMinimap(){ // create a new bitmap data object var minimap = game.add.bitmapData(layer_walls.layer.width,layer_walls.layer.height); minimap2 = game.add.bitmapData(layer_walls.layer.width,layer_walls.layer.height); for(y=0; y<layer_walls.layer.data.length; y++ ) for(x=0; x<layer_walls.layer.data[y].length; x++ ) if(layer_walls.layer.data[y][x].index>-1){ minimap.setPixel(x,y,0,255,0); } // use the bitmap data as the texture for the sprite minimap.update(); var minimap_sprite = game.add.sprite(10, 10); minimap2_sprite = game.add.sprite(10, 10,minimap2); minimap2_sprite.fixedToCamera = true; minimap_sprite.setTexture(minimap.texture); minimap_sprite.fixedToCamera = true; minimap_sprite.bringToTop(); }and on game update I paint on minimap2_sprite only points where player and enemies are. I also have another problem. bitmapData method clear and cls don't work. so I use:for(y=0; y<minimap2.height; y++ ) for(x=0; x<minimap2.width; x++ ) minimap2.setPixel( x,y,0,0,0,0) ;to clear minimap . don't know why : minimap2.clear();doesen't clear a thing now my minimap looks like that: Link to comment Share on other sites More sharing options...
Recommended Posts