I’m not sure what “groundLayer” is in your code. I don’t see it initially declared anywhere. Can you isolate this down to the most simple case, without the enterFrame and all of that?
Thanks,
Brent
I’m not sure what “groundLayer” is in your code. I don’t see it initially declared anywhere. Can you isolate this down to the most simple case, without the enterFrame and all of that?
Thanks,
Brent
Here the code
local groundSheetInfo = require(“classes.ground_sheet”)
local groundSheet = graphics.newImageSheet( “images/ground_sheet.png”, groundSheetInfo:getSheet() )
local groundSequenceData = {start=1, count=2}
local groundLayer = display.newSprite( group, groundSheet , groundSequenceData )
groundLayer.x, groundLayer.y = display.contentCenterX, display.contentHeight-display.screenOriginY;
Thanks
Filippo
Hi Filippo,
I guess there’s some miscommunication here. This code looks like a standard sprite being created from a standard image sheet, exactly as sprites are meant to be. And this isn’t working on the device?
Or, are you trying to “fill” a sprite? Sprites don’t support that in my tests (in fact, the Simulator crashes if you try to fill a sprite with a bitmap image). I’m not sure why you’d want to “fill” a sprite anyway, since it’s just a series of animated frames, but maybe I’m not clear on what you’re envisioning.
Best regards,
Brent
Hi Brent,
Below my answers:
>I guess there’s some miscommunication here. This code looks like a
>standard sprite being created from a standard image sheet, exactly as
>sprites are meant to be. And this isn’t working on the device?
Exactly. If I use display.setDefault(“textureWrapX”, “repeat”); it doesn’t work on the device but it works fine on the simulator
>Or, are you trying to “fill” a sprite? Sprites don’t support that in
>my tests (in fact, the Simulator crashes if you try to fill a sprite
>with a bitmap image). I’m not sure why you’d want to “fill” a sprite
>anyway, since it’s just a series of animated frames, but maybe I’m not
>clear on what you’re envisioning.
I am using a spritesheet to change the background using setFrame(n)
Basically the background is repeating and I can set a different frame to change the background.
Hope it helps
Filippo
Hi Filippo,
Out of curiosity, did you try to install our sample “repeating fill” project on the same device? It’s located in your local Corona application directory here:
CoronaSDK > SampleCode > Graphics-Premium > PatternFill
This has been tested on devices so it should work for you too. If so, then please inspect the code and see if there’s something that doesn’t quite mesh with your code.
Again, I don’t think that sprites can be “filled”.
Brent
Hi,
Yes we know that example and as my initial post if we load the image in that way works.
Do you have any example using sprite-sheets?
Thanks
Filippo
Hi Filippo,
In my tests, sprite objects (display.newSprite) do not support repeating fills. It crashes my Simulator when I try it. If you have a project which shows otherwise, and wish to have it inspected via the bug report system, you can file a bug through the submission form. Otherwise, I encourage you to follow the example project or seek another workaround.
Best regards,
Brent