The data stored in a dynamically created level with LevelEditor available from LevelBase. More...

Import Statement: import VPlay 2.0



Detailed Description

The LevelData contains the data of a level created with LevelEditor::saveCurrentLevel() or LevelEditor::createNewLevel(). It is accessible either from LevelBase::levelData or LevelEditor::currentLevelData once the level got loaded with LevelEditor::loadSingleLevel().

See also LevelBase and LevelEditor.

Property Documentation

customData : variant

Use this optional property to store any additional data to the level that gets changed during the game.

levelMetaData : variant

This property holds the metaData of this level like the levelName, description, levelBaseName or levelBaseUrl. The levelMetaData is available before a level is actually loaded with LevelEditor::loadSingleLevel(). Thus store any information here you want to display in the LevelSelectionList.

The levelMetaData changes based on the LevelEditor::currentLevelStorageLocation. For example, a level that was published to the game community with LevelEditor::publishLevel() has more properties like avg_rating or times_downloaded, which are not existing for local levels.

This is an example for a levelMetaData from an LevelEditor::authorGeneratedLevels from the Squaby Demo:

   "levelName":"Great Level",
   "creationTime":"Fri, 03 May 2013 14:48:01 GMT",
   "lastModificationTime":"Fri, 03 May 2013 14:48:01 GMT",

These are the keys for a LevelEditor::userGeneratedLevels location for a level published for level sharing with LevelEditor::publishLevel():

   "levelId": 2,
   "levelName": "Level Name",
   "description": "Level description",
   "average_quality": 0,
   "average_difficulty": 0,
   "times_quality_rated": 0,
   "times_difficulty_rated": 0,
   "times_favored": 0,
   "times_downloaded": 0,
   "times_played": 0,
   "created_at": "2013-05-13T14:43:57Z",
   "updated_at": "2013-05-13T14:43:57Z",
   "rating": {
     "difficulty": 0,
     "quality": 1,
     "favored": false,
     "times_played": 0
   "user": {
     "id": 8,
     "facebook_id": "asdf2",
     "profile_picture": null,
     "name": "Chris",
     "platform": "Android"

The user block contains information about the user who published the level, i.e. the level creator.

The rating block contains the rating for the logged in user sent with LevelEditor::rateLevel() before. If the user did not rate the level yet, this block does not exist.

Use these properties to display the level in the LevelSelectionList::levelItemDelegate. For example to show the level name, set the following as the delegate:

 import VPlay 2.0

 SimpleButton {
   height: 20
   width: levelSelectionList.width

   // the levelName is a key of levelMetaData (=modelData)
   // you can access all the properties here
   text: modelData.levelName

   onClicked: {
 }// end of SimpleButton

See the Stack With Friends Demo for a full example how to customize a LevelSelectionList::levelItemDelegate.

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
create apps
create games
cross platform
native performance
3rd party services
game network
level editor
easiest to learn
biggest time saving
best support