ok, some mystic:
here is level01.qml
import QtQuick 2.0
import "entities"
Item {
id: _root
//anchors.fill: parent
x: 0
y: 0
width: parent.width
height: parent.height
// these entities will be created when the game launches
Wall {
height: 1
width: parent.width
y: 0
x: 0
variationType: "ceil"
}
Wall {
height: 1
width: parent.width
y: parent.height
x: 0
variationType: "floor"
}
Wall {
width: 1
height: _root.height
x: 0
y: 0
boxColliderX: 1
variationType: "left"
onHeightChanged: console.log("level01 wall h:", height)
}
Wall {
width: 1
height: _root.height
x: parent.width
y: 0
variationType: "right"
boxColliderX: 1
}
Component.onCompleted: {
entityManager.createPooledEntitiesFromUrl(Qt.resolvedUrl("entities/Corn.qml"))
}
onWidthChanged: console.log("leel01 w:", width)
onHeightChanged: console.log("leel01 h:", height)
}
here is Wall.qml
import QtQuick 2.0
import Felgo 3.0
//import Box2D 1.0
EntityBase {
id: entity
entityType: "wall"
collidersActive: true
preventFromRemovalFromEntityManager: true
property alias boxColliderX: boxCollider.x
property alias boxColliderY: boxCollider.y
BoxCollider {
id: boxCollider
categories: Box.Category1
//collisionTestingOnlyMode: true
// the wall shouldnt move
bodyType: Body.Static
anchors.fill: rect
}
Rectangle {
id: rect
color: "brown"
anchors.fill: parent
}
}
turning on debug draws in PhysicsWorld I’ve discovered that only one wall (variationType: “right”) gets correct size of parent.height/width
there rest elements gets something about 32 pixels
If I set numbers explicitly, everything works ok
can you explain this?