Jump to content

SVG loading causes stacking of images


ironfroggy
 Share

Recommended Posts

I was hoping to use SVG assets for my images, just to remove the step of generating the PNGs from my source graphics. I tried loading an SVG asset with game.load.image() and found to my delight that it worked without any problem! However, once I added a second SVG image being loaded, I found a problem. It seems the SVG loading must re-use a canvas or buffer internally, which isn't cleaned out, because whichever asset is loaded second will always have a copy of the first SVG behind it when used in any sprites.

 

function preload() {  game.load.image('food', 'assets/food.svg');  game.load.image('cell_blue', 'assets/cell_blue.svg');}

When I do this, I can't display any cell_blue sprites without them having a bit of food sticking out from behind them. Is there anyway I could work around this? In the mean time, I'll stick to generating my PNG rasterizations by hand.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...