mid Posted February 23, 2019 Share Posted February 23, 2019 At initialization I iterate over the tilemap and add the sprites accordingly: for y { for x { var sprite = new PIXI.Sprite(new PIXI.Texture(PIXI.Loader.shared.resources["assets/tileset1.png"].texture, new PIXI.Rectangle(tile % 32 * size, tile / 32 * size, size, size))); sprite.anchor.set(0.5); sprite.position.set(x * size, y * size); spriteContainer.addChild(sprite); } } However it results in these weird artifacts (in attachment). There's space between the tiles on the Y axis (and these are not in the tileset). Quote Link to comment Share on other sites More sharing options...
mid Posted February 24, 2019 Author Share Posted February 24, 2019 Found the issue: I forgot integer division isn't a thing in JavaScript. ivan.popelyshev 1 Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted February 24, 2019 Share Posted February 24, 2019 obligatory comment about padding in spritesheets in case of any non-integer offset. The only thing that allows to set padding to 0 and have non-integers offset is pixi-tilemap for v4, i didnt port it to v5 yet. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.