Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help writing the code for this, It should be written in Processing 3 in Python For this question, you will write a program

I need help writing the code for this, It should be written in Processing 3 in Python

image text in transcribed

For this question, you will write a program where the user can move a Pok Ball left and right, and the Pok Ball must also rotate accordingly. Your program should behave as follows: When the program starts: Display a blank, grey canvas with a Pok Ball drawn in the middle of the canvas. When the user presses the 'D' key: The Pok Ball should move to the right while rotating clockwise. When the user presses the 'A' key: The Pok Ball should move to the left while rotating counter-clockwise. When the user releases all keys: The Pok Ball should stop moving and rotating. You will need to use variables in this program to keep track of the horizontal ( x ) position of the Pok Ball. as well as the angle indicating how much it has been rotated. Figure 1: Canvas after the Pok Ball has been drawn. You should follow the model-view-controller design pattern. The Pok Ball should be drawn inside of its own function (draw_pokeball ()) which takes two parameters: the x-coordinate, and the angle of rotation. These values should change depending upon the user pressing the left or right arrow keys. The movement speed and rotation speed can be any speed you like, as long as it is evident that the ball moves and rotates correctly. Hint: Drawing much of the Pok Ball and handling its rotation can be done by passing the correct arguments into Processing's arc () function

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

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions