1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Luba_88 [7]
1 year ago
12

Im trying to do an animation only using simplegui in python and my objective is make the ball enters frame, be confused and jump

to the square in the middle of the room. The problem is that the ball is duplicating and moving its copy instead of moving itself. Here is the code:
import simplegui


x = -100

y = 450

a = 100

b = 450


def draw_handler(canvas):


#back grownd ---------------------------------------------------------------


canvas.draw_polygon([(0,500), (600, 500), (600, 600), (0,600)], 4, "gray", "gray")

canvas.draw_polygon([(200, 477), (400, 477), (400, 500), (200, 500)], 4, "#a6712d", "#a6712d")


#bomb 1

canvas.draw_line((553, 304), (530, 275), 10, "white")

canvas.draw_circle((570,330), 43, 5, "black", "black")


#bomb 2

canvas.draw_line((35, 253), (36, 224), 10, "white")

canvas.draw_circle((33, 298), 43, 5, "black", "black")




#box 1

canvas.draw_polygon([(0, 322), (172, 322), (172, 500), (0, 500)], 20, "#a16c27", "#734810")

canvas.draw_line((172, 322), (0, 500), 20, "#a16c27")


#box 2

canvas.draw_polygon([(476, 374), (600, 374), (600, 500), (476, 500)], 20, "#a16c27", "#734810")

canvas.draw_line((600, 374), (476, 500), 20, "#a16c27")


#character ---------------------------------------------------------------

#x = 300

#y = 400


#canvas.draw_circle((x, y), 80, 10, "#bd80d9", "#a93bdb")

#canvas.draw_polygon([(x+ 30, y - 110), (x-30, y - 110), (x-30, y - 140), (x-15, y-130), (x, y-150), (x+15,y-130), (x+30,y-140)], 3, "#f5bd56", "#f5d356")


#story board 1 ---------------------------------------------------------------


def animation():

x = -100

y = 450


canvas.draw_circle((x, y), 80, 10, "#bd80d9", "#a93bdb")

canvas.draw_polygon([(x+ 30, y - 110), (x-30, y - 110), (x-30, y - 140), (x-15, y-130), (x, y-150), (x+15,y-130), (x+30,y-140)], 3, "#f5bd56", "#f5d356")


#story board 2 ---------------------------------------------------------------


def animation():

global x

global y



x = x+1.5

if(x>100):

x = 100


canvas.draw_circle((x, y), 80, 10, "#bd80d9", "#a93bdb")

canvas.draw_polygon([(x+ 30, y - 110), (x-30, y - 110), (x-30, y - 140), (x-15, y-130), (x, y-150), (x+15,y-130), (x+30,y-140)], 3, "#f5bd56", "#f5d356")


#story board 3 ---------------------------------------------------------------


if(x == 100):

canvas.draw_text("???", (150, 370), 40, "white")


#story board 4 ---------------------------------------------------------------


global a

global b


a = a + 5

b = b - 2.5


if (a > 300):

a = 300

b = 400


canvas.draw_circle((a, b), 80, 10, "#bd80d9", "#a93bdb")

canvas.draw_polygon([(a+ 30, b - 110), (a-30, b - 110), (a-30, b - 140), (a-15, b-130), (a, b-150), (a+15,b-130), (a+30,b-140)], 3, "#f5bd56", "#f5d356")







animation()


frame = simplegui.create_frame('Testing', 600, 600)

frame.set_canvas_background("#363636")

frame.set_draw_handler(draw_handler)

frame.start()


I would really appreciate some help
Computers and Technology
1 answer:
viva [34]1 year ago
5 0
The answer is B = 450 because I just know
You might be interested in
I wanna start answering questions for people, but I don't quite know how. Can you help me?​
Vsevolod [243]

Answering questions on brainly?

6 0
3 years ago
Write a Python program that translates a binary number of n bits to a decimal number. Your program should first ask the user the
KonstantinChe [14]

Answer:

Follows are the code to this question:

n= int(input("please enter number of bits, which want to convert for binary to decimal numbers: "))

p= 1#defining variable p for calculate power

d= 0#defining variable d for calculate decimal value

for i in range(n):#defining for loop for input bits value

   b= int(input("Enter the bit value from lowest to highest: "))#input value in b

   if b==1:#defining if block that check input is 1 value

       d=d+p#calculating decimal value

   p=p* 2#calculating power

print("The converted decimal number is:",d)#print value

Output:

please find the attached file.

Explanation:

In the above-given code, n variable is defined, which takes the number of bits value which you want to convert into a decimal value.

In the next step, "d and p" variable is defined that calculates the power and decimal number and store its value respectively, in this step, a for loop is used that uses the "b" variable for inputs bits value into lowest to the highest form, and use the if block.

In this block, it checks if the input value is one then it calculates its power and store its value into the "d" variable and use the print method to print its value.  

3 0
2 years ago
Which of the following parameters should match in order for a pair of routers to form an adjacency when running OSPFv2? (Points
Gnom [1K]

Answer: Subnet mask

Explanation:

 Subnet mask is the type of parameter that should be match in order to form the adjacency for running the OSPFv2. The subnet mask is mainly used to identifying the address of network in the system.

The OSPF enable the router that must form an adjacency with the neighbors before sharing any type of data.

It mainly determine the neighbors links in the OSPF. The OSPFv2 router send the special type of message which is known as hello packet in the network.  

 

4 0
3 years ago
Consider the recursive method myprint in this code snippet: public void myprint(int n) { if (n < 10) { system.out.print(n); }
valkas [14]
What the method does, is it takes the rightmost decade and prints it, then divides by 10 and repeats. Effectively this means the number is printed backwards, so the output is 128.
7 0
3 years ago
Ternary operators of computer<br><br>please explain. ​
Nitella [24]

Answer:

It's a compact way of doing an if-else statement.

General Format is

<<em>condition</em>> ? <if condition is true> : <else>;

Example:

I could rewrite:

  if(a==1) temp = 1;

  else     temp = 999;

as

  temp = (a==1) ? 1 : 999;

5 0
3 years ago
Other questions:
  • Which loan type requires you to make loan payments while you’re attending school?
    10·1 answer
  • What are the two different frequencies WiFi operates on?
    9·2 answers
  • What part of a check is the LEAST important?
    14·2 answers
  • Text messaging is an example of nonverbal communication. Please select the best answer from the choices provided. T F
    7·2 answers
  • Explain how to utilize the computer in rooms management.​
    13·1 answer
  • A swimming pool has a length of 28 feet, a width of 17 feet, and a depth of 6 feet. How much water can the swimming pool hold?
    10·1 answer
  • About C header files of C programming
    8·1 answer
  • Create a text file content.txt and copy-paste following text (taken from Wikipedia) into it: A single-tasking system can only ru
    7·1 answer
  • Are there any Potential Dangers in Artificial Intelligence?
    11·2 answers
  • There are many potential risks associated with the internet. what do we call the distribution and access of illegal copies of di
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!