Hey again,
I am working on my animation and now i can see all the images and sprites are working fine, but now I am having trouble getting physicsWorld to work and show.
This is my code for the player.qml which I want a BoxCollider for,
import Felgo 3.0
import QtQuick 2.0
EntityBase {
id: player
width:30
height: 60
entityType: "player"
property alias collider: collider
property alias horizontalVelocity: collider.linearVelocity.x
PhysicsWorld {
debugDrawVisible: true
}
AnimatedSprite {
id: walk
width: 100
height: 200
anchors.centerIn: parent
source: "../assets/WalkingManSpriteSheet.png"
frameCount: 8
frameRate: 6
frameWidth: 41
frameHeight:49
loops: 100
x: 200
y: 50
}
BoxCollider {
id: collider
height: player.height
width: player.width
// this collider must be dynamic because we are moving it by applying forces and impulses
bodyType: Body.Dynamic // this is the default value but I wanted to mention it ;)
fixedRotation: true // we are running, not rolling...
bullet: true // for super accurate collision detection, use this sparingly, because it's quite performance greedy
sleepingAllowed: false
// apply the horizontal value of the TwoAxisController as force to move the player left and right
force: Qt.point(controller.xAxis*170*32,0)
// limit the horizontal velocity
onLinearVelocityChanged: {
if(linearVelocity.x > 170) linearVelocity.x = 170
if(linearVelocity.x < -170) linearVelocity.x = -170
}
}
}
No errors in the code, I just cannot see any colliders and they are not registering… thanks for all your help!