How to randomly instance objects in the scene | Godot

Поделиться
HTML-код
  • Опубликовано: 20 ноя 2024

Комментарии • 15

  • @prunckrab
    @prunckrab Год назад

    Thanks! Your video helped me a lot

  • @hansamuoji9378
    @hansamuoji9378 Год назад

    What algorithm did you use to make the object spawn randomly?

  • @musicgd987123
    @musicgd987123 Год назад

    Thank you, you're a godssend

  • @scary_
    @scary_ 3 года назад +1

    Thanks a lot dude

  • @jamesxxxyz8775
    @jamesxxxyz8775 4 года назад +1

    You don't to write $Timer.wait_time = 5, because you don't choose One Shot. One Shot is for only one time. How do you avoid overlappping between all objects (and player) while random spawning?

    • @Daviesdev
      @Daviesdev  4 года назад

      You can make an array called 'positions' then at every spawn you append the position to all position of spawn objects.
      Then you say
      'for pos in positions:
      If vector2(rand_x,rand_y) == pos:
      randomise()
      Rand_x = # use the rand_range code
      Rand_y = #use the rand_range code'
      For more understanding join my discord
      The link is in the description

  • @khushbupandey5570
    @khushbupandey5570 6 месяцев назад

    Yo, Im on godot 4, and I REALLY need a solution ASAP, gotta use this for an assignment for tommorrow, please reply.

  • @36OLink1
    @36OLink1 Год назад

    its not working for me! Ive watched every single tutorial of instancing on youtube and it still doesnt work!

    • @Daviesdev
      @Daviesdev  Год назад

      I hope you are not using godot 4

    • @36OLink1
      @36OLink1 Год назад

      @@Daviesdev no! btw got it working. Just had to figure it out myself

    • @darealspawn
      @darealspawn Год назад

      and what is the answer ?
      @@36OLink1

  • @MasTho0128
    @MasTho0128 4 года назад +1

    Good job bro

  • @isaacdobson8760
    @isaacdobson8760 Год назад

    very useful