-1
\$\begingroup\$

Here What I want to achieve

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

Check This Video For Hint

\$\endgroup\$
2
  • \$\begingroup\$ welcome to Game Development! Could you specific what you gave tried to accomplish this? It helps people answer your question! \$\endgroup\$ Commented Nov 7, 2017 at 21:29
  • \$\begingroup\$ Do you want it to be random or just within the scope of a breakout game? \$\endgroup\$ Commented Nov 9, 2017 at 11:14

1 Answer 1

1
\$\begingroup\$

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)
\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.