Squaby Demo
import QtQuick 2.0
import Felgo 4.0
import "../../levels"
Column {
Item {
width: perfPlayButton.width
height: perfPlayButton.height
property bool gameIsRunning: true
SingleSquabySprite {
id: perfPlayButton
source: Qt.resolvedUrl(parent.gameIsRunning ? "../../../assets/img/menu_labels/perf_pause.png" : "../../../assets/img/menu_labels/perf_play.png")
}
MouseArea {
anchors.fill: perfPlayButton
onClicked: {
if(parent.gameIsRunning) {
scene.pauseScene()
} else {
scene.enterScene()
}
parent.gameIsRunning^=1
}
}
}
Item {
width: perfMenuButton.width
height: perfMenuButton.height
SingleSquabySprite {
id: perfMenuButton
source: Qt.resolvedUrl("../../../assets/img/menu_labels/perf_menu.png")
}
MouseArea {
anchors.fill: perfMenuButton
onClicked: {
if(itemEditor.visible) {
if(itemEditor.currentEditableType === "Performance Settings") {
hud.changeToBuildMenu()
} else {
itemEditor.currentEditableType = "Performance Settings"
itemEditor.searchAndDisplayHeaderGroup("Game Performance")
}
} else {
hud.changeFromBuildMenu()
itemEditor.currentEditableType = "Performance Settings"
itemEditor.searchAndDisplayHeaderGroup("Game Performance")
}
}
}
}
EditableComponent {
id: editableEditorComponent
editableType: "Performance Settings"
defaultGroup: "Game Performance"
preventStorage: true
properties: {
"perfRaster": {"label": "Raster"},
"displayHUD": {"label": "HUD"},
"displayScore": {"label": "Score"},
"displayLifes": {"label": "Lives"},
"displayBG": {"label": "Background"},
"particles": {"label": "Particles"},
"reset": {"label": "Delete All"},
"aimingAtNailgun": {"label": "NailGun Aim"},
"aimingAtFlamethrower": {"label": "Flamethrower Aim"},
"obstacles": {"label": "Obstacles"},
"waypoints": {"label": "Waypoints"},
}
}
property bool perfRaster: true
onPerfRasterChanged: raster.visible ^=1
property bool displayHUD: true
onDisplayHUDChanged: hud.visible ^=1
property bool displayScore: true
onDisplayScoreChanged: scoreRow.visible ^=1
property bool displayLifes: true
onDisplayLifesChanged: livesRow.visible ^=1
property bool displayBG: true
onDisplayBGChanged: levelBackground.visible ^=1
property bool waves: false
onWavesChanged: squabyCreator.enabled ^=1
property bool particles: settings.particlesEnabled
onParticlesChanged: settings.particlesEnabled = particles
property bool testSquaby: false
onTestSquabyChanged: level.createYellowSquaby ^=1
property bool reset: true
onResetChanged: scene.removeAllSquabiesAndTowers()
property bool aimingAtNailgun: true
onAimingAtNailgunChanged: {
var obstacles = entityManager.getEntityArrayByType("nailgun")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].emitAimingAtTargetSignal ^= 1
}
}
property bool aimingAtFlamethrower: true
onAimingAtFlamethrowerChanged: {
var obstacles = entityManager.getEntityArrayByType("flamethrower")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].emitAimingAtTargetSignal ^= 1
}
}
property bool obstacles: true
onObstaclesChanged: {
var obstacles = entityManager.getEntityArrayByType("obstacle")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].visible ^= 1
}
}
property bool waypoints: true
onWaypointsChanged: {
var obstacles = entityManager.getEntityArrayByType("waypoint")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].visible ^= 1
}
obstacles = entityManager.getEntityArrayByType("pathSection")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].visible ^= 1
}
}
property bool ftShooting: false
onFtShootingChanged: {
var obstacles = entityManager.getEntityArrayByType("flamethrower")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].running = ftShooting
}
}
property bool ftUpgrade: false
onFtUpgradeChanged: {
var obstacles = entityManager.getEntityArrayByType("flamethrower")
for(var ii=0; ii<obstacles.length; ++ii) {
obstacles[ii].upgradeTower("damagePerSecond")
}
}
property bool sounds: settings.soundEnabled
onSoundsChanged: {
settings.soundEnabled = sounds
if(!settings.soundEnabled) {
backgroundMusic.stop();
} else {
backgroundMusic.play();