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


OverviewFelgo 3 Support (Qt 5) › Not sure what to do with this code

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #9377


    I am using the
    “How to Make a Flappy Bird Game with Felgo”
    page as a guide for creating my own type of Flappy Bird, but I am having problems with this one part:
    Game Logic
    The game will have 3 states:

    • wait: Pipes will not move, game starts after the first touch on the screen.
    • play: Actual game.
    • gameOver: Player hits a pipe or the ground and falls down to the ground. The next touch on the screen will reset the game.

    Add a custom property to the Scene in main.qml like this:

    property string gameState: "wait"

    We will begin with the wait state, by setting it as default value.

    Then we can use this state to control the gravity, with a property binding

    gravity.y: scene.gameState != "wait" ? -27 : 0


    Basically, I don’t understand what to do here. I think what I’m missing is the custom property part or property binding part. I have tried putting the property string gameState: “wait” in the scene of the main.qml with the gravity.y: scene.gameState != “wait” ? -27 : 0 underneath it, but I am very sure that’s not what you are not supposed to do. I am new to this coding stuff and don’t have much experience yet. I am sure there is a really easy way to do this since the game being made is fairly simple. Any help would be appreciated. Here is the link if you need it: http://felgo.com/doc/howto-flappybird-game/

    • This topic was modified 8 years, 12 months ago by  DaRealSteve.

    Felgo Team

    Hi Steve,

    the gravity is a property of the PhysicsWorld, please search for that item in your code and then replace it with the new property binding.

    In case you are not familiar with the xxx ? yyy : zzz syntax, it means if the expression in xxx is true then do yyy, else do zzz. So in this case, the gravity will always be -27 as long as the gameState is not “wait”.


    • This reply was modified 8 years, 12 months ago by  Alex.
    • This reply was modified 8 years, 12 months ago by  Alex.


    Thanks so much.

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