Different level icons for new levels on menu?

I’m currently messing around with the SpaceShooter template. Currently all levels have the same icon

iZkC8dJ.png

How would I go about having a different icon for each level?  

Thanks

Currently:

local function showLevels( event ) if levelsShown == false then if soundAllowed then audio.play( tapSound, {channel=1}) end levelsShown = true local function changeLevel( event ) currentLevel = event.target.id storyboard.gotoScene( "gameInfo", "slideDown", 400 ) end local scrollView = widget.newScrollView{ top = (\_H\*0.42), left = 480, width = 480, height = 100, scrollHeight = 0, scrollWidth = 0, hideBackground = true, leftPadding=0, rightPadding=10, verticalScrollDisabled=true, } overlayGroup:insert(scrollView) local i for i=1, amountOfLevels do local asteroid = display.newImageRect("images/asteroidGlow.png", 100,100) asteroid.x = 60+(105\*(i-1)); asteroid.y = 50 asteroid.id = i asteroid:addEventListener("tap",changeLevel) scrollView:insert(asteroid) local levelNumber = display.newEmbossedText(i, 0,0, "HelveticaNeue-Bold", 20) levelNumber.x = asteroid.x; levelNumber.y = asteroid.y-18; levelNumber:setFillColor(200/255) scrollView:insert(levelNumber) local score = "No Score" if levelScores[i] ~= nil and levelScores[i] ~= "0" then score = levelScores[i] end local scoreText = display.newEmbossedText(score, 0,0, "HelveticaNeue-Bold", 14) scoreText.x = asteroid.x; scoreText.y = asteroid.y+12; scoreText:setFillColor(200/255) scrollView:insert(scoreText) end

Hi @kmcqua200 and welcome to the forums. Please with your future posts, when posting code, please click on the blue <> button and paste your code into that block so that it’s formatted properly. The community will appreciate it.

Now to your question with more questions:

Do you have multiple asteroid images? How many? Are they single images or in an image sheet?

Do you want them random? randomized (i.e. random order, but only used once)? or nn a fixed order?

Before anyone can answer we need to know that.

Hi Rob, Thanks for the tips.

There is currently one asteroid image in the file (I have more to add).

I’d like to keep the 5 levels and have a different icon for each in a fixed order.  

My additional asteroids are not currently in an image sheet nut I could do that if necessary. 

Thanks for the help!

How many total levels (value of amountOfLevels)?

The amountOfLevels = 5

I would recommend getting rid of the for loop. Instead, do 5 separate display.newImageRect() calls and in each call, load each image in the order you want.

Rob

Hi @kmcqua200 and welcome to the forums. Please with your future posts, when posting code, please click on the blue <> button and paste your code into that block so that it’s formatted properly. The community will appreciate it.

Now to your question with more questions:

Do you have multiple asteroid images? How many? Are they single images or in an image sheet?

Do you want them random? randomized (i.e. random order, but only used once)? or nn a fixed order?

Before anyone can answer we need to know that.

Hi Rob, Thanks for the tips.

There is currently one asteroid image in the file (I have more to add).

I’d like to keep the 5 levels and have a different icon for each in a fixed order.  

My additional asteroids are not currently in an image sheet nut I could do that if necessary. 

Thanks for the help!

How many total levels (value of amountOfLevels)?

The amountOfLevels = 5

I would recommend getting rid of the for loop. Instead, do 5 separate display.newImageRect() calls and in each call, load each image in the order you want.

Rob