farzher Posted May 1, 2014 Share Posted May 1, 2014 @add.tileSprite 0, 0, 640, 480, 'tiles', 32Documentation says I can pick a frame, I'm trying to pick frame 32, but it renders the entire spritesheet.I want that one tile looped as the background.What could I have possibly done wrong? Link to comment Share on other sites More sharing options...
rich Posted May 1, 2014 Share Posted May 1, 2014 If it renders the entire sheet then frame 32 doesn't exist. Usually this happens if you've loaded a json hash format atlas (or xml) that uses frame names, not indexes. Link to comment Share on other sites More sharing options...
farzher Posted May 1, 2014 Author Share Posted May 1, 2014 frame 32 definitely exists @add.sprite 5, 5, 'tiles', 32I see it. I tried other frames too, but tileSprite always renders the whole thing. Loaded like this@load.spritesheet 'tiles', 'assets/tiles.png', 32, 32 Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 18, 2014 Share Posted July 18, 2014 I didn't want to create a new topic as I have the exact same problem. I'm using 2.0.7 and still can't make it work. I'm using width and height to do the tiling. That works fine if your sprite fills the image, but with a specific frame, it doesn't seem to be the right way. Edit: To be precise , I have an image of 256*256, I set the frameHeight/Width to 128 and ask for the frame 0. So this frame exists. But the wole image is displayed when I expand my TileSprite ( width = 300 for example ) Link to comment Share on other sites More sharing options...
lewster32 Posted July 18, 2014 Share Posted July 18, 2014 Try it with the canvas renderer. If it works, then the issue is due to WebGL being finicky about tiling sprites depending on their size and possibly also the position on the sheet. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 18, 2014 Share Posted July 18, 2014 You're right, this is working with Canvas ( although the tiling coordinates seem to be different from WebGL ) So what can I do now? I would better stick with WebGL if possible Link to comment Share on other sites More sharing options...
lewster32 Posted July 18, 2014 Share Posted July 18, 2014 When I've encountered this problem I've just taken the tiled assets out of the sprite sheets/atlases and made them separate; they still have to be power-of-two dimensions though. I know this sounds like a cop-out but I've not yet had time to test what works and what doesn't - I've had sprites from within atlases tile fine in WebGL, and then others which seemingly should work just not. I'd like to find out what the exact requirements are for tiling part of a sprite sheet or atlas, but currently I just don't know what they are. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 18, 2014 Share Posted July 18, 2014 Okay that's what I've been doing too. That's a big constraint though, in my opinion. Thanks for your time Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 18, 2014 Share Posted July 18, 2014 Last thought : would it be worth posting this as an issue on github? Link to comment Share on other sites More sharing options...
lewster32 Posted July 18, 2014 Share Posted July 18, 2014 I think it's fairly well known by the developers (this would be a pixi issue if anything btw) and I'm not sure if it's a technical limitation. Certainly in other GPU frameworks I've used, tiling a sprite from an atlas isn't possible, or at least not very easy, because the sprite you want to tile has to be extracted from the sprite sheet and set as an individual texture anyway internally for it to work with standard texture operations. Link to comment Share on other sites More sharing options...
pandavigoureux29 Posted July 18, 2014 Share Posted July 18, 2014 Okay, I guess I'll live with it then Link to comment Share on other sites More sharing options...
Recommended Posts