Hi all,
I’m trying to do a basic thing. When a bird collision with a coin, the coin disappear and also if the bird collision with a box, the last one move.
But the image of the box and the coin don’t appear and I dont know why. (ALSO, I don’t know how to do that some image disappear)
————>Box.qml file:
import QtQuick 2.0
import Felgo 3.0
EntityBase {
id: box
entityType: "box"
Image{
height: 100
width: 100
source: "img/box.png"
}
BoxCollider {
anchors.fill: box
bodyType: Body.Dynamic
collisionTestingOnlyMode: true
}
}
--------->Coin.qml FILE: import QtQuick 2.0
import QtQuick.Window 2.2
import QtQuick.Controls 2.1
import Felgo 3.0
EntityBase {
id: coinElement
width: spriteUpperPipe.width
height: spriteUpperPipe.height+pipeGateway+spriteBottomPipe.height
MultiResolutionImage {
id: coin
source: "coin.png"
x: 1125
y: 625
}
BoxCollider {
id: collider
width: coin.width
height: coin.height
bodyType: Body.Static
collisionTestingOnlyMode: true
}
Component.onCompleted: {
reset()
}
}
------------->Main.qml file: GameWindow {
screenHeight: 768
screenWidth: 1024
//definición de la pantalla de juego como pantalla completa.
EntityManager{
id:entityManager
entityContainer: window
}
Scene{
id: window
visible: true
width: 480
height: 320
}
Background{
id: background
height: parent
width: parent
}
//posición y velocidad inicial del pollito.
Bird{
id: bird
x: 100
y: 550
z: 1
property double vx: move.vi*Math.cos(move.tita)
property double vy: move.vi*Math.sin(-move.tita)
Behavior on x{ //el tiempo que va a tardar en moverse en cada iteracción en el eje x
NumberAnimation{
duration: 10
}
}
Behavior on y{ //el tiempo que va a tardar en moverse en cada iteracción en el eje y
NumberAnimation{
duration:10
}
}
}
Box{
id:box
x:1100
y:625
property double vx: 0
property double vy: 0
} Coin{
id: coin
x: 1100
y: 450
} } thank you to everyone!