Forums

OverviewV-Play 1 SupportDynamically changing the parent of a QML item › Re: Dynamically changing the parent of a QML item

OverviewV-Play 1 SupportDynamically changing the parent of a QML item › Re: Dynamically changing the parent of a QML item
#4085

Christian
V-Play Team

Quote from Christian on January 3, 2013, 21:03
Do you set the new z order when you re-create the tiles for the new level?

The z value is a dynamic property with the formula

z: row * 25 + level * 5 + priority

So when I print the z values after loading a level, it’s correct:

tile at 0/0.z: 5
tile at 1/0.z: 0
tile at 2/0.z: 0
tile at 3/0.z: 0
tile at 4/0.z: 0
tile at 5/0.z: 0
tile at 6/0.z: 0
tile at 7/0.z: 0
tile at 8/0.z: 0
tile at 0/1.z: 30
tile at 1/1.z: 25
tile at 2/1.z: 25
tile at 3/1.z: 25
tile at 4/1.z: 25
tile at 5/1.z: 25
tile at 6/1.z: 25
tile at 7/1.z: 25
tile at 8/1.z: 25
tile at 0/2.z: 55
tile at 1/2.z: 50
tile at 2/2.z: 50
tile at 3/2.z: 50
tile at 4/2.z: 50
tile at 5/2.z: 50
tile at 6/2.z: 50
tile at 7/2.z: 50
tile at 8/2.z: 50
tile at 0/3.z: 80
tile at 1/3.z: 75
tile at 2/3.z: 75
tile at 3/3.z: 75
tile at 4/3.z: 75
tile at 5/3.z: 75
tile at 6/3.z: 75
tile at 7/3.z: 75
tile at 8/3.z: 75
tile at 0/4.z: 105
tile at 1/4.z: 105
tile at 2/4.z: 105
tile at 3/4.z: 100
tile at 4/4.z: 105
tile at 5/4.z: 105
tile at 6/4.z: 105
tile at 7/4.z: 105
tile at 8/4.z: 105

With the first index being the column, the second being the row.
So every row has higher z values than the row above it, and if the item is at a higher level (which is the “3rd dimension” in my game), it’s also a bit higher.
This is the same when using pooling, or when not using pooling (but without everything is displayed correctly)

But it still looks like in the screenshot.

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