Jump to content

Creating texture from rectangle is cropping more than it should.


crowbar
 Share

Recommended Posts

I'm trying to tile sprites using Pixi 3.0.  I'm pulling the textures from a sprite sheet like so:

var img_tile_black= new PIXI.Texture(wabbitTexture.baseTexture, new PIXI.Rectangle(695,419,64,64));var img_tile_brown= new PIXI.Texture(wabbitTexture.baseTexture, new PIXI.Rectangle(769,419,64,64));var img_tile_red= new PIXI.Texture(wabbitTexture.baseTexture, new PIXI.Rectangle(695,493,64,64));var img_tile_white= new PIXI.Texture(wabbitTexture.baseTexture, new PIXI.Rectangle(769,493,64,64));

I add them to the container like so:

display_tiles_walls = new PIXI.Container();display_tiles = new PIXI.Container();tile_containers = [display_tiles_walls,display_tiles];//...var sprite = new PIXI.Sprite(img_tile_white);//...tile_containers[index].addChild(sprite);

However the result looks like this:

byL0Kd9.png

While the source image (part of my sprite sheet) looks like this:

QOE1W9n.png

 

I want just the white squares flush with the other white squares.  I cannot figure out why the color borders are showing.

 

I have tried adjusting the Rectangle that crops the texture, but it never works.

 

Edit: I tried using a TilingSprite, but I guess that just fills the whole renderer.width and renderer.height with the sprite, tiled?

 

Regards,

 

Jordan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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