Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 1.0
- import "gameCore.js" as Game
- Rectangle {
- width: 360
- height: 480
- property int diePos: 0
- property int shuffSpeed: 750
- property int level: 1
- property int randquestion: 0
- property int answer: 0
- property url cupimg: "IMAGES FOR THESIS/for cups/lvl1CUP.png"
- property url dieimg: "IMAGES FOR THESIS/for dice/lvl1die.png"
- Image {
- id: bg
- anchors.fill: parent
- source: "IMAGES FOR THESIS/for backgrounds/CUPbackground.png"
- Component {
- id: diecomp
- Image {
- id: die
- y: 233
- source: dieimg
- Component.onCompleted: {
- switch (diePos) {
- case 0: x = cup1.x + (cup1.width - width) / 2; break;
- case 1: x = cup2.x + (cup2.width - width) / 2; break;
- case 2: x = cup3.x + (cup3.width - width) / 2; break;
- }
- var diePosY = [233,218,205,187,170]
- y = diePosY[level - 1]
- console.log(y)
- }
- }
- }
- Loader {
- id: ldrdie
- }
- Button {
- id: cup1
- y: 114
- x: 4
- enabled: false
- normalImage: cupimg
- pressedImage: cupimg
- onClicked: {
- na1.running = true
- select.opacity = 0
- cup2.enabled = false
- cup3.enabled = false
- if (diePos == 0) {
- exe.opacity = 1
- nextbtn.visible = true
- } else { wro.opacity = 1 }
- }
- NumberAnimation{id: na1; target: cup1; property: "y"; to: 50; duration: 750}
- }
- Button {
- id: cup2
- x: 119
- y: 91
- enabled: false
- normalImage: cupimg
- pressedImage: cupimg
- onClicked: {
- na2.running = true
- select.opacity = 0
- cup1.enabled = false
- cup3.enabled = false
- if (diePos == 1) {
- exe.opacity = 1
- nextbtn.visible = true
- } else { wro.opacity = 1 }
- }
- NumberAnimation{id: na2; target: cup2; property: "y"; to: 50; duration: 750}
- }
- Button {
- id: cup3
- x: 233
- y: 113
- enabled: false
- normalImage: cupimg
- pressedImage: cupimg
- onClicked: {
- na3.running = true
- select.opacity = 0
- cup1.enabled = false
- cup2.enabled = false
- if (diePos == 2) {
- exe.opacity = 1
- nextbtn.visible = true
- } else { wro.opacity = 1 }
- }
- NumberAnimation{id: na3; target: cup3; property: "y"; to: 50; duration: 750}
- }
- Button {
- id: startbtn
- x:60
- y:377
- width: 249
- height:75
- normalImage: "IMAGES FOR THESIS/for buttons/startbutton.png"
- pressedImage: "IMAGES FOR THESIS/for buttons/startbutton.png"
- onClicked: {
- switch (level) {
- case 1: sta.running = true; break
- case 2: sta2.running = true; break
- case 3: sta3.running = true; break
- case 4: sta4.running = true; break
- case 5: sta5.running = true; break
- }
- tmr.running = true
- startbtn.enabled = false
- }
- }
- Button {
- id: resetbtn
- x:60
- y:377
- width: 249
- height:75
- visible: false
- normalImage: "IMAGES FOR THESIS/for buttons/retrybutton.png"
- pressedImage: "IMAGES FOR THESIS/for buttons/retrybutton.png"
- onClicked: {
- var cupPos = [
- [[4,119,233],[114,91,113]],
- [[13,127,242],[114,91,113]],
- [[32,137,243],[113,91,113]],
- [[57,147,238],[113,91,113]],
- [[76,153,233],[114,91,113]]
- ]
- cup1.x = cupPos[level - 1][0][0]; cup1.y = cupPos[level - 1][1][0]
- cup2.x = cupPos[level - 1][0][1]; cup2.y = cupPos[level - 1][1][1]
- cup3.x = cupPos[level - 1][0][2]; cup3.y = cupPos[level - 1][1][2]
- Game.rand()
- wro.opacity = 0
- visible = false
- startbtn.visible = true
- startbtn.enabled = true
- }
- }
- Button {
- id: nextbtn
- x:60
- y:377
- width: 249
- height:75
- visible: false
- normalImage: "IMAGES FOR THESIS/for buttons/nextbutton.png"
- pressedImage: "IMAGES FOR THESIS/for buttons/nextbutton.png"
- onClicked: {
- warning.opacity = 1
- exe.opacity = 0
- tmr3.running = true
- ldrdie.sourceComponent = null
- }
- }
- }
- Text {
- id: exe
- x: 135
- y: 292
- text: "Excellent!"
- font.family: "Imprint MT Shadow"
- anchors.verticalCenterOffset: 64
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- font.pointSize: 15
- anchors.centerIn: parent
- opacity: 0
- }
- Text {
- id:wro
- x: 108
- y: 298
- text: "You Lost! Try Again"
- anchors.verticalCenterOffset: 68
- anchors.horizontalCenter: parent.horizontalCenter
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.centerIn: parent
- opacity: 0
- onOpacityChanged: {
- if (opacity) {
- startbtn.visible = false
- resetbtn.visible = true
- }
- }
- }
- Text {
- id: select
- text: "Select A Cup!"
- anchors.verticalCenterOffset: 68
- anchors.horizontalCenter: parent.horizontalCenter
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.centerIn: parent
- opacity: 0
- }
- Text {
- id: warning
- text: "Oops! Before you can go to the next level,\nyou must answer this question first!"
- horizontalAlignment: Text.AlignHCenter
- anchors.verticalCenterOffset: 68
- anchors.horizontalCenter: parent.horizontalCenter
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.centerIn: parent
- opacity: 0
- }
- Text {
- id: leveltxt
- opacity: 1
- x: 161
- y: 2
- color: "white"
- text:"Level: 1"
- anchors.rightMargin: -156
- anchors.bottomMargin: -1
- anchors.leftMargin: 156
- anchors.topMargin: 2
- font.pointSize: 4
- styleColor: "white"
- }
- Text {
- id: exe2
- x: 135
- y: 292
- text: "Congrats! You already finished the game. \nHere is your reward!"
- horizontalAlignment: Text.AlignHCenter
- font.family: "Imprint MT Shadow"
- anchors.verticalCenterOffset: 64
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- font.pointSize: 15
- anchors.centerIn: parent
- opacity: 0
- }
- Image {
- id: askscreen
- anchors.fill: parent
- source: "IMAGES FOR THESIS/for backgrounds/background.png"
- visible: false
- Text {
- id: question
- text: ""
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.centerIn: parent
- horizontalAlignment: Text.AlignHCenter
- }
- Text {
- id: c1
- text: ""
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.top: question.bottom
- anchors.topMargin: 5
- anchors.horizontalCenter: parent.horizontalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: {
- answer = 0
- Game.checkanswer()
- }
- }
- }
- Text {
- id: c2
- text: ""
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.top: c1.bottom
- anchors.topMargin: 5
- anchors.horizontalCenter: parent.horizontalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: {
- answer = 1
- Game.checkanswer()
- }
- }
- }
- Text {
- id: c3
- text: ""
- font.pointSize: 12
- font.family: "Imprint MT Shadow"
- color: "white"
- anchors.top: c2.bottom
- anchors.topMargin: 5
- anchors.horizontalCenter: parent.horizontalCenter
- MouseArea {
- anchors.fill: parent
- onClicked: {
- answer = 2
- Game.checkanswer()
- }
- }
- }
- }
- Image {
- id: reward
- anchors.fill: parent
- source: "IMAGES FOR THESIS/horror/mumu.jpg"
- visible: false
- }
- Timer {
- id: tmr
- interval: 750
- onTriggered: {
- tmr2.running = true
- ldrdie.sourceComponent = null
- }
- }
- Timer {
- id: tmr2
- interval: 6750
- onTriggered: {
- ldrdie.sourceComponent = diecomp
- select.opacity = 1.0
- cup1.enabled = true
- cup2.enabled = true
- cup3.enabled = true
- }
- }
- Timer {
- id: tmr3
- interval: 3000
- onTriggered: {
- warning.opacity = 0
- askscreen.visible = true
- Game.ask()
- }
- }
- Timer {
- id: tmr4
- interval: 10000
- onTriggered: {
- askscreen.visible = false
- reward.visible = true
- }
- }
- SequentialAnimation {
- id: sta
- running: false;
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "y"; to: 160; duration: 750}
- NumberAnimation {target: cup2;property: "y"; to:160; duration:750}
- NumberAnimation {target: cup3; property: "y"; to: 160; duration:750}
- }
- ParallelAnimation {
- NumberAnimation {target:cup2; property: "x"; to: 233; duration: 450}
- }
- ParallelAnimation {
- NumberAnimation {target:cup2; property: "x"; to: 4; duration: 450}
- NumberAnimation {target: cup1; property: "x"; to: 119; duration:450}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1;property: "x";to: 233; duration: 450}
- NumberAnimation {target: cup3;property: "x"; to: 119; duration: 450}
- }
- ParallelAnimation {
- NumberAnimation {target: cup2; property: "x"; to: 233; duration: 450}
- NumberAnimation {target: cup1;property: "x"; to: 4; duration: 450}
- }
- ParallelAnimation {
- NumberAnimation {target: cup3; property: "x"; to: 4; duration: 450}
- NumberAnimation {target: cup1; property: "x"; to: 233; duration: 450}
- NumberAnimation {target: cup2; property: "x"; to: 119; duration: 450}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "x"; to: 4; duration: 450}
- NumberAnimation {target: cup3; property: "x"; to: 233; duration: 450}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "x"; to: 119; duration: 400}
- NumberAnimation {target: cup2; property: "x"; to: 4; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "x"; to: 233; duration: 400}
- NumberAnimation {target: cup3; property: "x"; to: 119; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup2; property: "x"; to: 119; duration: 400}
- NumberAnimation {target: cup3; property: "x"; to: 4; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup2; property: "x"; to: 233; duration: 400}
- NumberAnimation {target: cup1; property: "x"; to: 119; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "x"; to: 4; duration: 400}
- NumberAnimation {target: cup3; property: "x"; to: 119; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup2; property: "x"; to: 4; duration: 400}
- NumberAnimation {target: cup1; property: "x"; to: 233; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup1; property: "x"; to: 119; duration: 400}
- NumberAnimation {target: cup3; property: "x"; to: 233; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup2; property: "x"; to: 233; duration: 400}
- NumberAnimation {target: cup3; property: "x"; to: 4; duration: 400}
- }
- ParallelAnimation {
- NumberAnimation {target: cup3; property: "x"; to: 233; duration: 400}
- NumberAnimation {target: cup2; property: "x"; to: 4; duration: 400}
- }
- }
- Component.onCompleted: {
- Game.rand()
- }
- }
Add Comment
Please, Sign In to add comment