{
Int x=1;
Int y=0;
For (int I=1; i
MMap [I] [j]=x;
If (y==1) {
X++;
Y=0;
/* if (x==iconCount) {
x=1;
} */
}
The else {
Y=1;
}
}
}
DrawMap ();
}
Void ThirdGuanScene: : drawMap ()
{
The log ("==================================");
For (int x=0; X & lt; XCount; X++) {
For (int y=0; Y & lt; YCount; Y++) {
If (mMap [x] [y] & gt; 0 {
Char iconName [36]={0};
Sprintf (iconName "1 - % d.p ng", mMap [x] [y]);
The log (" % s "iconName);
The log (" % d ", mMap [x] [y]);
Auto position=indextoScreen (x, y);
Icon=Sprite: : createWithSpriteFrame (SpriteFrameCache: : getInstance () - & gt; GetSpriteFrameByName (iconName));
Icon - & gt; SetPosition (position);
Int tag=(yCount - 2) * (x - 1) + y;
The log (" tag=% d ", the tag);
AddChild (icon, 100, the tag);
}
}
}
}
CodePudding user response:
Every time the value of your iconNameCodePudding user response:
Iconname is fixed 36 images, according to the number size,CodePudding user response: