Jump to content

Filling whole game.world in the mini canvas


vattujan
 Share

Recommended Posts

Hi all,

I am new to phaser so excuse me if this is stupid.

Actually, I am working on agar.io kidda game. I am making a mini-map to hold all of the game world. But, the world inside the canvas moves along the player and shows beyond the actual game boundary. 

This function is called on create function.

function createMiniMap(){
stage = game.make.bitmapData(game.world.width, game.world.height);
thumbnail = game.add.bitmapData(200, 200);
thumbContainer = game.add.sprite(game.width, game.height, thumbnail);
thumbContainer.anchor.setTo(0.5, 0.5);
game.stage.addChild(thumbContainer);
}
 
in update
function update(){
if (game.time.time < this.nextUpdate){
return;
}
{
stage.clear();
stage.drawFull(game.world);
thumbnail.rect(0, 0, thumbnail.width, thumbnail.width, '#000');
thumbnail.copy(stage, 0, 0, stage.width, stage.height, 2, 2, thumbnail.width, thumbnail.width);
thumbnail.update();
this.nextUpdate = game.time.time + this.updateRate;
}
}
Thanks in advance!!!!!!

map.JPG

Link to comment
Share on other sites

  • vattujan changed the title to Filling whole game.world in the mini canvas
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...