Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Q1: Draw stars in space moving across the canvas. [10 Marks] Your sketch should meet the following criteria: - Use a canvas size of 500

image text in transcribed
image text in transcribed
Q1: Draw stars in space moving across the canvas. [10 Marks] Your sketch should meet the following criteria: - Use a canvas size of 500 by 500. - To draw a star, use a circle. - In order to create a simulation of travelling in space, a. The star should first originate at the center of the canvas. b. It should then move away from the center at a constant speed. c. When it reaches the edge of the canvas, it should repeat steps a and b. d. Repeating steps a, b and c should create an impression of a spaceship travelling in space. - Typically, when an object is approached, the size of the object appears to increase. To create the effect that the ship is moving towards the stars, the size of the stars should change. a. The size of the star should gradually increase as it moves away from the center of the canvas. A constant MAX_STAR_SIZE should be used to achieve the maximum size of the star. - Draw at least 4 stars following the above requirements. - Use final named constants where needed - Use the primitive data type int and/or float. - You are required to create the following functions a. setup0 b. draw0 c. other functions as required - Use COMP1010A2Q1.mp4 for reference Q2: Rotate the spaceship. [10 Marks] In order to create an impression that space ship is rotating, all the stars should be rotated in the opposite direction. As an example, if you rotate the space ship clockwise, the stars should rotate counterclockwise. Create the following as part of this question: - Choose two keys, one for clockwise and other for counterclockwise direction. For illustration, key 'a' is used for counterclockwise rotations and ' d ' for clockwise. - Use the keyboard to rotate. Add the following functionalities to the program. 0 If key ' a ' is pressed, all the stars should rotate clockwise. This should work as long as the key is pressed. If user presses ' d ' keyboard, all the stars should rotate counterclockwise. The stars should rotate at a constant speed. - Declare variables and constants where applicable. - Create functions appropriately. - Do not use translate() or rotate() function available in Processing to achieve the effect. - You are free to use trignometric functions such as cos,sin() and atan(). - Use boolean variables where applicable. Watch the video COMP1010A2Q2.MP4 on moodle for an illustration

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

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

LO14.2 Discuss how game theory relates to oligopoly.

Answered: 1 week ago