Solved Help with summoning particles one by one.

Discussion in 'Plugin Development' started by 360_, Jun 16, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    360_

    I'm trying to make the particles on my ring particle effect to summon the particles one by one and not spawning all particles at once. I'm not sure how to do something like this and I was hoping someone could help me achieve this. This is the code I have atm.
    Edit: Got it working
     
    Last edited: Jun 17, 2018
  2. Offline

    ThePandaPlayer

    I just want to double check, the particles spawn with every execution of the for loop?


    If so, I would add some kind of pause statement or a Thread.sleep (don't actually use thread.sleep it will crash most likely). The execution of a for loop is VERY fast (thousands of times per second) and it needs something to slow it down somewhere.
     
  3. Offline

    timtower Administrator Administrator Moderator

    @360_ Have a variabke in the runnable that indicates phi, then let make it like every time the run method gets called it executes a loop.
     
  4. Offline

    360_

    @ThePandaPlayer , Yeah the particles summon for every execution of the for loop
     
  5. Offline

    MightyOne

    well if you put your double phi somewhere outside of the BukkitRunnable and just increase it a bit every run() the ring will appear step by step. then you dont need the for-loop anymore
     
  6. Offline

    360_

    @MightyOne , Ok so if I'm understanding this correctly, i move double phi = 0; from
     
  7. Offline

    MightyOne

    I don't get what is so difficult to understand about it. Every 7 ticks you your pparticles to show up at a step further in the circle. So you need a global variable like
    Code:
    private double phi = 0;
    and a BukkitRunnable that increases this value, the degrees, every 7 ticks or so. Only like that you can make sure to know where the last particle was and to spawn the next one a degree further. Isn't that basic java?
     
Thread Status:
Not open for further replies.

Share This Page