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

Forums

OverviewFelgo 1 Support › TriggeredOnStart question

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

    marta.wierszak

    Hello,

    I have a question related with on triggeredOnStart property.

    In documentation there is written that “When a timer is started, the first trigger is usually after the specified interval has elapsed.” In my program it doesn’t matter if I set it “true” or “false”, the first trigger is after the same time ( about 1 second, unfortunately it  is not after specified interval time). So I don’t know if I understand this quoted sentence properly.

    Cheers,

    Marta

    #4350

    Christian
    Felgo Team

    Hi Marta, could you please post the source code for your issue?

    Cheers, Chris

    #4352

    marta.wierszak

    Here it is:

    Image {
        id: cloudsWHITE
        x: 37
        y: -59
        width: 396
        height: 429
        source: "../../Desktop/vplayPapi/clouds.png"
        MovementAnimation {
          id: movClouds
          target: parent
          property: "pos"
          running: false
          velocity: Qt.point(0, 60)
        }
      }
      Timer {
        id: timerCloud
        running: true
        repeat: true
        onTriggered: {
          cloudsWHITE.y = -549;
          interval = 5000
          if(movClouds.running === false){
            interval = 14000;
            movClouds.start();
            movClouds.running = true
          }
          else{
            interval = 1;
            movClouds.stop();
            movClouds.running = false;
          }
        }
      }

     

    In this code I repeat the image movement from the top of the window to the bottom.

    To have fluent movement (moving background) I wanted to add the same image in the second timer that would start after (14/2=)7 seconds
    (the first image needs 14 sec to pass all window). So I set the interval = 7 s. But the timers start working at the same time.
    I don’t know if there is any esier way to create moving background, so that’s what I did.

    Hopefully it is somehow clear what I wrote 😉

    #4353

    Christian
    Felgo Team

    Hi Marta,

    yes it’s clear now 🙂

    For a moving background, please use the ParallaxScrollingBackground item, or see how it is done in the ChickenOutbreak demo in the file Level.qml. You should not use Timers for shifting the Images, but rather use the onYChanged signal of the Image. I am also not sure how big, i.e. how high your clouds image is, but usually you will need to make it 576×368 for the sd version, 1152×736 for hd and 2304×1472 for hd2 to support widescreen devices as well (see the guide How to create mobile games for different screen sizes and resolutions). And then you would need to make 2 images below each other, exactly like in ChickenOutbreak demo. But the easier way to do this is using the ParallaxScrollingBackground, as this item does it automatically.

    Cheers, Chris

    #4355

    marta.wierszak

    Thank you very much for your help! It works now ofc. I don’t know why I overlooked this item before going over the documentation. I’ve  also changed the size already.

    BR,

    Marta

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