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

Forums

OverviewFelgo 3 Support (Qt 5) › Scrolling background Parallaxscrolling

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15111

    Todd

    Hello,

    I am attempting to create a background scrolling effect for my flappy bird styled game.

    I am adding these lines of code to the scene in the main qml, the game will run but the background wont scroll.

     ParallaxScrollingBackground {
           movementVelocity: Qt.point(10,0)
           ratio: Qt.point(1.0,1.0)
           sourceImage: "../assets/img/bg.png"
         }

    Do i need to assign this to its own qml file?

    #15112

    Günther
    Felgo Team

    Hi Todd!

    No, the qml file does not matter.
    Just make sure that the image can be reached from the QML file with the relative path specified in sourceImage, and that background is not hidden by other items placed above it in terms of the z-axis. (You can either specify the z property to define the order, or you can move down the item after other items in the QML code) .

    Best,
    Günther

    #15120

    Todd

    Hey Gunther,

    So now i can see the scrolling background, and I need to adjust z ordering because its covering everything else.

    But i can see the still background under it, is this fine or should there only be one background?

    Also can you use the anchor property on parallaxscrolling?

    #15121

    Todd

    I actually went in and made it so the background does not show…

    Just need to make it anchor to the bottom… I am trying

    ParallaxScrollingBackground {

    movementVelocity: Qt.point(-30,0)
    ratio: Qt.point(1.0,1.0)

    sourceImage: “../assets/img/bg.png”

    anchors.fill: MainItem

    }

     

    How do i correctly fill the scene with the parallax scroll movement?

    #15122

    Todd

    Hey again,

    Disregard, I just solved the problem by blowing up the background image itself!

     

    Thanks for everything,

Viewing 5 posts - 1 through 5 (of 5 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