Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Particles Emitter.burst(count, int x, int y) not working(((

Particles Emitter.burst(count, int x, int y) not working(((

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 288 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Galbarad
    wrote on last edited by
    #1

    Hi all,
    I have a small problem with Emitter looks like method burst(count, int x, int y) not working properly or I have a problem with understanding doc)
    problem - burst generate particale in RANDOM place but NOT in (x, y) point(
    Qt 5.13.0
    ok, so my code is

    import QtQuick 2.12
    import QtQuick.Particles 2.13
    
    Item {
       id: gameField
       anchors.fill: parent
    
       property double lastTouchX: 0
       property double lastTouchY: 0
       property int touchCount: 0
    
       MultiPointTouchArea {
           id: mptaMain
           anchors.fill: parent
           minimumTouchPoints: 1
           maximumTouchPoints: 1
           mouseEnabled: true
    
           property int pointCount:0
    
           touchPoints: [
               TouchPoint { id: point1 }
           ]
    
           onPressed: updatePointCount()
           onReleased: updatePointCount()
           onTouchUpdated: updatePointCount()
    
           function updatePointCount() {
               if (point1.pressed) {
                   lastTouchX = point1.x;
                   lastTouchY = point1.y;
                   ++touchCount;
               }
           }
       }
    
       ParticleSystem {
           id: psMain
       }
    
       Emitter {
           id: eLight
           anchors.fill: parent
           system: psMain
           size: 10
           endSize: 50
           enabled: false
           group: "light"
    
           ImageParticle {
               id:  ipLight
               color: "red"
               system: psMain
               source: "qrc:///res/particle.png"
               anchors.fill: parent
               clip: true
               groups: ["light"]
           }
    
           lifeSpan: 1000
       }
    
       Timer {
           id: tMain;
           interval: 30;
           running: false;
           repeat: true
           onTriggered: {
               if (lastTouchX && lastTouchY && touchCount) {
                   eLight.burst(touchCount, lastTouchX, lastTouchY); // there is a problem
                   lastTouchX = 0;
                   lastTouchY = 0;
                   touchCount = 0;
               }
           }
       }
       
       function creationFinished() {
           console.log("GameField.creationFinished", height_koeff, width, height);
    
           eLight.size *= height_koeff;
           eLight.endSize *= height_koeff;
    
           tMain.start();
       }
    }
    
    

    thanks for help)

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Galbarad
      wrote on last edited by
      #2

      ok, I read doc one more time and understand that burst(count, int x, int y) "move" Emitter to point (x, y)
      so only one possible way create track for cursor is in Emitter.onEmitParticles signal

      perhaps is possible emit particle in one emitter and show it on another canvas?
      thanks

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved