Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With this code if i add another turtle (rectangle shaped) how do i get it to where its at the bottom of the screen and

With this code if i add another turtle (rectangle shaped) how do i get it to where its at the bottom of the screen and how do i make it to where if the ball hits the rectangle the game stops image text in transcribed
image text in transcribed
Boost de Python code is import turtle#import the turtle module.It is a turtle is a pre-#installed Python library that enables users to create #pictures #and shapes turtle shape("circle")#This function is used to set the turtle shape #as circle xdir = 1#Initialize the value of xdir as 1 ydir = 1#Initialize the value of ydir as 1 x = 1#Initialize the value of x as 1 y = 1#Initialize the value of 7 as 1 wn=turtle.Screen()#This function returns a singleton object of a #TurtleScreen subclass wn.bgcolor("pink")#set the background color as pink while True:#While loop used for working the below steps continuously * = x + 3 * xdir# In each loop increment the value of x by x + #3xdir y = y + 3 * ydir# in each loop increment the value of y by y + #3ydir turtle.goto(x, y)#This method is used to move the turtle to an #absolute position. if x >= turtle.window_width()/2:#check the condition #x>sturtle.window_width()/2 then xdir = - 1#Assign the value of xdir as-1 if x = turtle.window_height()/2:#check the condition y >= #turtle.window_height(1/2 then ydir = -1#Assign the value of ydir as -1 if y = turtle.window_height()/2:#check the condition y >= #turtle.window_height()/2 then ydir = -1#Assign the value of ydir as -1 if y = turtle.window_width()/2: tcheck the condition x=turtle window_width 12 then xdir --#Assign the value of xdir as -1 * -turtle.window_width()/2:#check the condition xc -turtle window_width 0/2 then xdir = 1 Assign the value of xdir as 1 11 y turtle window_height()/2: check the condition y turtle.window_height0/2 then ydir = -1#Assign the value of ydir as -1 if y-turtle.window_height()/2=check the condition ys-turtle.window_height 1/2 the ydir - 1 Assign the value of ydir as 1 turtle.penup() This method used for pull the pen up. That is no drawing when #moving the shape turtle.mainloop() # This method used to wait for user to close window Boost de Python code is import turtle#import the turtle module.It is a turtle is a pre-#installed Python library that enables users to create #pictures #and shapes turtle shape("circle")#This function is used to set the turtle shape #as circle xdir = 1#Initialize the value of xdir as 1 ydir = 1#Initialize the value of ydir as 1 x = 1#Initialize the value of x as 1 y = 1#Initialize the value of 7 as 1 wn=turtle.Screen()#This function returns a singleton object of a #TurtleScreen subclass wn.bgcolor("pink")#set the background color as pink while True:#While loop used for working the below steps continuously * = x + 3 * xdir# In each loop increment the value of x by x + #3xdir y = y + 3 * ydir# in each loop increment the value of y by y + #3ydir turtle.goto(x, y)#This method is used to move the turtle to an #absolute position. if x >= turtle.window_width()/2:#check the condition #x>sturtle.window_width()/2 then xdir = - 1#Assign the value of xdir as-1 if x = turtle.window_height()/2:#check the condition y >= #turtle.window_height(1/2 then ydir = -1#Assign the value of ydir as -1 if y = turtle.window_height()/2:#check the condition y >= #turtle.window_height()/2 then ydir = -1#Assign the value of ydir as -1 if y = turtle.window_width()/2: tcheck the condition x=turtle window_width 12 then xdir --#Assign the value of xdir as -1 * -turtle.window_width()/2:#check the condition xc -turtle window_width 0/2 then xdir = 1 Assign the value of xdir as 1 11 y turtle window_height()/2: check the condition y turtle.window_height0/2 then ydir = -1#Assign the value of ydir as -1 if y-turtle.window_height()/2=check the condition ys-turtle.window_height 1/2 the ydir - 1 Assign the value of ydir as 1 turtle.penup() This method used for pull the pen up. That is no drawing when #moving the shape turtle.mainloop() # This method used to wait for user to close window

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

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. How would you address the problems that make up the situation?

Answered: 1 week ago

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago