Hi there
I am having some problems with colliding objects and I was wondering whether anyone could help me out?
I am making a game based on the flappy bird example game, and somehow the gameOver call has stopped working in my modifications (the objects collide but nothing happens). I am using a box collider (obstacleCollider) to signal when the player hits the obstacle (obstacleSequence) (Code shown below). However I do know that the player.gameOver() function is working because it works for other collisions but not this one.
BoxCollider {
id: obstacleCollider
height: obstacleSequence.height
width: obstacleSequence.width
anchors.centerIn: obstacleSequence
bodyType: Body.Static
collisionTestingOnlyMode: true
fixture.onBeginContact: {
player.gameOver()
}
}
I can think of three reasons why this may not be working, and I was wondering whether these may be causing the described problems?
1) I have changed the player sprite from what was in the flappy bird example to a spriteSequenceVPlay, and it might be possible that this means something else has to change?
2) I receive this set of repeated error messages every time I run the game:
qrc:///qml/VPlay/physics/ColliderBase.qml:94:25: Unable to assign [undefined] to bool
qrc:///qml/VPlay/physics/ColliderBase.qml:377:13: Unable to assign [undefined] to bool
qrc:///qml/VPlay/physics/ColliderBase.qml:94:25: Unable to assign [undefined] to bool
qrc:///qml/VPlay/physics/ColliderBase.qml:377:13: Unable to assign [undefined] to bool
Could this be the cause of my problems? Can anyone explain why this is happening?
3) I noticed that when debugDraw is set to true, the boxCollider described above is shown as the green box (as usual) but unusually it does not have the purple square surrounding it. Is there a reason for this? When I stop the boxcollider from following the moving spriteSequenceVPlay (delete the line: anchors.centerIn: obstacleSequence) the purple box is visible and the gameOver function works.
If anyone has any thoughts on any of this I would be very grateful to hear them
Thanks in advance,
Ben