I have 2 Questions;
1.How do i throw square in different directions on every click while maintaining cyan border restriction
2.How to keep rotating square after i click in z-axis
I have 2 Questions;
1.How do i throw square in different directions on every click while maintaining cyan border restriction
2.How to keep rotating square after i click in z-axis
If you want to pick a random direction in a cone defined by two angles, then you simply create a random angle between those values (minAngle + random * (maxAngle - minAngle)), then you use trigonometric equations to convert it into a vector:
x = cos(angle)
y = sin(angle)