Hi,
I’m developing game like ant smasher. In my ‘SceneGame.qml’, I’ll create multiple entities from ‘Snail.qml’ using entityManager.createEntityFromUrl(Qt.resolvedUrl(“entities/Snail.qml”)).
Snail.qml will emit smashed() signal when it get clicked. But how to connect the signal from Snail to SceneGame?
=== SceneGame.qml ===
function createEntities()
{
entityManager.createEntityFromUrl(Qt.resolvedUrl("entities/Snail.qml"));
entityManager.createEntityFromUrl(Qt.resolvedUrl("entities/Snail.qml"));
}
=== Snail.qml ===
MouseArea
{
anchors.fill: colliderCiput
onClicked:
{
pathMovement.stop()
soundSplat.play()
timerSplat.start()
spriteSnail.opacity = 0
imgSplat.opacity = 1
smashed() // Signal
}
}