I would like to create a phonegap application with random lvl's and a repetitive lvl selection. I need to do this in jquery, jquery mobile and localstorage.
I'm a beginner in javascript so I'll just post my exact need and also what I thought till now... The app is simmilar to 4 pics 1 word (for each lvl I have some pictures and I have to guess a word that is found in each of those 4 pics) The difference is that in my app I have diferite types of lvl's. (for example one is normal, one have the pics black and white, one have a counter, one have more pictures, once needs to guess wore words from that picture etc.)
So let's say I have lvl's untill 200.
for lvl 1 to lvl 50 I need some lvls that have the same functionality but are random
for 50-100 I need another type of lvl that interleaves with the other one (ex: lvl 51: type a, lvl 52: type b, lvl 53: type a, lvl 54: type b etc... )
for 100-150 I need another type of lvl that interleaves with the other ones (ex: lvl 101: type a, lvl 102: type b, lvl 103: type c, lvl 104: type a, lvl 105: type b etc.)
for 150-200 I add another type and they repeat the same...
and for the rest lets say I dont need another type of lvl just these 4 to repeat themselves
I want the algorithm to be flexible so if I want on lvl 1000 to add another type (ex type e) to implement it easy.
The real problem is that as all apps like this one needs to be updated and to receive more lvls. I can't really think of how can I add those lvl's very easy without messing everything up AND keeping track of what lvls I passed and what not.
For now I have a lvl variable stored in localstorage representing the lvl. For each lvl I start it actually goes within the lvl folder and shows up the images from that folder. So I would like to keep this thinking for all the rest of lvls.
So heres what I thought for now.
In the start of the app:
A variable version wich checks if the version is the same as the one from the localstorage and if not than update the lvl array.
//update the lvl array something like a loooong for wich adds the lvls that are missing from the old version to the new one. (I mean a literally long written for) I think the for is something very long:
a[i]=101a,a[i+1]=102b, a[i+2]=103c, a[i+3]=104a... And I think I have to write down each lvl in that for... (that 101 is actually an a type, and that 102 is actually a b type etc.)
after the update is done
I can shuffle that lvl array (ex.... 44a,102b, 34a, 56b, 103c.....) and before each start of lvl I search the first a type that is in range of 1-50 if my current lvl is <50 or 50-100 if my current lvl is between 50 and 100 etc. and display it. (because it'll be nice the lvl 948 if it's a type a to be a little harder than lvl 1 type a. Harder I mean through a more difficult picture) If the user completes that lvl, an x should be added to the start of the lvl name or simply to replace that lvl name with something. Next search the first b. Next search the first c etc.
This is what I thought for now. I not sure if its the right thinking or if I just harden the it as a beginner. I have really no idea for now how to implement it exactly but if somebody can help me with a complete example wich I can implement further in my app I'll very gratefull to that guy :)
Thank you!