Jump to content

Phaser and minimaps


Recommended Posts

Hey guys. Been working with phaser for a bit now, and i'm currently trying to make a minimap (overview of a fixed region in my current state). That said, there is not much documentation on how to do something like this, and I am still a newbie to phaser, so it's giving me  hard time. 

Here are the links i<ve already read :




What I have tried is using a bitmap of the state's layer, and putting it in a square on the top right of my screen. Now, I am ok with the palcement, drawing, etc. I have a square with the texture inside it. 

The problem is, I can't get the good region to show inside the minimap. I have weird graphical glitches when I move, and it shows a 1:1 of the nearby background.


Heres the snippet for the creation and update of my minimap


	// Init vars
	var heightMax = 200;
	var widthMax = 200;
	//  //

	if (this.miniMapBitmap == null)
		this.miniMapBitmap = MyGame.game.add.bitmapData(widthMax, heightMax);
		this.miniMapBitmap.ctx.rect(0, 0, widthMax, heightMax);

		var area = {
			x: 0 ,
			y: 0 ,
			width: 1200,
			height: 1200
        //testLayer is a state layer
		this.miniMapBitmap.copyRect(testLayer, area, 0, 0, 1);
	this.miniMap = MyGame.game.add.sprite(MyGame.game.camera.width - 200, 0, this.miniMapBitmap);
	this.miniMap.fixedToCamera = true;

This is called on player movement.

Note that the area var is set to testing parameters, since I have no clue on what it should be (The other links didn't help)


I'd love to have your more knowledgeable opinions on this!

Thanks in advance

Link to comment
Share on other sites


  • Recently Browsing   0 members

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