2D Control

So I’m trying to make this basic 2d game where a bunch of bubble like prefabs float upwards and are destroyed on touch or if they hit the top. As time goes by the bubble objects are supposed to get faster. And I need clarity for the following:

  1. Should i use a separate script to control the movement of the objects and another just for spawning?
  • then would i use one main script for controlling it all?
  1. how would i instantiate a clone of a prefab from an array and control its velocity
  • would a couroutine help me out here? if so how could i control and destroy the clones being spawned?
  1. this is just a test i’ve tried a few different things before and i dont know which direction to take

Thank you for your time and help

I am fairly new to unity and this might not be right but

  1. Yes you should have different scripts, the one for spawning should be attached to an object present all the time the bubbles are spawning and the script controlling the movement should be attached to the bubble prefab.

  2. For this I’m not sure if you meant that you have an array of choices for the bubble prefab but in that case the simplest way would probably be to set up an if statement for each bubble prefab attached to a number that you randomize right before. The velocity would be controlled by the script attached to the prefab.