I’ve hit another problem which I hope you guys won’t mind answering;
On my level selection, I have two sets of for-loops to create a 3x3 widget buttons. I’ve attached graphics to the first group, but when i attach graphics to the second group, I get the following error on the output:
WARNING: Supplied frameIndex(10) exceeds images sheet’s maximum freamIndex (9). Value will be clamped.
The framInddex error goes up to 19.
Here’s my code (note that I am placing the button widgets into display groups as I am using storyboard):
local sheetOptions =
{
width = 146,
height = 154,
numFrames = 9,
sheetContentWidth = 438,
sheetContentHeight = 462
}
local buttonSheet1 = graphics.newImageSheet("images/levelselection/lvlGroup1temp.png", sheetOptions)
local buttonSheet2 = graphics.newImageSheet("images/levelselection/lvlGroup2.png", sheetOptions)
-- Pots group 1
for i = 0,2 do
for j = 1,3 do
current = i\* 3+ j
local button1 = widget.newButton {
--label = current,
id=current,
sheet = buttonSheet1,
defaultIndex =current,
overIndex = current,
width = 120,
height=122,
--defaultColor = {255,0,0,255},
strokeColor = {0,0,0,0},
onRelease = buttonRelease
--default = square = display.newRect(0,0,120,122),
}
--levelsGroupOne[current].x = 15 + (j\*150)
--levelsGroupOne[current].y = 275 + (i\*165)
button1.x = 15 + (j\*150)
button1.y = 275 + (i\*165)
levelGroupOne:insert(button1)
end
end
-- pots group 2
for k = 3,5 do
for l = 1,3 do
current = k\*3+l
local button2 = widget.newButton {
--label = current,
id = current,
sheet = buttonSheet2,
defaultIndex =current,
overIndex = current,
width = 120,
height = 122,
--defaultColor = {150,170,0,255},
strokeColor = {0,0,0,0},
onRelease = buttonRelease
}
button2.x = 550 + (l\*150)
button2.y = -220 + (k\*165)
levelGroupTwo:insert(button2)
end
end
@nick_sherman : The problem is that the level numbers are written on the graphics themselves which are all in one sheet :S
[import]uid: 184921 topic_id: 36151 reply_id: 143602[/import]