[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?
-
I'm not sure if I understood, but if you are using one Loader it should destroy the previous one when new component is loaded.
-
If this is what you're doing, then it will really lag:
main.qml
{
Loader {source: new.qml}
}new.qml
{
Loader{source: newer.qml}
} -
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
}
@ -
You just want to show menu on top of the application without filling the whole app area?
@Loader {
id: pageLoader
anchors { left: parent.left; right: parent.right; bottom: parent.bottom }
height: 100
}@ -
no.. there's a new "page" for that
-
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.
-
and? can you please elaborate further? :D PUHLEASE :3