[SOLVED]Loading Level Problem
-
I am currently working on a game which involves several levels..but
Is there any way to load the next level without overlaying the previous one?? I am using Loader to load the next qml level file.. but as Load and load new level files, it affects the entire game.. it starts to slow down animations included on my game
Is there any way to load the next level file and destroy the previous one?
-
diph: no , i believe its not..
nhojyer07
i have this code@Image{
x: 40;y: 10
width: 266;height: 179
source:"images/menu/sipnayan.png"
MouseArea{
anchors.fill: parent
onClicked: {
MouseArea.enabled=false
onClicked:pageLoader.source="Menu.qml"
}
}
}
Loader{
id:pageLoader
anchors.fill: parent
}
@ -
So you're the programmer of sipnayan.
Anyway, what I did in my project is this. The main QML only has Loaders and Connections in it.
main.qml:
@{
Loader{
id: menuLoader
source: "SceneMenu.qml"
}
Loader{
id: gameLoader
anchors.fill: parent
}
Connections {
id: menuConnection
target: menuLoader.item
onGamestart: {
gameLoader.source = "SceneGame.qml"
menuLoader.source = ""
}
}
}@SceneMenu.qml:
@{
...
signal gamestartMouseArea{onClicked: gamestart}
}@When the player clicks the mouse area in scenemenu.qml, the gamestart signal is triggered, passed to menuConnection, and changes the sources of the Loaders.