mungur Posted June 29, 2014 Share Posted June 29, 2014 Hello,I'm pretty new in js games & phaser.io so my question may be little bit silly, but .. Whats the best way to create rounded rectangle?There is no way to create curves or arcs with Graphics class. Or there is a way?Only way I can think is to load high res. tilesprite with all rectangles and then downscale depending on screen resolution. Link to comment Share on other sites More sharing options...
Heppell08 Posted June 30, 2014 Share Posted June 30, 2014 I know that graphics can be drawn in the game but would it not be easier creating a group, drawing 4 circles then connecting the circles by lines to give the effect of a rectangle with curves? Link to comment Share on other sites More sharing options...
lewster32 Posted June 30, 2014 Share Posted June 30, 2014 You can use BitmapData which gives you a canvas context to play with, then you can use the usual canvas methods of doing this, such as the ones mentioned here: http://stackoverflow.com/questions/1255512/how-to-draw-a-rounded-rectangle-on-html-canvas Link to comment Share on other sites More sharing options...
Adibas03 Posted July 25, 2016 Share Posted July 25, 2016 I know this is old now. I just wanted to give update. Function now exists for graphics in Phaserjs as from version 2.5.0 graphics.drawRoundedRectangle(x,y,width,height,angle) Umz 1 Link to comment Share on other sites More sharing options...
VitaZheltyakov Posted July 25, 2016 Share Posted July 25, 2016 https://github.com/VitaZheltyakov/phaser-nine-patch-plugin Link to comment Share on other sites More sharing options...
FakeWizard Posted March 22, 2017 Share Posted March 22, 2017 On 25. 7. 2016 at 11:11 PM, Adibas03 said: I know this is old now. I just wanted to give update. Function now exists for graphics in Phaserjs as from version 2.5.0 graphics.drawRoundedRectangle(x,y,width,height,angle) it's actually a method that is inherited from Pixi.Graphics. It has been changed to graphics.drawRoundedRect(x, y, width, height, radius) Link to comment Share on other sites More sharing options...
Recommended Posts