vmars316 Posted January 29, 2016 Share Posted January 29, 2016 Hello & Thanks , In code below : Runs fine as is . But I would like to run it without game.debug.geom(rectA, '#ff0000'); . If I do , then rectA is not visible . How can I run it with no game.debug.geom(rectA, '#ff0000'); and rectA is still visible ? Quote var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'vm-rectangle-intersects', { create: create, update: update, render: render }); var rectA; function create() { game.stage.backgroundColor = '#0000ff'; rectA = new Phaser.Rectangle(0, 0, 64, 64); var style = { font: "bold 24px Arial", fill: "#ffffff"}; xText = game.add.text(0, 0,"xPoint = ", style); yText = game.add.text(160, 0,"yPoint = ", style); } function update() { if (game.input.mousePointer.isDown) { rectA.x = game.input.activePointer.x; rectA.y = game.input.activePointer.y; xText.text = 'xPoint = ' + rectA.x; yText.text = 'yPoint = ' + rectA.y; } } function render() { game.debug.geom(rectA, '#ff0000'); } Thanks Link to comment Share on other sites More sharing options...
Batzi Posted January 29, 2016 Share Posted January 29, 2016 (edited) 1- Remove the render() code 2- Create a rectangle from the Graphics class like the code below game.stage.backgroundColor = '#0000ff'; rectA = game.add.graphics(0, 0); rectA.beginFill(0xff0000); rectA.drawRect(0,0,64,64); var style = { font: "bold 24px Arial", fill: "#ffffff"}; xText = game.add.text(0, 0,"xPoint = ", style); yText = game.add.text(160, 0,"yPoint = ", style); 3- Keep the update() as it is This should work Edited January 29, 2016 by Batzi Formatting the post Link to comment Share on other sites More sharing options...
vmars316 Posted January 29, 2016 Author Share Posted January 29, 2016 Yes , that did it . THanks Batzi 1 Link to comment Share on other sites More sharing options...
Recommended Posts