Make the object move in the circle (asteroids game)

I did it but now I have 2 more problems
The first one is now I have to change the colour of the background every time i open it should be different
The second is I have to create a gate ( with 2 rect) that spawned at top or bottom at the first time we try if we hit the gate the game stop and if we go through that gate the background change colour and the gate should spawn at left or right now
I really appreciate if u can help me with this last one