Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Notes: Name your sketch using your name, and the assignment number, exactly as in this example: LastnameFirstnameA2. You will submit only one program in this

image text in transcribed
Notes: Name your sketch using your name, and the assignment number, exactly as in this example: LastnameFirstnameA2. You will submit only one program in this assignment. Your program must run upon download to receive any marks. Submit one pde file only. Do not submit any other types of files. Assignments must follow the programming standards document published on the course website on UM Leam. After the due date and time assignments may be submitted but will lose 2% of marks per hour late or portion thereof. The date and time of the last file submitted controls the mark for the entire assignment. You may submit your program multiple times, but only the most recent version will be marked. These assignments are your chance to learn the material for the exams. Code your assignments independently. We use software to compare all submitted assignments to each other, and pursue academic dishonestly vigorously. Q1: Angular spaceship (6 marks) You should be able to do this question after Week 4 in the course. It covers floating point, trigonometry, and functions. Write an Active Processing program which will draw the simple angular "spaceship" shown at right. (It's like the one in the classic video game "Asteroids".) You must have three variables that control the position (x,y) and angle (0) of the spaceship, as shown in Figure 1. (Give your variables better names than x, y, or theta.) Each time your program is run, it should pick random values for these three variables. While testing your program, you should also try it with some specific positions and angles. You must have three constants that control the size and shape of the spaceship (dl, d2, and ), as shown in Figure 2. Experiment to find suitable values for these constants. Give them better names. Define a function void calcPoints() which will use the six values described above (three variables and three constants) to calculate the coordinates of the other three points needed to draw the ship (the nose, and the ends of the two fins). Store the x and y coordinates of these three points in six suitably-named variables. Define a function void drawShip() which will draw the spaceship in the correct position and at the correct angle. Give your spaceship any solid light colour that will show up well against a dark background. You can use the built-in quad() command which will connect any four points. It takes 8 parameters. Draw your ship against a dark background. Notes: Name your sketch using your name, and the assignment number, exactly as in this example: LastnameFirstnameA2. You will submit only one program in this assignment. Your program must run upon download to receive any marks. Submit one pde file only. Do not submit any other types of files. Assignments must follow the programming standards document published on the course website on UM Leam. After the due date and time assignments may be submitted but will lose 2% of marks per hour late or portion thereof. The date and time of the last file submitted controls the mark for the entire assignment. You may submit your program multiple times, but only the most recent version will be marked. These assignments are your chance to learn the material for the exams. Code your assignments independently. We use software to compare all submitted assignments to each other, and pursue academic dishonestly vigorously. Q1: Angular spaceship (6 marks) You should be able to do this question after Week 4 in the course. It covers floating point, trigonometry, and functions. Write an Active Processing program which will draw the simple angular "spaceship" shown at right. (It's like the one in the classic video game "Asteroids".) You must have three variables that control the position (x,y) and angle (0) of the spaceship, as shown in Figure 1. (Give your variables better names than x, y, or theta.) Each time your program is run, it should pick random values for these three variables. While testing your program, you should also try it with some specific positions and angles. You must have three constants that control the size and shape of the spaceship (dl, d2, and ), as shown in Figure 2. Experiment to find suitable values for these constants. Give them better names. Define a function void calcPoints() which will use the six values described above (three variables and three constants) to calculate the coordinates of the other three points needed to draw the ship (the nose, and the ends of the two fins). Store the x and y coordinates of these three points in six suitably-named variables. Define a function void drawShip() which will draw the spaceship in the correct position and at the correct angle. Give your spaceship any solid light colour that will show up well against a dark background. You can use the built-in quad() command which will connect any four points. It takes 8 parameters. Draw your ship against a dark

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Example. Evaluate 5n+7 lim 7-00 3n-5

Answered: 1 week ago

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago