Jump to content

Spritemap picking up pixels in next frame


boolean
 Share

Recommended Posts

Hi there

 

I'm using a spritemap in my game to hold all my game sprites. I'm basically using it like a manual texture atlas - it's made up of a 32x32 grid that I just draw directly into with all my art assets.

 

What I've found though is that when I'm accessing a 32x32 sprite in my game, it's picking up a single row of pixels from the sprite beside it. Here is a sample of what it looks like:

 

phaser_spritebug.png

 

Notice the green line down the center of the orange blob. In my spritesheet it looks like the image below (Note: the blue and pink backgrounds are just so you can see the divisions):

 

phaser_spritemap.png

 

I also get a green line above the orange blob since he's below the green square in the spritemap.

 

Is there a setting I'm missing? Is there a way around this?

 

Cheers!

Link to comment
Share on other sites

You're going to want to add at least 2 pixels of padding around each sprite. It's common to have pixel bleed like that in some renderers, I assume it's defaulting to WebGL. If you use something like Texture Packer it will give you the option to add the padding and it will fix everything.

 

Hope that helps.

Link to comment
Share on other sites

Ah nuts, you can't set that in code? Some other frameworks I've used have built in support for padding (plus padding types).

 

Well I'll just pad it manually in the file for now. I've not tried writing any extensions for phaser yet, but if I can figure out where it stores the pixel data it shouldn't be too hard to jam some spacing in there on the fly.

 

Cheers!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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