summaryrefslogtreecommitdiffstats
path: root/demos/declarative
diff options
context:
space:
mode:
Diffstat (limited to 'demos/declarative')
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js3
-rw-r--r--demos/declarative/snake/content/snake.js6
2 files changed, 3 insertions, 6 deletions
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index cc0a70d..f9c6184 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -176,14 +176,13 @@ function createBlock(column,row){
// not be ready immediately. There is a statusChanged signal on the
// component you could use if you want to wait to load remote files.
if(component.status == Component.Ready){
- var dynamicObject = component.createObject();
+ var dynamicObject = component.createObject(gameCanvas);
if(dynamicObject == null){
console.log("error creating block");
console.log(component.errorsString());
return false;
}
dynamicObject.type = Math.floor(Math.random() * 3);
- dynamicObject.parent = gameCanvas;
dynamicObject.x = column*gameCanvas.blockSize;
dynamicObject.targetX = column*gameCanvas.blockSize;
dynamicObject.targetY = row*gameCanvas.blockSize;
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 102bd87..f5c231e 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -59,8 +59,7 @@ function startNewGame()
console.log("Still loading linkComponent");
continue;//TODO: Better error handling?
}
- var link = linkComponent.createObject();
- link.parent = playfield;
+ var link = linkComponent.createObject(playfield);
link.z = numRows * numColumns + 1 - i;
link.type = i == 0 ? 2 : 0;
link.spawned = false;
@@ -300,8 +299,7 @@ function createCookie(value) {
console.log("Still loading cookieComponent");
return;//TODO: Better error handling?
}
- cookie = cookieComponent.createObject();
- cookie.parent = head.parent;
+ cookie = cookieComponent.createObject(head.parent);
cookie.value = value;
cookie.row = row;
cookie.column = column;