Hello,
I have been trying to get my lives bar to work, basicaly i just want sprites of my ship to show in the right bottom corner. So i made an QML with the name of Lives. And have an property called lives which i add and subtract from.
Now how to mange how many ship to be seen is my problem, i tried to use if and else and also for, but you cant use that in an Flow{}. so i did the following and it works but i feels like it would be an better way with better code?
Flow {
width: 100
height: 20
anchors.bottom: scene.gameWindowAnchorItem.bottom
anchors.right: scene.gameWindowAnchorItem.right
layoutDirection: "RightToLeft"
Lives{visible: lives == 3}
Lives{visible: lives == 3}
Lives{visible: lives == 3}
Lives{visible: lives == 2}
Lives{visible: lives == 2}
Lives{visible: lives == 1}
}
I am thinking if i want in the future to add some kind of explosion in the menu this solution wont work.
Would love if someone could give me some advice=)?
/Isak