summaryrefslogtreecommitdiffstats
path: root/demos/declarative/samegame
diff options
context:
space:
mode:
authormae <qt-info@nokia.com>2010-07-08 15:49:23 (GMT)
committermae <qt-info@nokia.com>2010-07-08 16:34:25 (GMT)
commitb22a5e13003ff9f23b075284a1a1e0a6b0e46250 (patch)
tree178f70df43aa34851efd82b1286a472c3f1fd500 /demos/declarative/samegame
parentd5d16b3d3304774df11f40df0206d90ed5f840de (diff)
downloadQt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.zip
Qt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.tar.gz
Qt-b22a5e13003ff9f23b075284a1a1e0a6b0e46250.tar.bz2
Follow -> Behavior
Replace the usages of Follows with Behaviors, update docs.
Diffstat (limited to 'demos/declarative/samegame')
-rw-r--r--demos/declarative/samegame/SamegameCore/BoomBlock.qml11
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js7
2 files changed, 10 insertions, 8 deletions
diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
index 3f43579..43050af 100644
--- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml
+++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml
@@ -47,11 +47,14 @@ Item {
property bool dying: false
property bool spawned: false
property int type: 0
- property int targetX: 0
- property int targetY: 0
- SpringFollow on x { enabled: spawned; to: targetX; spring: 2; damping: 0.2 }
- SpringFollow on y { to: targetY; spring: 2; damping: 0.2 }
+ Behavior on x {
+ enabled: spawned;
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
+ Behavior on y {
+ SpringAnimation{ spring: 2; damping: 0.2 }
+ }
Image {
id: img
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index 5c008a2..6e1b24d 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -110,7 +110,7 @@ function shuffleDown()
}else{
if(fallDist > 0){
var obj = board[index(column,row)];
- obj.targetY += fallDist * gameCanvas.blockSize;
+ obj.y += fallDist * gameCanvas.blockSize;
board[index(column,row+fallDist)] = obj;
board[index(column,row)] = null;
}
@@ -128,7 +128,7 @@ function shuffleDown()
obj = board[index(column,row)];
if(obj == null)
continue;
- obj.targetX -= fallDist * gameCanvas.blockSize;
+ obj.x -= fallDist * gameCanvas.blockSize;
board[index(column-fallDist,row)] = obj;
board[index(column,row)] = null;
}
@@ -184,8 +184,7 @@ function createBlock(column,row){
}
dynamicObject.type = Math.floor(Math.random() * 3);
dynamicObject.x = column*gameCanvas.blockSize;
- dynamicObject.targetX = column*gameCanvas.blockSize;
- dynamicObject.targetY = row*gameCanvas.blockSize;
+ dynamicObject.y = row*gameCanvas.blockSize;
dynamicObject.width = gameCanvas.blockSize;
dynamicObject.height = gameCanvas.blockSize;
dynamicObject.spawned = true;