diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/declarative/samegame/SamegameCore/BoomBlock.qml | 11 | ||||
-rwxr-xr-x | demos/declarative/samegame/SamegameCore/samegame.js | 7 |
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; |