Hi guys,
I have an issue where I’ve placed some entities inside a Row item. I use a row because it’s useful in positioning my entities together and moving them as one. I could create them in the scene itself, but it over complicates what I want to do.
Here is a sample game that illustrates the issue:
import Felgo 3.0
import QtQuick 2.0
GameWindow {
id: gameWindow
activeScene: scene
screenWidth: 960
screenHeight: 640
EntityManager {
id: entityManager
entityContainer: scene
}
Scene {
id: scene
width: 480
height: 320
PhysicsWorld {
debugDrawVisible: true
}
Rectangle {
color: "black"
anchors.fill: parent
}
Item {
width: 100
height: 50
anchors {top: parent.top; right: parent.right}
Text {
text: "Click"
color: "white"
anchors.centerIn: parent
}
MouseArea {
anchors.fill: parent
onClicked: movement.start()
}
}
MovementAnimation {
id: movement
target: content
property: "y"
velocity: 10
}
Row {
id: content
height: 50
width: 200
spacing: 2
x: scene.width/2 - content.width/2
y: scene.height/2 - content.height/2
Repeater {
model: 4
EntityBase {
width: 50
height: 50
Rectangle {
color: "white"
anchors.fill: parent
}
BoxCollider {
anchors.fill: parent
bodyType: Body.Static
collisionTestingOnlyMode: true
}
}
}
}
}
}
If you run the game, you’ll see the box colliders are not centered within the entities but are in the top left of the scene. This appears to be due to something fishy with the coordinate mapping from the entity base, the row and the scene itself.
Any ideas what I can do here?
-
This topic was modified 7 years, 3 months ago by
cplusplusistough@gmail.com.