Forums

OverviewV-Play 1 SupportRead Infos from files › Reply To: Read Infos from files

OverviewV-Play 1 SupportRead Infos from files › Reply To: Read Infos from files
#4666

Christian
V-Play Team

If you just read levels, it is easier to define the levels in QML file and you do not need the loading from a file.

Have a look at the demo games like Squaby, where this concept is shown in detail.

Consider the following code:

LevelBase.qml:
Item {
 // the blocks variant could be any array or a map you define in the levels
 property variant blocks
}

Level01.qml:
LevelBase {
 // enter any level data here you need for your game
 blocks: [[10, 30, 50], [5, 10, 5]]
}

then, for loading the level:
Loader {
 source: "Level01.qml" // select any level here, possibly from a level selection scene
}

 

This is the suggested workflow with QML. File reading is only necessary if you also want to save some files, which is not the case I guess.

Cheers, Chris

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support