Forums

OverviewV-Play 1 SupportProperties in levels › Reply To: Properties in levels

OverviewV-Play 1 SupportProperties in levels › Reply To: Properties in levels
#6104

David

Hi Chrisu,

Yes, indeed! It is possible to store additional data! There are 2 ways to achieve it, which you can find in the Squaby Demo in the latest Daily Build:

 

1. You are using EditableComponents to define the data and use an ItemEditor to store the values which get automatically included in your level file (s. Squaby: LevelEmpty.qml).
2. You use levelData.customData to store your level data manually (s. Squaby: SquabyLevelBase.qml).

 

property alias pathEntity: pathEntity
property alias waypoints: pathEntity.waypoints

onLevelAboutToBeSaved: {
  // modify customData property so it gets stored with the level
  levelData.customData = { waypoints: squabyLevelBase.waypoints }
}

onLevelLoaded: {
  // no waypoints might have been stored
  if(levelData.customData && levelData.customData["waypoints"]) {
    pathEntity.initializeFromWaypoints(levelData.customData.waypoints)
  }
}

 

Basically when calling saveCurrentLevel() the level always gets saved also to the authorGeneratedLevelsLocation. Your code posted should work as expected. Are there any error or warning log messages? You can check the sql DB after saving the level if the level data is stored correctly. You can use SQLite Database Browser for this task on your Deskop workstation (http://sourceforge.net/projects/sqlitebrowser/).

 

Cheers,

David

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