mk_03 Posted October 27, 2016 Share Posted October 27, 2016 Hello, what i try to do is that my user will be able to draw on the game a figure, such as a rectangle, then I use the coordinates of the rectangle that he draw and when some sprite enter to that area send a message. How can i make that my user whit the mouse can draw over the game? Link to comment Share on other sites More sharing options...
s4m_ur4i Posted October 27, 2016 Share Posted October 27, 2016 you can create a Phaser.Rectangle( x, y, width, height ); on mouse down / release something like that (not tested). let rectX1 = 0; let rectY1 = 0; let rectX2 = 0; let rectY2 = 0; game.input.onDown.add((event)=>{ RectX1 = event.x; RectX2 = event.y; }); game.input.onUp.add((event)=>{ RectX2 = event.x; RectY2 = event.y; } const rectangle = new Phaser.Rectangle( rectX1, rectY1, rectX2, rectY2 ); regards mk_03 1 Link to comment Share on other sites More sharing options...
mk_03 Posted October 28, 2016 Author Share Posted October 28, 2016 Thanks SamTheMighty it works with a small changes s4m_ur4i 1 Link to comment Share on other sites More sharing options...
Recommended Posts