Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Event to launch character vertically and fall down

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #16280

    Todd

    Hi again,

    Now Im trying to figure out how I would set an event to listen for when the animated sprite (id:walk) collides with the other sprite of a cannon (id:cannon). On contact I would like to player to be launched vertically. Would this be done with FixtureBeginOnContact?

    This is my code…

     

    import QtQuick 2.7
    import QtQuick.Window 2.2
    
    
    Item {
    width:Screen.width
    height:Screen.height-10
    focus: true
    
    Keys.onPressed: {
    
    if (event.key===Qt.Key_Right){
    event.accepted = true;
    walk.x=(walk.x) +7
    
    }
    if (event.key===Qt.Key_Left){
    event.accepted = true;
    walk.x=(walk.x) -7
    }
    }
    Flickable{
    width:Screen.width
    height:Screen.height
    contentHeight: Screen.height *4
    contentWidth: Screen.width
    interactive: true
    boundsBehavior: Flickable.StopAtBounds
    
    Image{
    id: box
    anchors.fill: parent
    source: "artwork/rect.png"
    sourceSize.width: Screen.width
    sourceSize.height: Screen.height*4
    }
    
    AnimatedSprite {
        id: walk
        width: 100
        height: 200
        anchors.centerIn: horizontalCenter
        source: "artwork/WalkingManSpriteSheet.png"
        frameCount: 8
        frameRate: 6
        frameWidth: 40
        frameHeight:60
        loops: 100
        x: 200
        y: 3625
    
    
    }
    
    Image{
    id:twitter
    source: "artwork/twitter.png"
    x:500
    y:horizontalCenter
    }
    AnimatedSprite {
        id: cannon
        width: 300
        height: 425
        anchors.centerIn: hoizontalCenter
        source: "artwork/cannon.png"
        frameCount: 12
        frameRate: 8
        frameWidth: 128
        frameHeight:155
        loops: 100
        x:1250
        y:3550
    }
    
    
    }
    }
    

     

    #16283

    Alex
    Felgo Team

    Hi Todd,

    if you want to listen to collisions, using physics will be the easiest approach. Thus you will need a PhysicsWorld and then Colliders for your entities. The FlappyBird tutorial covers several aspects of using physics with dynamic, static and sensor type of colliders, I suggest to quickly go through it. The fixture.onBeginContact will then be your signal to react to collisions, that’s right.

    Cheers,
    Alex

    #16298

    Todd

    Hi, I am having a slight problem with the VPlay plugin

    I have these imports

    import QtQuick 2.7
    import QtQuick.Window 2.2
    import Felgo 3.0

    and i get an error saying that VPlay module is not installed…. not sure what the problem is here, do i need to mess with the kits?

    #16299

    Günther
    Felgo Team

    Hi, does your pro-file configuration add v-play to the config setting?

    CONFIG += v-play

     

    Or did you change anything with your Felgo installation regarding kits?

     

    Best,
    Günther

    #16300

    Todd

    Hey Gunther yes CONFIG += v-play is included in the pro file.  I am actually getting an error that says VPapplication: No such file or directory. I am currently updating qt 5.8 components.

    #16302

    Todd

    Update: So I ended up updated to qt 5.8, but i still get the error of VPapplication: no such file or directory….

     

    What do i need to do?  By the way I have qt on both my desktop and lap top and work on the same project so idk if that could be the cause of anything.

    #16305

    Günther
    Felgo Team

    Hi Todd,

    if you upgraded to Felgo 5.8, the old Build Kits for 5.7 that you used up until now do not work anymore (the Felgo library is only available with the new Kits for Qt 5.8 then). When trying to build a Felgo project with the old Kits, you will get the VPApplication error as Felgo is not available for this Qt version.

    Please switch to the new Build Kits now  after updating. To remove the old 5.7 Kits, you can open the MaintenanceTool of your Felgo installation and deinstall the 5.7 Packages. (You can also do a fresh installation of Felgo if your prefer that).

    Cheers,
    Günther

     

Viewing 7 posts - 1 through 7 (of 7 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded