Forums

OverviewV-Play 2 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
    V-Play 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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support