資源簡介
代碼片段和文件信息
import??pygame?as?pg
import??sys
import?random
import??time
pg.init()
game_window?=?pg.display.set_mode((600500))
pg.display.set_caption(‘彈球‘)
window_color?=?(00255)
ball_color?=?(2551650)
rect_color?=?(25500)
score?=?0
font?=?pg.font.Font(None70)
ball_x?=?random.randint(20580)
ball_y?=?20
move_x?=?1
move_y?=?1
point?=?1
count?=?0
while?True:
????game_window.fill(window_color)
????for?event?in?pg.event.get():
????????if?event.type?==?pg.QUIT:
????????????sys.exit()
????mouse_xmouse_y?=?pg.mouse.get_pos()
????pg.draw.circle(game_windowball_color(ball_xball_y)20)
????pg.draw.rect(game_windowrect_color(mouse_x49010010))
????my_text?=??font.render(str(score
評論
共有 條評論