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