Results 1 to 4 of 4

Thread: Qt game with levels and saving the state!

  1. #1
    Join Date
    Jun 2016
    Posts
    2

    Default Qt game with levels and saving the state!

    hi,
    I'm trying to make a game with Qt/C++. everything is ok, but now I want to have 2 levels in the game. and the other thing I want is the ability to save and load the game. I mean playing the game after awhile from the state that it was last time.
    the game is plants vs. zombies. everything is like that and in the second level just type of zombies are different. I think I should use files for this stuff but i don't know what the format should be and what should I write in file?

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Qt game with levels and saving the state!

    That's entirely up to you of course. Typically you would load/save all of the state variables you would need in order to continue exactly where the player left off. e.g. player name/number, position, score, level, health, money, list of acquired items, and on and on.

    You can load/save this info to/from files, ini settings, xml, json, etc. No real standard exists, so it's entirely up to you!
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  3. #3
    Join Date
    Jun 2016
    Posts
    2

    Default Re: Qt game with levels and saving the state!

    yes, thanks!
    i want to use CSV or JSON but i don't know what is json :-"" and how should I use it?

  4. #4
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Qt game with levels and saving the state!

    If you don't know what JSON is, then I'd advise you to stick with CSV. You can google JSON of course, but if you're just starting out, you might want to focus on the programming and logic for your game, rather than spend time on something that the user doesn't really care *how* it works, only that it works!

    Good luck.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

Similar Threads

  1. Saving state of nested widgets
    By SeanM in forum Qt Programming
    Replies: 3
    Last Post: 10th May 2014, 11:08
  2. Replies: 1
    Last Post: 22nd May 2010, 07:38
  3. saving the state of the ui
    By zgulser in forum Qt Programming
    Replies: 3
    Last Post: 24th March 2009, 12:17
  4. Saving state of connections
    By Chuk in forum Qt Programming
    Replies: 11
    Last Post: 26th August 2007, 17:01
  5. [QT4] Saving a widget state
    By KShots in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2006, 14:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.