源码:
#Python#
from Walimaker import *
setup(1024,550)
bgpic('./篮球场.jpg')
b=Character('./篮球.png')
b.scale(0.2)
vx=0
vy=0
r=0,0
sc=0
t=TextBox(70)
t.print(0)
t.goto(0,200)
h=Character('./篮筐.png')
h.scale(0.3)
h.goto(350,120)
while True:
update()
vy-=0.8
b.x+=vx
b.y+=vy
if b.y<=-275:
vy=-vy*0.8
b.y=-275
if b.x<=-512:
vx=-vx*0.8
b.x=-512
if b.x>=512:
vx=-vx*0.8
b.x=512
if b.get_mouse_clicked():
b.goto(get_mouse_pos())
vx=0
vy=0
r=get_mouse_rel()
if b.get_mouse_just_released():
vx,vy=r
if b.separate(h):
sc+=1
t.print(sc)
if sc>=5:
while True:
update()
t.print('Congratulations on winning.press Q Reopen')
if key_pressed(K_q):
sc=0
t.print(0)
break