Question
For Player 1: X1= xpos + 2*(turret_width)/3 Y1 = ypos + 3*(turret_width)/4 X2 = X1 + barrel_length*cos(theta) X2 = Y1 + barrel_length*sin(theta) Player 2: X1
For Player 1:
X1= xpos + 2*(turret_width)/3
Y1 = ypos + 3*(turret_width)/4
X2 = X1 + barrel_length*cos(theta)
X2 = Y1 + barrel_length*sin(theta)
Player 2:
X1 = xpos + turret_width/3
Y1 = ypos + 3*(turret_width)/4
X2 = X1 - barrel_length*cos(theta)
Y2 = Y1 + barrel_length*sin(theta)
Task : Writing the function
Once you have the equations for the gun barrel coordinates, write the function calc_barrel_pos
using the same ordering of arguments as above. This function MUST be saved with the filename
calc_barrel_pos.m. Use the argument player to determine which of the sets of equations to
use from Task 1 to calculate the gun barrel positions.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started