aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/particles/plasmapatrol
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/particles/plasmapatrol')
-rw-r--r--examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml28
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Button.qml12
-rw-r--r--examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml14
-rw-r--r--examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml16
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Cruiser.qml28
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Frigate.qml18
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Hardpoint.qml38
-rw-r--r--examples/declarative/particles/plasmapatrol/content/HelpScreens.qml84
-rw-r--r--examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml22
-rw-r--r--examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml34
-rw-r--r--examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml4
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Ship.qml27
-rw-r--r--examples/declarative/particles/plasmapatrol/content/Sloop.qml18
-rw-r--r--examples/declarative/particles/plasmapatrol/plasmapatrol.qml126
14 files changed, 236 insertions, 233 deletions
diff --git a/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml
index 3e751f4e15..4d34c6c37f 100644
--- a/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml
+++ b/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml
@@ -53,14 +53,14 @@ Item {
width: 24
height: 24
- Emitter{
+ Emitter {
id: visualization
group: "blaster"
system: container.system
enabled: show
anchors.fill: parent
- shape: EllipseShape{}
- speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true}
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true}
lifeSpan: 1000
emitRate: 64
@@ -70,7 +70,7 @@ Item {
}
property int blastsLeft: 0
- function fireAt(targetArg, container){
+ function fireAt(targetArg, container) {
target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
targetObj = targetArg;
hardpoint = container;
@@ -78,22 +78,22 @@ Item {
rofTimer.repeat = true;
rofTimer.start();
}
- Timer{
+ Timer {
id: rofTimer
interval: 30;//Has to be greater than 1 frame or they stack up
running: false
repeat: false
- onTriggered:{
- if(targetObj.hp <= 0)
+ onTriggered: {
+ if (targetObj.hp <= 0)
return;
//TODO: calculate hit and damage at target, which must be a Ship
var hit;
- if(blastsLeft >= bonusBlasts)
+ if (blastsLeft >= bonusBlasts)
hit = Math.random() > targetObj.dodge;
else
hit = false; //purely aesthetic shots, because the damage isn't that fine grained
- if(hit == true){
- switch(targetObj.shipType){
+ if (hit == true) {
+ switch (targetObj.shipType) {
case 1: hardpoint.damageDealt += 4; break;
case 2: hardpoint.damageDealt += 5; break;
case 3: hardpoint.damageDealt += 1; break;
@@ -102,17 +102,17 @@ Item {
}
blastVector.targetX = target.x;
blastVector.targetY = target.y;
- if(!hit){//TODO: Actual targetVariation
+ if (!hit) {//TODO: Actual targetVariation
blastVector.targetX += (128 * Math.random() - 64);
blastVector.targetY += (128 * Math.random() - 64);
}
emitter.burst(1);
blastsLeft--;
- if(!blastsLeft)
+ if (!blastsLeft)
rofTimer.repeat = false;
}
}
- Emitter{
+ Emitter {
id: emitter
group: "blaster"
enabled: false
@@ -125,7 +125,7 @@ Item {
size: 24
endSize:16
sizeVariation: 8
- speed: TargetDirection{
+ speed: TargetDirection {
id: blastVector
targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
}
diff --git a/examples/declarative/particles/plasmapatrol/content/Button.qml b/examples/declarative/particles/plasmapatrol/content/Button.qml
index 9ca7912037..4ec29c8a06 100644
--- a/examples/declarative/particles/plasmapatrol/content/Button.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Button.qml
@@ -41,25 +41,25 @@
import QtQuick 2.0
//TODO: Add particles to this component too
-Rectangle{
+Rectangle {
id: container
property alias text: txt.text
signal clicked
//color: "lightsteelblue"
- gradient: Gradient{
- GradientStop{ position: 0.0; color: "lightsteelblue" }
- GradientStop{ position: 1.0; color: "steelblue" }
+ gradient: Gradient {
+ GradientStop { position: 0.0; color: "lightsteelblue" }
+ GradientStop { position: 1.0; color: "steelblue" }
}
height: 64
radius: 16
width: 128
- Text{
+ Text {
id: txt
anchors.centerIn: parent
font.pixelSize: 24
color: "white"
}
- MouseArea{
+ MouseArea {
anchors.fill: parent
onClicked: container.clicked()
}
diff --git a/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml
index dc15f0cae1..48f7dd045b 100644
--- a/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml
+++ b/examples/declarative/particles/plasmapatrol/content/CannonHardpoint.qml
@@ -49,7 +49,7 @@ Item {
width: 24
height: 24
- Emitter{
+ Emitter {
id: visualization
group: "cannon"
enabled: container.show
@@ -62,14 +62,14 @@ Item {
endSize: 0
}
- function fireAt(targetArg, hardpoint){
+ function fireAt(targetArg, hardpoint) {
target = container.mapFromItem(targetArg, targetArg.width/2, targetArg.height/2);
- if(container.hp <= 0 || targetArg.hp <= 0)
+ if (container.hp <= 0 || targetArg.hp <= 0)
return;
//TODO: calculate hit and damage at target, which must be a Ship
var hit = Math.random() > targetArg.dodge
- if(hit){
- switch(targetArg.shipType){
+ if (hit) {
+ switch (targetArg.shipType) {
case 1: hardpoint.damageDealt += 8; break;
case 2: hardpoint.damageDealt += 10; break;
case 3: hardpoint.damageDealt += 16; break;
@@ -78,7 +78,7 @@ Item {
}
emitter.burst(1);
}
- Emitter{
+ Emitter {
id: emitter
group: "cannon"
enabled: false
@@ -89,7 +89,7 @@ Item {
emitRate: 1
size: 8
endSize: 4
- speed: TargetDirection{
+ speed: TargetDirection {
id: blastVector
targetX: target.x; targetY: target.y; magnitude: 1.1; proportionalMagnitude: true
}
diff --git a/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml b/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml
index 8a4363d663..6f02b789e8 100644
--- a/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml
+++ b/examples/declarative/particles/plasmapatrol/content/ChoiceBox.qml
@@ -41,27 +41,27 @@
import QtQuick 2.0
import QtQuick.Particles 2.0
-Item{
+Item {
id: container
width: 360
height: 160
property ParticleSystem system
- Ship{
+ Ship {
id: nully
system: system
}
property Item target: nully
/*
- Component.onCompleted:{
+ Component.onCompleted: {
container.target.shipType = 1
container.target.gunType = 1
}
*/
- Row{
+ Row {
anchors.horizontalCenter: parent.horizontalCenter
height: parent.height
spacing: 8
- Button{
+ Button {
width: 80
height: 80
anchors.verticalCenter: parent.verticalCenter
@@ -75,11 +75,11 @@ Item{
container.target.shipType = nextVal;
}
}
- Item{
+ Item {
width: 128
height: 128
anchors.verticalCenter: parent.verticalCenter
- Ship{
+ Ship {
hp: 20
anchors.centerIn: parent
shipType: container.target.shipType
@@ -87,7 +87,7 @@ Item{
system: container.system
}
}
- Button{
+ Button {
width: 80
height: 80
anchors.verticalCenter: parent.verticalCenter
diff --git a/examples/declarative/particles/plasmapatrol/content/Cruiser.qml b/examples/declarative/particles/plasmapatrol/content/Cruiser.qml
index a4983fc2a0..8497f7abe1 100644
--- a/examples/declarative/particles/plasmapatrol/content/Cruiser.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Cruiser.qml
@@ -54,7 +54,7 @@ Item {
property int gunType: 0
width: 128
height: 128
- Emitter{
+ Emitter {
//TODO: Cooler would be an 'orbiting' affector
//TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
system: container.system
@@ -62,7 +62,7 @@ Item {
anchors.centerIn: parent
width: 64
height: 64
- shape: EllipseShape{}
+ shape: EllipseShape {}
emitRate: hp > 0 ? hp * 1 + 20 : 0
lifeSpan: 2400
@@ -72,13 +72,13 @@ Item {
sizeVariation: 16
endSize: 16
- speed: AngleDirection{angleVariation:360; magnitudeVariation: 32}
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 32}
}
- Emitter{
+ Emitter {
system: container.system
group: "cruiserArmor"
anchors.fill: parent
- shape: EllipseShape{ fill: false }
+ shape: EllipseShape { fill: false }
enabled: hp>0
emitRate: 16
@@ -87,7 +87,7 @@ Item {
size: 48
sizeVariation: 24
- SpriteGoal{
+ SpriteGoal {
id: destructor
system: container.system
enabled: container.hp <=0
@@ -99,27 +99,27 @@ Item {
}
}
- Timer{
+ Timer {
id: fireControl
property int next: Math.floor(Math.random() * 3) + 1
interval: 800
running: root.readySetGo
repeat: true
- onTriggered:{
- if(next == 1){
+ onTriggered: {
+ if (next == 1) {
gun1.fireAt(container.target);
next = Math.floor(Math.random() * 3) + 1;
- }else if(next == 2){
+ } else if (next == 2) {
gun2.fireAt(container.target);
next = Math.floor(Math.random() * 3) + 1;
- }else if(next == 3){
+ } else if (next == 3) {
gun3.fireAt(container.target);
next = Math.floor(Math.random() * 3) + 1;
}
}
}
- Hardpoint{//TODO: Hardpoint abstraction
+ Hardpoint {//TODO: Hardpoint abstraction
x: 112 - 12 - 8*2
y: 128 - 12 - 12*2
id: gun1
@@ -127,7 +127,7 @@ Item {
show: hp > 0
hardpointType: gunType
}
- Hardpoint{
+ Hardpoint {
x: 64 - 12
y: 0 - 12 + 12*2
id: gun2
@@ -135,7 +135,7 @@ Item {
show: hp > 0
hardpointType: gunType
}
- Hardpoint{
+ Hardpoint {
x: 16 - 12 + 8*2
y: 128 - 12 - 12*2
id: gun3
diff --git a/examples/declarative/particles/plasmapatrol/content/Frigate.qml b/examples/declarative/particles/plasmapatrol/content/Frigate.qml
index f26e7e881c..c7088cf1a5 100644
--- a/examples/declarative/particles/plasmapatrol/content/Frigate.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Frigate.qml
@@ -54,7 +54,7 @@ Item {
property int gunType: 0
width: 128
height: 128
- Emitter{
+ Emitter {
system: container.system
group: "frigateShield"
anchors.centerIn: parent
@@ -63,13 +63,13 @@ Item {
lifeSpan: 4800
enabled: hp > 0
}
- Emitter{
+ Emitter {
system: container.system
group: container.shipParticle
anchors.centerIn: parent
width: 64
height: 16
- shape: EllipseShape{}
+ shape: EllipseShape {}
size: 16
sizeVariation: 8
@@ -78,24 +78,24 @@ Item {
lifeSpan: 1200
maximumEmitted: (maxHP * 1 + 20)*2
}
- Timer{
+ Timer {
id: fireControl
property int next: Math.floor(Math.random() * 2) + 1
interval: 800
running: root.readySetGo
repeat: true
- onTriggered:{
- if(next == 1){
+ onTriggered: {
+ if (next == 1) {
gun1.fireAt(container.target);
next = Math.floor(Math.random() * 2) + 1;
- }else if(next == 2){
+ } else if (next == 2) {
gun2.fireAt(container.target);
next = Math.floor(Math.random() * 2) + 1;
}
}
}
- Hardpoint{
+ Hardpoint {
x: 128 - 32 - 12
y: 64 - 12
id: gun1
@@ -103,7 +103,7 @@ Item {
show: hp > 0
hardpointType: gunType
}
- Hardpoint{
+ Hardpoint {
x: 0 + 32 - 12
y: 64 - 12
id: gun2
diff --git a/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml b/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml
index c6af805856..62a6ceb2c5 100644
--- a/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Hardpoint.qml
@@ -53,7 +53,7 @@ Item {
property Item targetObj: null
property int damageDealt: 0
onDamageDealtChanged: dealDamageTimer.start();
- Timer{
+ Timer {
id: dealDamageTimer
interval: 16
running: false
@@ -62,49 +62,51 @@ Item {
}
width: 24
height: 24
- function fireAt(targetArg){//Each implement own
- if(targetArg != null){
+ function fireAt(targetArg) {//Each implement own
+ if (targetArg != null) {
hardpointLoader.item.fireAt(targetArg, container);
targetObj = targetArg;
}
}
- Loader{
+ Loader {
id: hardpointLoader
- sourceComponent: {switch(hardpointType){
- case 1: laserComponent; break;
- case 2: blasterComponent; break;
- case 3: cannonComponent; break;
- default: emptyComponent;
- }}
+ sourceComponent: {
+ switch (hardpointType) {
+ case 1: laserComponent; break;
+ case 2: blasterComponent; break;
+ case 3: cannonComponent; break;
+ default: emptyComponent;
+ }
+ }
}
- Component{
+ Component {
id: laserComponent
- LaserHardpoint{
+ LaserHardpoint {
target: container.target
system: container.system
show: container.show
}
}
- Component{
+ Component {
id: blasterComponent
- BlasterHardpoint{
+ BlasterHardpoint {
target: container.target
system: container.system
show: container.show
}
}
- Component{
+ Component {
id: cannonComponent
- CannonHardpoint{
+ CannonHardpoint {
target: container.target
system: container.system
show: container.show
}
}
- Component{
+ Component {
id: emptyComponent
Item {
- function fireAt(obj){
+ function fireAt(obj) {
console.log("Firing null weapon. It hurts.");
}
}
diff --git a/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml b/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml
index c5ae949edd..91bbee5d50 100644
--- a/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml
+++ b/examples/declarative/particles/plasmapatrol/content/HelpScreens.qml
@@ -45,25 +45,25 @@ SequentialLoader {
id: hLdr
signal exitDesired
Component.onCompleted: advance();
- ParticleSystem{ id: helpSystem }
- PlasmaPatrolParticles{ sys: helpSystem }
+ ParticleSystem { id: helpSystem }
+ PlasmaPatrolParticles { sys: helpSystem }
pages: [
- Component{Item{
+ Component {Item {
id: story
- Text{
+ Text {
color: "white"
text: "Story"
font.pixelSize: 48
}
/*
- Flickable{
+ Flickable {
y: 60
width: 360
height: 500
contentHeight: txt1.height
contentWidth: 360//TODO: Less magic numbers?
*/
- Text{
+ Text {
id: txt1
color: "white"
y: 60
@@ -77,7 +77,7 @@ You must select one such patrol unit for the border, heading into an inevitable
wrapMode: Text.WordWrap
}
// }
- Button{
+ Button {
x: 20
y: 560
height: 40
@@ -85,7 +85,7 @@ You must select one such patrol unit for the border, heading into an inevitable
text: "Next"
onClicked: hLdr.advance();
}
- Button{
+ Button {
x: 220
y: 560
height: 40
@@ -94,51 +94,51 @@ You must select one such patrol unit for the border, heading into an inevitable
onClicked: hLdr.exitDesired();
}
}},
- Component{Item{
+ Component {Item {
id: ships
- Text{
+ Text {
color: "white"
text: "Vessels"
font.pixelSize: 48
}
- Column{
+ Column {
spacing: 16
y: 60
- Row{
+ Row {
height: 128
- Sloop{
+ Sloop {
system: helpSystem
}
- Text{
+ Text {
text: "The nimble sloop"
color: "white"
font.pixelSize: 18
}
}
- Row{
+ Row {
height: 128
- Frigate{
+ Frigate {
system: helpSystem
}
- Text{
+ Text {
text: "The versitile shield frigate"
color: "white"
font.pixelSize: 18
}
}
- Row{
+ Row {
height: 128
- Cruiser{
+ Cruiser {
system: helpSystem
}
- Text{
+ Text {
text: "The armored cruiser"
color: "white"
font.pixelSize: 18
}
}
}
- Button{
+ Button {
x: 20
y: 560
height: 40
@@ -146,7 +146,7 @@ You must select one such patrol unit for the border, heading into an inevitable
text: "Next"
onClicked: hLdr.advance();
}
- Button{
+ Button {
x: 220
y: 560
height: 40
@@ -155,22 +155,22 @@ You must select one such patrol unit for the border, heading into an inevitable
onClicked: hLdr.exitDesired();
}
}},
- Component{Item{
+ Component {Item {
id: guns
- Text{
+ Text {
color: "white"
text: "Hardpoints"
font.pixelSize: 48
}
- Column{
+ Column {
spacing: 16
y: 60
- Row{
+ Row {
height: 128
- LaserHardpoint{
+ LaserHardpoint {
system: helpSystem
}
- Text{
+ Text {
text: "The laser hardpoint almost always hits the target, even the nimble sloop, but loses much of its potency against the frigate's shields"
width: 332
wrapMode: Text.WordWrap
@@ -178,12 +178,12 @@ You must select one such patrol unit for the border, heading into an inevitable
font.pixelSize: 18
}
}
- Row{
+ Row {
height: 128
- BlasterHardpoint{
+ BlasterHardpoint {
system: helpSystem
}
- Text{
+ Text {
text: "The blaster passes right through the frigate's shields but loses much of its impact against the armor of the cruiser"
width: 332
wrapMode: Text.WordWrap
@@ -191,12 +191,12 @@ You must select one such patrol unit for the border, heading into an inevitable
font.pixelSize: 18
}
}
- Row{
+ Row {
height: 128
- CannonHardpoint{
+ CannonHardpoint {
system: helpSystem
}
- Text{
+ Text {
text: "The cannon has poor accuracy, often missing the nimble sloop, but can punch right through the armor of the cruiser"
width: 332
wrapMode: Text.WordWrap
@@ -205,7 +205,7 @@ You must select one such patrol unit for the border, heading into an inevitable
}
}
}
- Button{
+ Button {
x: 20
y: 560
height: 40
@@ -213,7 +213,7 @@ You must select one such patrol unit for the border, heading into an inevitable
text: "Next"
onClicked: hLdr.advance();
}
- Button{
+ Button {
x: 220
y: 560
height: 40
@@ -222,20 +222,20 @@ You must select one such patrol unit for the border, heading into an inevitable
onClicked: hLdr.exitDesired();
}
}},
- Component{Item{
+ Component {Item {
id: strategy
- Text{
+ Text {
color: "white"
text: "Strategy"
font.pixelSize: 48
}
- Flickable{
+ Flickable {
y: 60
width: 360
height: 500
contentHeight: txt1.height
contentWidth: 360//TODO: Less magic numbers?
- Text{
+ Text {
id: txt1
color: "white"
font.pixelSize: 18
@@ -247,7 +247,7 @@ More to come after thorough playtesting.
wrapMode: Text.WordWrap
}
}
- Button{
+ Button {
x: 20
y: 560
height: 40
@@ -255,7 +255,7 @@ More to come after thorough playtesting.
text: "Story"
onClicked: {hLdr.at=0; hLdr.advance();}
}
- Button{
+ Button {
x: 220
y: 560
height: 40
diff --git a/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml b/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml
index 56fd91b5b3..007d533b56 100644
--- a/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml
+++ b/examples/declarative/particles/plasmapatrol/content/LaserHardpoint.qml
@@ -49,14 +49,14 @@ Item {
width: 24
height: 24
- Emitter{
+ Emitter {
id: visualization
group: "laser"
system: container.system
anchors.fill: parent
enabled: container.show
- shape: EllipseShape{}
- speed: TargetDirection{ targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true }
+ shape: EllipseShape {}
+ speed: TargetDirection { targetX: width/2; targetY: width/2; magnitude: -1; proportionalMagnitude: true }
lifeSpan: 1000
emitRate: 64
@@ -65,26 +65,26 @@ Item {
endSize: 8
}
- function fireAt(targetArg, hardpoint){
- if(targetArg.hp <= 0)
+ function fireAt(targetArg, hardpoint) {
+ if (targetArg.hp <= 0)
return;
//TODO: calculate hit and damage at target, which must be a Ship
var offset = 0;
- if(Math.random() < 0.99){
- switch(targetArg.shipType){
+ if (Math.random() < 0.99) {
+ switch (targetArg.shipType) {
case 1: hardpoint.damageDealt += 16; break;
case 2: hardpoint.damageDealt += 4; break;
case 3: hardpoint.damageDealt += 8; break;
default: hardpoint.damageDealt += 500; //Really effective against unregistered vessels
}
- }else{//Misses with Lasers are really rare
+ } else {//Misses with Lasers are really rare
offset = Math.random() * 100;
}
target = container.mapFromItem(targetArg, offset + targetArg.width/2, offset + targetArg.height/2);
emitter.pulse(0.10);
// console.log("Fire box: " + Math.min(container.width/2, target.x) + "," + Math.min(container.height/2, target.y) + " " + (Math.max(container.width/2, target.x) - Math.min(container.width/2, target.x)) + "," + (Math.max(container.height/2, target.y) - Math.min(container.height/2, target.y)));
}
- Emitter{
+ Emitter {
id: emitter
group: "laser"
enabled: false
@@ -93,7 +93,7 @@ Item {
width: Math.max(container.width/2, target.x) - x;
y: Math.min(container.height/2, target.y);
height: Math.max(container.height/2, target.y) - y;
- shape: LineShape{
+ shape: LineShape {
mirrored: (emitter.y < 0 || emitter.x < 0) && !(emitter.y < 0 && emitter.x < 0 )//I just want XOR
}
@@ -103,6 +103,6 @@ Item {
size: 16
endSize: 0
- speed: PointDirection{xVariation: 4; yVariation: 4}
+ speed: PointDirection {xVariation: 4; yVariation: 4}
}
}
diff --git a/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml b/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml
index 7a8c3e61b3..c68ba3b98e 100644
--- a/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml
+++ b/examples/declarative/particles/plasmapatrol/content/PlasmaPatrolParticles.qml
@@ -41,9 +41,9 @@
import QtQuick 2.0
import QtQuick.Particles 2.0
-Item{
+Item {
property ParticleSystem sys
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["default"]
source: "pics/blur-circle3.png"
@@ -51,7 +51,7 @@ Item{
colorVariation: 0.1
z: 0
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["redTeam"]
source: "pics/blur-circle3.png"
@@ -59,7 +59,7 @@ Item{
colorVariation: 0.1
z: 0
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["greenTeam"]
source: "pics/blur-circle3.png"
@@ -67,7 +67,7 @@ Item{
colorVariation: 0.1
z: 0
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["blaster"]
source: "pics/star2.png"
@@ -76,7 +76,7 @@ Item{
colorVariation: 0.2
z: 2
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["laser"]
source: "pics/star3.png"
@@ -85,7 +85,7 @@ Item{
colorVariation: 0.2
z: 2
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["cannon"]
source: "pics/particle.png"
@@ -93,7 +93,7 @@ Item{
colorVariation: 0.1
z: 2
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["cannonCore"]
source: "pics/particle.png"
@@ -101,7 +101,7 @@ Item{
colorVariation: 0.8
z: 1
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["cannonWake"]
source: "pics/star.png"
@@ -109,7 +109,7 @@ Item{
colorVariation: 0.2
z: 1
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["frigateShield"]
source: "pics/blur-circle2.png"
@@ -119,24 +119,24 @@ Item{
greenVariation: 0.1
z: 3
}
- ImageParticle{
+ ImageParticle {
system: sys
groups: ["cruiserArmor"]
z: 1
- sprites:[Sprite{
+ sprites:[Sprite {
id: spinState
name: "spinning"
source: "pics/meteor.png"
frames: 35
duration: 40
to: {"death":0, "spinning":1}
- },Sprite{
+ },Sprite {
name: "death"
source: "pics/meteor_explo.png"
frames: 22
duration: 40
to: {"null":1}
- }, Sprite{
+ }, Sprite {
name: "null"
source: "pics/nullRock.png"
frames: 1
@@ -144,13 +144,13 @@ Item{
}
]
}
- TrailEmitter{
+ TrailEmitter {
system: sys
group: "cannonWake"
follow: "cannon"
emitRatePerParticle: 64
lifeSpan: 600
- speed: AngleDirection{ angleVariation: 360; magnitude: 48}
+ speed: AngleDirection { angleVariation: 360; magnitude: 48}
size: 16
endSize: 8
sizeVariation: 2
@@ -158,7 +158,7 @@ Item{
width: 1000//XXX: Terrible hack
height: 1000
}
- TrailEmitter{
+ TrailEmitter {
system: sys
group: "cannonCore"
follow: "cannon"
diff --git a/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml b/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml
index 49c30cac4d..8167b75042 100644
--- a/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml
+++ b/examples/declarative/particles/plasmapatrol/content/SequentialLoader.qml
@@ -40,13 +40,13 @@
****************************************************************************/
import QtQuick 2.0
-Item{
+Item {
id: container
//TODO: Somehow get particles into this?
property list<Component> pages
property Item cur: null
property int at: 0
- function advance(){
+ function advance() {
if(cur != null)
cur.destroy();
cur = pages[at++].createObject(container);
diff --git a/examples/declarative/particles/plasmapatrol/content/Ship.qml b/examples/declarative/particles/plasmapatrol/content/Ship.qml
index 60fc311d47..dd2366fe9a 100644
--- a/examples/declarative/particles/plasmapatrol/content/Ship.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Ship.qml
@@ -52,17 +52,17 @@ Item {
property ParticleSystem system
property int targetIdx: 0
property Item target: targets[targetIdx] == undefined?null:targets[targetIdx]
- Connections{
+ Connections {
target: me.target
- onHpChanged: if(me.target.hp<=0) me.targetIdx++;
+ onHpChanged: if (me.target.hp<=0) me.targetIdx++;
}
property list<Item> targets
property string shipParticle: "default"//Per team colors?
property int gunType: 0
property int shipType: 0
- Component{
+ Component {
id: sloopComp
- Sloop{
+ Sloop {
system: me.system
target: me.target
shipParticle: me.shipParticle
@@ -71,9 +71,9 @@ Item {
dodge: me.dodge
}
}
- Component{
+ Component {
id: frigateComp
- Frigate{
+ Frigate {
system: me.system
target: me.target
shipParticle: me.shipParticle
@@ -82,9 +82,9 @@ Item {
dodge: me.dodge
}
}
- Component{
+ Component {
id: cruiserComp
- Cruiser{
+ Cruiser {
system: me.system
target: me.target
shipParticle: me.shipParticle
@@ -93,21 +93,22 @@ Item {
dodge: me.dodge
}
}
- Component{
+ Component {
id: dumbComp
- Item{
+ Item {
property int maxHP: 0
property int initialDodge: 0
}
}
- Loader{
+ Loader {
id: shipLoader
- sourceComponent:{ switch(shipType){
+ sourceComponent: {
+ switch (shipType) {
case 1: sloopComp; break;
case 2: frigateComp; break;
case 3: cruiserComp; break;
default: dumbComp;
- }
+ }
}
}
}
diff --git a/examples/declarative/particles/plasmapatrol/content/Sloop.qml b/examples/declarative/particles/plasmapatrol/content/Sloop.qml
index 59678a75ea..c94fecef34 100644
--- a/examples/declarative/particles/plasmapatrol/content/Sloop.qml
+++ b/examples/declarative/particles/plasmapatrol/content/Sloop.qml
@@ -55,19 +55,19 @@ Item {
property int gunType: 0
width: 128
height: 128
- Emitter{
+ Emitter {
id: emitter
//TODO: Cooler would be an 'orbiting' affector
//TODO: On the subject, opacity and size should be grouped type 'overLife' if we can cram that in the particles
system: container.system
group: container.shipParticle
- shape: EllipseShape{}
+ shape: EllipseShape {}
emitRate: hp > 0 ? hp + 20 : 0
lifeSpan: blinkInterval
maximumEmitted: (maxHP + 20)
- acceleration: AngleDirection{angleVariation: 360; magnitude: 8}
+ acceleration: AngleDirection {angleVariation: 360; magnitude: 8}
size: 24
endSize: 4
@@ -76,9 +76,9 @@ Item {
height: 16
x: 64
y: 64
- Behavior on x{NumberAnimation{duration:blinkInterval}}
- Behavior on y{NumberAnimation{duration:blinkInterval}}
- Timer{
+ Behavior on x {NumberAnimation {duration:blinkInterval}}
+ Behavior on y {NumberAnimation {duration:blinkInterval}}
+ Timer {
interval: blinkInterval
running: true
repeat: true
@@ -88,19 +88,19 @@ Item {
}
}
}
- Hardpoint{
+ Hardpoint {
anchors.centerIn: parent
id: gun2
system: container.system
show: container.hp > 0
hardpointType: gunType
}
- Timer{
+ Timer {
id: fireControl
interval: 800
running: root.readySetGo
repeat: true
- onTriggered:{
+ onTriggered: {
gun2.fireAt(container.target);
}
}
diff --git a/examples/declarative/particles/plasmapatrol/plasmapatrol.qml b/examples/declarative/particles/plasmapatrol/plasmapatrol.qml
index bc5f49678c..c08253755a 100644
--- a/examples/declarative/particles/plasmapatrol/plasmapatrol.qml
+++ b/examples/declarative/particles/plasmapatrol/plasmapatrol.qml
@@ -50,15 +50,15 @@ Rectangle {
property int misses: 0
property real ratio: hits/(misses?misses:1)
//Move to JS file?
- property Ship redVar1: Ship{shipType: 1; gunType: 1}
- property Ship redVar2: Ship{shipType: 1; gunType: 2}
- property Ship redVar3: Ship{shipType: 1; gunType: 3}
- property Ship greenVar1: Ship{shipType: 3; gunType: 1}
- property Ship greenVar2: Ship{shipType: 2; gunType: 2}
- property Ship greenVar3: Ship{shipType: 1; gunType: 3}
+ property Ship redVar1: Ship {shipType: 1; gunType: 1}
+ property Ship redVar2: Ship {shipType: 1; gunType: 2}
+ property Ship redVar3: Ship {shipType: 1; gunType: 3}
+ property Ship greenVar1: Ship {shipType: 3; gunType: 1}
+ property Ship greenVar2: Ship {shipType: 2; gunType: 2}
+ property Ship greenVar3: Ship {shipType: 1; gunType: 3}
property string winner: "0"
property int players: 0
- function aiSet(ship){
+ function aiSet(ship) {
ship.gunType = Math.floor(Math.random() * 3) + 1
ship.shipType = Math.floor(Math.random() * 3) + 1
}
@@ -66,58 +66,58 @@ Rectangle {
width: 360
height: 600
color: "black"
- SequentialLoader{
+ SequentialLoader {
anchors.fill: parent
//General Children
- Image{
+ Image {
anchors.centerIn: parent
source: "../images/pics/finalfrontier.png"
}
- ParticleSystem{
+ ParticleSystem {
id: particles
}
- PlasmaPatrolParticles{ sys: particles; z: 100 }//Renders all particles on the one plane
+ PlasmaPatrolParticles { sys: particles; z: 100 }//Renders all particles on the one plane
//Component parts
id: pageControl
Component.onCompleted: advance();
pages:[
- Component{Item{
+ Component {Item {
id: menu
width: root.width
height: root.height
- Column{
+ Column {
anchors.verticalCenter: parent.verticalCenter
width: parent.width
spacing: 8
- Item{
+ Item {
id: title
width: root.width
height: 240
- Emitter{
+ Emitter {
anchors.fill: parent
system: particles
enabled: true
group: "default"
emitRate: 1200
lifeSpan: 1200
- shape: MaskShape{source:"../images/pics/TitleText.png"}
+ shape: MaskShape {source:"../images/pics/TitleText.png"}
size: 16
endSize: 0
sizeVariation: 8
- speed: AngleDirection{angleVariation:360; magnitudeVariation: 6}
+ speed: AngleDirection {angleVariation:360; magnitudeVariation: 6}
}
}
- Button{
+ Button {
text: "1P"
onClicked: {root.players = 1; pageControl.advance();}
anchors.horizontalCenter: parent.horizontalCenter
}
- Button{
+ Button {
text: "2P"
onClicked: {root.players = 2; pageControl.advance();}
anchors.horizontalCenter: parent.horizontalCenter
}
- Button{
+ Button {
text: "Demo"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {root.players = 0;
@@ -130,7 +130,7 @@ Rectangle {
pageControl.at = 5;//TODO: Not a magic number
pageControl.advance();}
}
- Button{
+ Button {
text: "Help"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
@@ -138,23 +138,23 @@ Rectangle {
pageControl.advance();
}
}
- Button{
+ Button {
text: "Quit"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: Qt.quit();
}
}
}},
- Component{Item{
+ Component {Item {
id: p1Screen
z: 101
width: root.width
height: root.height
- Rectangle{
+ Rectangle {
anchors.fill: parent
color: "red"
}
- Text{
+ Text {
anchors.centerIn: parent
color: "white"
font.pixelSize: 64
@@ -162,41 +162,41 @@ Rectangle {
text: "Player\n 1"
horizontalAlignment: Text.AlignHCenter
}
- MouseArea{
+ MouseArea {
anchors.fill: parent
onClicked: pageControl.advance()
}
}},
- Component{Item{
+ Component {Item {
id: p1Choices
z: 3
width: root.width
height: root.height
- Rectangle{
+ Rectangle {
color: "black"
anchors.fill: parent
}
- Column{
+ Column {
spacing: 16
width: root.width
anchors.horizontalCenter: parent.horizontalCenter
- ChoiceBox{
+ ChoiceBox {
target: redVar1
system: particles
}
- ChoiceBox{
+ ChoiceBox {
target: redVar2
system: particles
}
- ChoiceBox{
+ ChoiceBox {
target: redVar3
system: particles
}
- Button{
+ Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Next"
onClicked: {
- if(root.players < 2){
+ if (root.players < 2) {
aiSet(greenVar1);
aiSet(greenVar2);
aiSet(greenVar3);
@@ -207,16 +207,16 @@ Rectangle {
}
}
}},
- Component{Item{
+ Component {Item {
id: p2Screen
z: 101
width: root.width
height: root.height
- Rectangle{
+ Rectangle {
anchors.fill: parent
color: "green"
}
- Text{
+ Text {
anchors.centerIn: parent
color: "white"
font.pixelSize: 64
@@ -224,44 +224,44 @@ Rectangle {
text: "Player\n 2"
horizontalAlignment: Text.AlignHCenter
}
- MouseArea{
+ MouseArea {
anchors.fill: parent
onClicked: pageControl.advance()
}
}},
- Component{Item{
+ Component {Item {
id: p2Choices
z: 1
width: root.width
height: root.height
- Rectangle{
+ Rectangle {
color: "black"
anchors.fill: parent
}
- Column{
+ Column {
spacing: 16
width: root.width
anchors.horizontalCenter: parent.horizontalCenter
- ChoiceBox{
+ ChoiceBox {
target: greenVar1
system: particles
}
- ChoiceBox{
+ ChoiceBox {
target: greenVar2
system: particles
}
- ChoiceBox{
+ ChoiceBox {
target: greenVar3
system: particles
}
- Button{
+ Button {
anchors.horizontalCenter: parent.horizontalCenter
text: "Next"
onClicked: pageControl.advance()
}
}
}},
- Component{Item{
+ Component {Item {
id: arena
width: root.width
height: root.height
@@ -270,25 +270,25 @@ Rectangle {
Component.onDestruction: root.readySetGo = false
property bool victory: redShip3.hp <= 0 || greenShip3.hp <=0
onVictoryChanged: {
- if(redShip3.hp <= 0){
- if(greenShip3.hp <= 0){
+ if (redShip3.hp <= 0) {
+ if (greenShip3.hp <= 0) {
root.winner = "1&2"
- }else{
+ }else {
root.winner = "2"
}
- }else{
+ } else {
root.winner = "1"
}
winTimer.start()
}
- Timer{
+ Timer {
id: winTimer
interval: 1200
repeat: false
running: false
onTriggered: pageControl.advance();
}
- Ship{
+ Ship {
id: redShip1
shipParticle: "redTeam"
system: particles
@@ -298,7 +298,7 @@ Rectangle {
gunType: redVar1.gunType
targets: [greenShip1, greenShip2, greenShip3]
}
- Ship{
+ Ship {
id: redShip2
shipParticle: "redTeam"
system: particles
@@ -308,7 +308,7 @@ Rectangle {
gunType: redVar2.gunType
targets: [greenShip1, greenShip2, greenShip3]
}
- Ship{
+ Ship {
id: redShip3
shipParticle: "redTeam"
system: particles
@@ -319,7 +319,7 @@ Rectangle {
targets: [greenShip1, greenShip2, greenShip3]
}
- Ship{
+ Ship {
id: greenShip1
shipParticle: "greenTeam"
system: particles
@@ -329,7 +329,7 @@ Rectangle {
gunType: greenVar1.gunType
targets: [redShip1, redShip2, redShip3]
}
- Ship{
+ Ship {
id: greenShip2
shipParticle: "greenTeam"
system: particles
@@ -339,7 +339,7 @@ Rectangle {
gunType: greenVar2.gunType
targets: [redShip1, redShip2, redShip3]
}
- Ship{
+ Ship {
id: greenShip3
shipParticle: "greenTeam"
system: particles
@@ -350,18 +350,18 @@ Rectangle {
targets: [redShip1, redShip2, redShip3]
}
}},
- Component{Item{
+ Component {Item {
id: winScreen
z: 101
width: root.width
height: root.height
/*
- Rectangle{
+ Rectangle {
anchors.fill: parent
color: "black"
}
*/
- Text{//TODO: Particle Text?
+ Text {//TODO: Particle Text?
anchors.fill: parent
color: "white"
font.pixelSize: 64
@@ -371,13 +371,13 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
- MouseArea{
+ MouseArea {
anchors.fill: parent
onClicked: {pageControl.at = 0; pageControl.advance();}
}
}},
- Component{
- HelpScreens{
+ Component {
+ HelpScreens {
onExitDesired: {pageControl.at = 0; pageControl.advance();}
}
}