Phantasm Posted February 12, 2016 Share Posted February 12, 2016 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 : -http://www.html5gamedevs.com/topic/14930-creating-a-mini-map-from-a-render-texture/ -http://www.html5gamedevs.com/topic/14182-creating-a-mini-map-in-phaser/ 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 MyGame.Hud.prototype.drawMinimap=function(){ if(this.miniMap){ this.miniMap.destroy(); } /// // Init vars /// var heightMax = 200; var widthMax = 200; /// // // /// if (this.miniMapBitmap == null) { this.miniMapBitmap = MyGame.game.add.bitmapData(widthMax, heightMax); this.miniMapBitmap.ctx.beginPath(); this.miniMapBitmap.ctx.rect(0, 0, widthMax, heightMax); this.miniMapBitmap.ctx.fill(); } else { 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 More sharing options...
Recommended Posts