Jump to content

Arrays And Or While Loops


unknown gamer
 Share

Recommended Posts

Alright, what I have is a 10x3 table that has numbers from 1-30 as the td values. Lets call that a level card. So in this game as the user completes levels a database will get updated with the number of levels created. Say a user has completed 15 levels, the database will say 15 and I want the first 15 tds on the level card to have a different background colour. I've thought about using a while loop but I was unsure on how to go about that, same with an array. So can someone maybe help me get started with this?-Thanks in advance

Link to comment
Share on other sites

I assume you're using a loop to print the 30 tds, so all you need is a counter to keep track of the max level they've completed, and an if statement inside the loop to check the counter and see which color to use as the background.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...