My solutions for this chapter

To solve the waiting condition for the particle emitter to finish, I used a while loop. Interestingly the sound seems to play even after the queue is freed. What I'm wondering though is if a while loop is optimal for performance, since it keeps constantly checking if the condition is true. Or if it would be better to use a finish signal in this case.

I would also like to post my solution for the third challenge. It took me a while to figure out, but it was quite fun! I tried to sketch out the spread of bullets on paper and figure out how to divide it for equal spacing of the other shots. What I found out is, when I multiply the spread by two, I get the length of it, which I can then divide by the number of shots -1 to get the value for spacing. So I just spawn the first shot in the for loop with default spread and then subtract the spacing for the other loops. This method does not work, if I choose to shoot just one bullet, but I believe that could be solved with an if condition.

Also I'd like to note using onready var for the spread length was important, when using export for the other values. What was happening without that was that the spread_length was getting the scripts default values for those variables, instead of the ones I set in the inspector.

  • a
    andrewjhaugen replied

    Very creative solutions Ubuchy! Nice work! I find busting out the old pencil and paper to sketch out some ideas for these types of problems is quite helpful as well. Thanks for sharing!

    1 love
  • u
    ubuchy replied

    Thanks Andrew! Agreed, I find it super useful to visualize such problems quite often!