Can someone explain if the following is possible, and indeed if I’m actually going about this the correct way…
I’ve create a table, of which I’ve inserted a collection of Sprites like so:
for i=1,#levOneLayout do
tileMap[i]=display.newSprite (imageSheet, { name=levOneLayout[i].name, start=levOneLayout[i].tileVal, count=2, time=500 })
tileMap[i].x=levOneLayout[i].x
tileMap[i].y=levOneLayout[i].y
tileMap[i].touch = onObjectTouch
tileMap[i]:addEventListener( "touch", tileMap[i] )
end
What I’m now trying to do is iterate through all the sprites in the “tileMap” table, and get the details, I currently have this:
for i=1,#tileMap do
text = display.newText( tileMap[i].x, 0, 0, nil, 16 )
text:setTextColor( 255, 255, 255 )
text.x = i\*16
text.y = 32
end
Now that indeed does print out the X position of the Sprite, but if I wanted the name I’d have thought changing the line to read:
text = display.newText( tileMap[i].name, 0, 0, nil, 16 )
But this doesn’t work at all.
Am I doing this totally and utterly wrong, or is there something ‘simple’ that I’m omitting? [import]uid: 41429 topic_id: 30370 reply_id: 330370[/import]