![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | 358JH33E |
I’m trying to make a “library” of minigames that can be loaded into a queue and played.
Within this all-encompassing library, I would want a smaller library for each level, which would have its own unique games. Within that, the games would hold their data (like a title, description, time limit, etc).
In other words, a LIBRARY that stores LEVELS which store GAMES which store DATA.
Originally, my plan was to do an array like this:
tldr: library[level][game][game_data]
var library = [
var level_1 = [
var gameA = [
"Title A",
"Description A",
30
],
var gameB = [
"Title C",
"Description C",
10
],
var gameC = [
"Title C",
"Description C",
60
]
],
var level_2 = [
var gameD = [
"Title D",
"Description D",
30
],
var gameE = [
"Title E",
"Description E",
10
],
var gameF = [
"Title F",
"Description F",
60
],
]
]
This doesn’t compile though because you can’t nest declarations like that. It also looks like a huge mess. If an actual programmer looked at this they might pull all their hair out and strangle me.
What’s the best way to go about doing something like this? The end goal is to store games neatly so that they can be added to a queue. I figured arrays would be the best way to do that, but I am curious to know if there are any smarter solutions to this problem.