Question: By using GUI (GUIDE is more convenient) in matlab create a basketball shooting game And it is better if you can offer some choices for
By using GUI (GUIDE is more convenient) in matlab create a basketball shooting game
And it is better if you can offer some choices for the users,such as the size of the basket,the distance between the man and the basket. hint:the most simple way is: at first,the game ask the user to input the angle and the velocity, and then the game will illustrate a parabola and determine if the ball enter the basket or not.
I already have the following:
function parabola() fprintf ('WELCOME TO THE GAME '); fprintf ('Choose distance of the basket: '); fprintf ('1. 25m 2. 40m '); distance = input('Enter 1 or 2: '); u = input('Enter the initial velocity of the basketball: '); a = input('Enter the angle at which you want to shoot: '); % calculate the range R = (u*u)*sin(2*a); R = R/9.8; if (R == distance) fprintf (' You have won!'); else fprintf (' Sorry, better luck next time.'); end end
OUTPUT:
I would like to edit the code to add the parabola that shows whether the ball goes in or not.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
