Forums

OverviewV-Play 1 SupportChange Z-Position of QML Items at run time › Re: Change Z-Position of QML Items at run time

OverviewV-Play 1 SupportChange Z-Position of QML Items at run time › Re: Change Z-Position of QML Items at run time
#4049

Christian
V-Play Team

Hi Chris,

thanks for your answer.

I didn’t really create the items dynamically, they are all created in declarative QML, the grid is done via a Repeater-element, and the other items are in LevelXX.qml files, which are loaded by a Loader-element

Actually, the z-ordering works fine when i just specify the “z” property of all my entities.

But the problem is: because of the 2.5D-look, items in the lowest row have to be drawn above items in the second row from the bottom, and so on. If you look closely at the player, the wall beneath him overlaps him, which is intentional.

So the z-order formula is this:

z: row * 10 + level

Which works fine to build up the level. (“row” is the y value in the grid, so 0,1,…4 and “level” is the vertical position on an imaginary axis pointing out of the screen, which can be 0,1 or 2 right now)

But when the row-value changes, the ordering needs to change, because then sometimes a box in a lower row has to overlap another box, which previously wasn’t the case.

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