Hi, I have lots of tiles need putting up and grouting.
In my game I need to put a border around a subsection of the screen. To do this I have 3 10x10 tiles that I intended to use by loading each and “blitting” it several times to a blank canvas.
//ne,se,sw,nw light Outside
Sprite lOSCorners[4];
//ne,se,sw,nw dark Outside
Sprite dOSCorners[4];
//n,e,s,w light outside
Sprite lOSWalls[4];
//n, e, s, w dark outside
Sprite dOSWalls[4];
for (int i = 0; i < 4; ++i) {
lOSCorners[i] = Sprite::create(“peachyBorders.png”, Rect(0, 0, 10, 10));
dOSCorners[i] = Sprite::create(“peachyBorders.png”, Rect(10, 0, 10, 10));
lOSWalls[i] = Sprite::create(“peachyBorders.png”, Rect(20, 0, 10, 10));
dOSWalls[i] = Sprite::create(“peachyBorders.png”, Rect(20, 0, 10, 10));
lOSCorners[i]->setRotation(i90);
dOSCorners[i]->setRotation(i90);
lOSWalls[i]->setRotation(i90);
dOSWalls[i]->setRotation(i90+180);
}
I never found a way to reliably duplicate sprites like this so repeated a lot of my graphics for the intro screens. I’d prefer not to import plists, the sheet is only 30x10! Should I create a new sprite each time I blit 10sq pixels? Can I create a blank node of say 480*10 and stretch?
ANSWER: rotate and stretch, create again from file and repeat a coupla times.
But I’m not sure the rotate and stretch are getting mixed up, or worse, my corner tiles appear smeared lengthwise accros half the screen.
Also the left and right borders are not being added to the screen despite calling SetPosition
on the stretched and rotated Sprites.
07-10 14:00:02.410: D/cocos2d-x debug info(1197): setPos lOSW[0] 0.000000, 740.000000
As you, er, may, see, only a couple of complete horizontal walls get drawn, light or dark, they are mirrors, or should be. The corners are a mess.
Thanks again in advance.