123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326 |
- import Qt 4.7
- import "scripts.js" as Game
- Rectangle {
- id : gameArea
- width: 360
- height: 630
- property int score: 0
- property int lives: 3
- property int clickCount : 0
- property int hideTimerInterval: 1500
- property int gameTimerInterval: 1000
- StartScreen {
- id : mainView
- height: parent.height
- width: parent.width
- visible : true
- }
- GameScreen {
- id : gameView
- height: parent.height
- width: parent.width
- x : parent.width
- scoreText: score
- livesText: lives
- visible: false
- }
- InfoScreen {
- id: infoView
- height: parent.height
- width: parent.width
- x : parent.width
- visible : false
- }
- HighScoreScreen {
- id: highScoreView
- height: parent.height
- width: parent.width
- x : parent.width
- visible : false
- }
- Timer {
- id: gameTimer
- interval: gameTimerInterval
- running: false
- repeat: true
- onTriggered: Game.gameLoop(true)
- }
- Timer {
- id: hideTimer1
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(1)
- }
- Timer {
- id: hideTimer2
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(2)
- }
- Timer {
- id: hideTimer3
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(3)
- }
- Timer {
- id: hideTimer4
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(4)
- }
- Timer {
- id: hideTimer5
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(5)
- }
- Timer {
- id: hideTimer6
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(6)
- }
- Timer {
- id: hideTimer7
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(7)
- }
- Timer {
- id: hideTimer8
- interval: 1500
- running: false
- repeat: false
- onTriggered: Game.hideMonkey(8)
- }
- Image {
- id: image2
- width: 40
- height: 40
- anchors.right: parent.right
- anchors.rightMargin: 5
- anchors.top: parent.top
- anchors.topMargin: 5
- fillMode: Image.PreserveAspectFit
- opacity: 0.4
- source: "images/close.png"
- MouseArea {
- anchors.fill: parent
- onClicked: {
- appData.close();
- }
- }
- }
- states: [
- State {
- name: "game"
- PropertyChanges {
- target: mainView
- x: - ( gameArea.width )
- height: gameArea.height
- }
- PropertyChanges {
- target: gameView
- x: 0
- height: gameArea.height
- }
- },
- State {
- name: "info"
- PropertyChanges {
- target: mainView
- x: - ( gameArea.width )
- height: gameArea.height
- }
- PropertyChanges {
- target: infoView
- x: 0
- height: gameArea.height
- }
- },
- State {
- name: "highscore"
- PropertyChanges {
- target: gameView
- x: - ( gameArea.width )
- height: gameArea.height
- }
- PropertyChanges {
- target: mainView
- x: - ( gameArea.width )
- height: gameArea.height
- }
- PropertyChanges {
- target: highScoreView
- x: 0
- height: gameArea.height
- }
- }
- ]
- transitions: [
- Transition {
- from: "game"
- to: "highscore"
- SequentialAnimation {
- ScriptAction {
- script: {
- highScoreView.visible = true;
- highScoreView.state = ""
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- gameView.visible = false;
- }
- }
- }
- },
- Transition {
- from: "highscore"
- to: ""
- SequentialAnimation {
- ScriptAction {
- script: {
- mainView.visible = true
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- highScoreView.visible = false;
- }
- }
- }
- },
- Transition {
- from: ""
- to: "game"
- SequentialAnimation {
- ScriptAction {
- script: {
- gameView.visible = true;
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- mainView.visible = false;
- }
- }
- }
- },
- Transition {
- from: "game"
- to: ""
- SequentialAnimation {
- ScriptAction {
- script: {
- mainView.visible = true;
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- gameView.visible = false;
- }
- }
- }
- },
- Transition {
- from: ""
- to: "info"
- SequentialAnimation {
- ScriptAction {
- script: {
- infoView.visible = true;
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- mainView.visible = false;
- }
- }
- }
- },
- Transition {
- from: "info"
- to: ""
- SequentialAnimation {
- ScriptAction {
- script: {
- mainView.visible = true;
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- infoView.visible = false;
- }
- }
- }
- },
- Transition {
- from: ""
- to: "highscore"
- SequentialAnimation {
- ScriptAction {
- script: {
- highScoreView.visible = true;
- highScoreView.state = ""
- }
- }
- NumberAnimation { properties: "x"; duration: 300; easing.type: "OutInSine"}
- ScriptAction {
- script: {
- mainView.visible = false;
- }
- }
- }
- }
- ]
- }
|