farzher Posted April 29, 2014 Share Posted April 29, 2014 I want to use rectangles for my graphics while prototyping, instead of images. But I still need to use the Sprite class for physics and stuff. How can I create a Sprite without an image, set its width and height, and render a rectangle there instead? Link to comment Share on other sites More sharing options...
rich Posted April 29, 2014 Share Posted April 29, 2014 var rect = game.make.bitmapData(32, 32); rect.ctx.fillStyle = '#ff0000'; rect.ctx.fillRect(0, 0, 32, 32); var yourSprite = game.add.sprite(0, 0, rect); Link to comment Share on other sites More sharing options...
Recommended Posts