/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
**
** This file is part of the examples of the Qt Toolkit.
**
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
import QtQuick.Particles 2.0
-Rectangle{
+Rectangle {
id: root
width: 360
height: 540
color: "black"
property bool spacePressed: false
focus: true
- Image{
+ Image {
source: "../images/finalfrontier.png"
anchors.centerIn:parent
}
}
}
- Emitter{
+ Emitter {
group: "stars"
system: particles
emitRate: 40
enabled: true
size: 30
sizeVariation: 10
- speed: PointDirection{ x: 220; xVariation: 40 }
+ speed: PointDirection { x: 220; xVariation: 40 }
height: parent.height
}
- Emitter{
+ Emitter {
group: "roids"
system: particles
emitRate: 10
enabled: true
size: 30
sizeVariation: 10
- speed: PointDirection{ x: 220; xVariation: 40 }
+ speed: PointDirection { x: 220; xVariation: 40 }
height: parent.height
}
- ParticleSystem{
+ ParticleSystem {
id: particles
anchors.fill: parent
}
- ImageParticle{
+ ImageParticle {
id: stars
groups: ["stars"]
system: particles
colorVariation: 0.1
alpha: 0
}
- ImageParticle{
+ ImageParticle {
id: roids
groups: ["roids"]
system: particles
- sprites: Sprite{
+ sprites: Sprite {
id: spinState
name: "spinning"
source: "../images/meteor.png"
frames: 35
- duration: 60
- speedModifiesDuration: -0.1
+ frameDuration: 60
}
}
- ImageParticle{
+ ImageParticle {
id: shot
groups: ["shot"]
system: particles
color: "#0FF06600"
colorVariation: 0.3
}
- ImageParticle{
+ ImageParticle {
id: engine
groups: ["engine"]
system: particles
colorVariation: 0.2
}
- Attractor{
+ Attractor {
id: gs; pointX: root.width/2; pointY: root.height/2; strength: 4000000;
system: particles
affectedParameter: Attractor.Acceleration
proportionalToDistance: Attractor.InverseQuadratic
}
- Age{
+ Age {
system: particles
x: gs.pointX - 8;
y: gs.pointY - 8;
width: 16
height: 16
}
- Rectangle{
+ Rectangle {
color: "black"
width: 8
height: 8
x: gs.pointX - 4
y: gs.pointY - 4
}
- Image{
+
+ Image {
source:"../images/rocket2.png"
id: ship
width: 45
height: 22
- MouseArea{
+ MouseArea {
id: ma
anchors.fill: parent;
drag.axis: Drag.XandYAxis
drag.target: ship
}
- Emitter{
- group: "engine"
- system: particles
- emitRate: 200
- lifeSpan: 1000
- size: 10
- endSize: 4
- sizeVariation: 4
- speed: PointDirection{ x: -128; xVariation: 32 }
- height: parent.height
- width: 20
- }
- Emitter{
- group: "shot"
- system: particles
- emitRate: 32
- lifeSpan: 2000
- enabled: spacePressed
- size: 40
- speed: PointDirection{ x: 256; }
- x: parent.width
- y: parent.height/2
- }
}
- Text{
+ Emitter {
+ group: "engine"
+ system: particles
+ emitRate: 200
+ lifeSpan: 1000
+ size: 10
+ endSize: 4
+ sizeVariation: 4
+ speed: PointDirection { x: -128; xVariation: 32 }
+ height: ship.height
+ y: ship.y
+ x: ship.x
+ width: 20
+ }
+ Emitter {
+ group: "shot"
+ system: particles
+ emitRate: 32
+ lifeSpan: 2000
+ enabled: spacePressed
+ size: 40
+ speed: PointDirection { x: 256; }
+ x: ship.x + ship.width
+ y: ship.y + ship.height/2
+ }
+
+ Text {
color: "white"
anchors.bottom: parent.bottom
text:"Drag the ship, Spacebar to fire."