1. Hey! Guest! The 36th GMC Jam will take place between February 27th, 12:00 UTC - March 2nd, 12:00 UTC. Why not join in! Click here to find out more!
    Dismiss Notice

Need explanation on how drag and drop random works

Discussion in 'Programming' started by Ignas, Apr 4, 2019.

  1. Ignas

    Ignas Member

    Joined:
    Apr 4, 2019
    Posts:
    7
    Let me say clear what I try to create.

    On top of the screen there is 3 ball spawners.
    Below screen is line.


    On start of the game, 1 ball will be already in the middle of the screen.
    Ball will fall down and after ball touches the line, new ball will be randomly spawned in 1 of the spawners.


    So my question is, how to make it work with drag and drop?

    If you can make an example, THAT WOULD BE GREAT.

    THANKS :)
     
  2. Miradur

    Miradur Member

    Joined:
    Jan 16, 2018
    Posts:
    129
    Here is a tutorial from @GMWolf , not D&D but probably helpful:



    Miradur
     
  3. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,971
    You could use the Choose D&D for this. Provide it with the instance IDs of the spawners, then create an instance at the location of the spawner that was returned by Choose.

    Providing you with a working example would be detrimental to your learning experience, so I can't recommend that practice. If you get stuck along the way, report back with what you've tried and we can see where to go from there.
     
  4. Ignas

    Ignas Member

    Joined:
    Apr 4, 2019
    Posts:
    7
    Thanks :)
     
  5. Ignas

    Ignas Member

    Joined:
    Apr 4, 2019
    Posts:
    7
    The problem is, I don't understand how to combine all together
     
  6. TsukaYuriko

    TsukaYuriko Q&A Spawn Camper Forum Staff Moderator

    Joined:
    Apr 21, 2016
    Posts:
    1,971
    Store the result of the random selection in a variable. Then refer to the coordinates of the instance stored in said variable when creating the new ball.
     

Share This Page