Squaby Demo
import Felgo 4.0
import QtQuick 2.0
import "../entities"
LevelBase {
id: squabyLevelBase
property alias pathEntity: pathEntity
property alias waypoints: pathEntity.waypoints
property string nextLevelId
property int difficulty
property int maxPlayerLife
property int startGold
property bool endlessGame
property variant towerPermissions
onLevelAboutToBeSaved: {
console.debug("SquabyLevelBase: onLevelAboutToBeSaved()")
levelData.customData = { waypoints: squabyLevelBase.waypoints }
}
onLevelLoaded: {
console.debug("SquabyLevelBase: onLevelLoaded()")
if(levelData.customData && levelData.customData["waypoints"]) {
console.debug("loaded waypoints dynamically from customData:", JSON.stringify(levelData.customData))
pathEntity.initializeFromWaypoints(levelData.customData.waypoints)
}
}
PathEntity {
id: pathEntity
onWaypointsChanged: {
var pooledSquabies = entityManager.getPooledEntityArrayByType("squaby")
for(var ii=0; ii<pooledSquabies.length; ++ii) {
pooledSquabies[ii].movementAnimationNeedUpdate = true
}
var squabies = entityManager.getEntityArrayByType("squaby")
for(var ii=0; ii<squabies.length; ++ii) {
squabies[ii].movementAnimationNeedUpdate = true
}
}
}
property int squabyDelayDecrementPerWave: 100
property int pauseBetweenWavesDecrementPerWave: 300
property int minimumSquabyDelay: 500
property int minimumPauseBetweenWaves: 500
property variant waves