How to make a database with various levels?
-
Hi, I´m creating a simple game that have multiple lvls, and this levels should be blocked until you pass the first lvl with a minimum score, how to do this if the game have 4 separated sites with 15 levels for each site, the gameengine is created in javascript and qml for the lvls, how I make to save the score, with a database for each lvl?
the levels are independent, one lvl and when you pass it, load other level, I have a selection menu for select the lvls.Thanks for this.
other question, al lvls are moved by 1 timer, when I make some multimediakit soundeffect (a explosion) the timer apears to be freeze a few moment and all of the images freeze, when the music stops its the same,stops 1 or 2 frames and later all works ok, the cpu of the mobile is in 65% with sounds, what happening? the timer moves 14 items at the same time.thanks for all and sorry for my english.
-
[quote author="tommyj23" date="1329152284"] how I make to save the score, with a database for each lvl?
[/quote]Qt offers drivers for "several databases":http://developer.qt.nokia.com/doc/qt-4.8/sql-driver.html. I recommend you to use "SQLite":http://www.sqlite.org/
-
yes this is that I think, but, 1 database for 1 level? because my game have 15 lvls at the beginning but later may be have more... at the moment I create 4 database for the first 4 levels and it runs ok because you need to have a minimum of score to unlock the next lvl, the test are good at the moment.
Is there another way to do this?The other think that give me headache is the timer that freeze when I play the sound I dont know why it freeze...
-
Why do you need to have one database per level? The fact that you have to reach a certain condition to move to the next level should have no bearing on how your database is designed and accessed.
Perhaps you need to rethink your database design and core game level logic.
-
XML Files are nice
I use one xml which contains basically the names of all other xml files or levels, then if the user selects a level I load the xml file for that level! ie
all_levels.xml
<level xml=level1.xmll>
<level xml=level2.xmll>
<level xml=level3.xmll>
<level xml=level4.xmll>Bests
-
I see that way in the qt-flying bus example, but I make the lvls with qml, and one loader that read a signal next game and change the level, but the way to make that the level-loader read the scores of each level is this that I dont know how to do.
I do this to make one database to the first lvl:
@function guardardatos() {
var db = openDatabaseSync("lvl1", "1.0", "primerlvl", 1000000);
var rs;db.transaction( function(tx) { // Create the database if it doesn't already exist tx.executeSql('CREATE TABLE IF NOT EXISTS Niveluno(uno INT, dos INT)'); // Add (another) greeting row tx.executeSql('INSERT INTO Niveluno VALUES(?, ?)', [ recto.score, recto.burbujas1]); // Show all added greetings rs = tx.executeSql('SELECT * FROM Niveluno ORDER BY uno desc LIMIT 1'); } ) if (rs.rows.length > 0) { var record = rs.rows.item(0); recto.lvl1 = record.uno; }
}@
When the lvl ends I write 2 values: the score and and the quantity of bubbles eated,
lather I created a other datbase called guardarDatos1() for the lvl 2 etc..., when I start the game one Timer reads all the databases and update the scores in the levelmenu and show which is active, pased with his score and which is bocked to the user. I dont know other form to make this, and in C++ buff is other world.if other knows other form to do this please explain me!!