这里写本次修改说明

This commit is contained in:
Frank
2026-06-17 14:56:33 +08:00
parent b43e424640
commit 30d1934359

15
main.py
View File

@@ -1,12 +1,9 @@
import pgzrun import pgzrun
<<<<<<< HEAD
import random import random
#随机数生成 #随机数生成
random_intX = random.randint(235, 1685) random_intX = random.randint(235, 1685)
random_intY = random.randint(235, 845) random_intY = random.randint(235, 845)
=======
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
music.play('bgm') music.play('bgm')
# 窗口参数 # 窗口参数
@@ -24,14 +21,12 @@ paddle2 = Actor("2")
paddle2.x = WIDTH - 80 paddle2.x = WIDTH - 80
paddle2.y = HEIGHT / 2 paddle2.y = HEIGHT / 2
<<<<<<< HEAD
#box生成 #box生成
tbox = Actor("t_box") tbox = Actor("t_box")
tbox.x = random_intX tbox.x = random_intX
tbox.y = HEIGHT / 2 tbox.y = HEIGHT / 2
=======
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
# 乒乓球 # 乒乓球
ball = Actor("ball") ball = Actor("ball")
ball.pos = (WIDTH//2, HEIGHT//2) ball.pos = (WIDTH//2, HEIGHT//2)
@@ -55,10 +50,8 @@ def draw():
paddle1.draw() paddle1.draw()
paddle2.draw() paddle2.draw()
ball.draw() ball.draw()
<<<<<<< HEAD
tbox.draw() tbox.draw()
=======
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
# 游戏结束提示 # 游戏结束提示
if game_state == "gameover": if game_state == "gameover":
@@ -94,7 +87,6 @@ def update():
if ball.colliderect(paddle1) or ball.colliderect(paddle2): if ball.colliderect(paddle1) or ball.colliderect(paddle2):
ball_speed_x *= -1 ball_speed_x *= -1
sounds.bump.play() sounds.bump.play()
<<<<<<< HEAD
#方块实现 #方块实现
if ball.colliderect(tbox): if ball.colliderect(tbox):
sounds.bump.play() sounds.bump.play()
@@ -113,8 +105,7 @@ def update():
random_intY = random.randint(235, 845) random_intY = random.randint(235, 845)
tbox.x = random_intX tbox.x = random_intX
tbox.y = random_intY tbox.y = random_intY
=======
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
# 出左右边界直接失败 # 出左右边界直接失败
if ball.left <= 0: if ball.left <= 0: