What I have now:
A ball spawning in the centre of the screen and I'm at the moment using random(360) to make it shoot in random directions with the bullet behaviour.
What I want to do:
I want to control the direction which random(360) won't allow. For example if the generated random number is around 90 or 270 it means that the ball shoots down or up, which I don't want. I want to direct the ball a bit more to the left and right.
How do I go around this and solve the issue?
Unfortunately that still includes 270 degrees. Wish I could include images or URL's to show what I mean.
For exact angles the simplest way would be int(choose(20,340))
Or more complicated int(random(1))=1 ?20 :340
Develop games in your browser. Powerful, performant & highly capable.
That solved it!
I used this line which chooses from 6 different angles for left and 6 for right.
Thank you very much.
You could also do something like this:
If 45 is two wide reduce it to a smaller number.
Awesome! That was exactly what I initially had in mind. Tested it and it worked like a charm. Thanks both of you for your responses and solutions.