Squaby Demo
import QtQuick 2.0
import Felgo 4.0
import "../entities"
import "../balancing"
Item {
id: level
width: parent.width
height: parent.width
property bool createYellowSquaby: true
property alias levelLoader: levelLoader
property variant pathEntity: levelLoader.loadedLevel ? levelLoader.loadedLevel.pathEntity : null
property variant waves: levelLoader.loadedLevel ? levelLoader.loadedLevel.waves : null
property variant nextLevelId: levelLoader.loadedLevel ? levelLoader.loadedLevel.nextLevelId : null
property variant difficulty: levelLoader.loadedLevel ? levelLoader.loadedLevel.difficulty : null
property variant maxPlayerLife: levelLoader.loadedLevel ? levelLoader.loadedLevel.maxPlayerLife : null
property variant startGold: levelLoader.loadedLevel ? levelLoader.loadedLevel.startGold : null
property variant endlessGame: levelLoader.loadedLevel ? levelLoader.loadedLevel.endlessGame : null
property variant towerPermissions: levelLoader.loadedLevel ? levelLoader.loadedLevel.towerPermissions : null
property alias loadedLevel: levelLoader.loadedLevel
LevelLoader {
id: levelLoader
Component.onCompleted: {
console.debug("SquabyLevelContainer: LevelLoader.onCompleted - pathEntity:", pathEntity, "item:", levelLoader.loadedLevel)
}
onLoaded: {
console.debug("________________SquabyLevelContainer: loaded with LevelLoader:", levelSource)
}
}
function preCreateEntitiesForPool() {
if(system.isPlatform(System.Meego) || system.isPlatform(System.Symbian))
return;
entityManager.createPooledEntitiesFromComponent(sy, 5);
entityManager.createPooledEntitiesFromComponent(sgreen, 3);
entityManager.createPooledEntitiesFromComponent(so, 2);
entityManager.createPooledEntitiesFromComponent(sr, 2);
entityManager.createPooledEntitiesFromComponent(sgrey, 2);
entityManager.createPooledEntitiesFromComponent(sblue, 2);
}
property alias balancingSettings: balancingSettings
BalancingSettings {
id: balancingSettings
}
SquabyTypes {
id: squabyTypes
}
Binding {
target: player
property: "balancingSettings"
value: balancingSettings
}
property alias sy: squabyTypes.squabyYellow
property alias so: squabyTypes.squabyOrange
property alias sr: squabyTypes.squabyRed
property alias sgreen: squabyTypes.squabyGreen
property alias sblue: squabyTypes.squabyBlue
property alias sgrey: squabyTypes.squabyGrey
Obstacle {
id: bed
x: 486
y: 207
variationType: "bed"
}
Obstacle {
id: closet
x: -5
y: 0
variationType: "closet"
}
Obstacle {
id: closetDoor1
anchors.left: closet.right
anchors.top: closet.top
variationType: "closet-door1"
}
Obstacle {
id: closetDoor2
anchors.left: closet.right
anchors.bottom: closet.bottom
variationType: "closet-door2"
}
MouseArea {
enabled: cheatMoneyEnabled
anchors.fill: closet
onClicked: {
if(scene.state === "levelEditing")
return
player.gold += 100
}
}
MouseArea {
enabled: developerBuild
x: bed.x - bed.width/2
y: bed.y - bed.height/2
width: bed.width
height: bed.height
onClicked: {
if(scene.state === "levelEditing")
return
if(createYellowSquaby)
entityManager.createEntityFromComponent(sy);
else
entityManager.createEntityFromComponent(sgrey);
}
}
Component.onCompleted: {
console.debug("SquabyLevelContainer.onCompleted");
console.debug("___________entityManager:", entityManager, ", entityContainer:", entityManager.entityContainer)
}