aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml')
-rw-r--r--examples/declarative/particles/plasmapatrol/content/BlasterHardpoint.qml28
1 files changed, 14 insertions, 14 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
}