merge local and remote repo
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
# Ping Pong Game
|
||||
This ping_pong game made by frank
|
||||
|
||||
<<<<<<< HEAD
|
||||

|
||||
=======
|
||||

|
||||
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
|
||||
|
||||
## Setup & Run
|
||||
Install the required dependency and start the game with the following commands:
|
||||
|
||||
12
main.py
12
main.py
@@ -1,9 +1,12 @@
|
||||
import pgzrun
|
||||
<<<<<<< HEAD
|
||||
import random
|
||||
|
||||
#随机数生成
|
||||
random_intX = random.randint(235, 1685)
|
||||
random_intY = random.randint(235, 845)
|
||||
=======
|
||||
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
|
||||
|
||||
music.play('bgm')
|
||||
# 窗口参数
|
||||
@@ -21,11 +24,14 @@ paddle2 = Actor("2")
|
||||
paddle2.x = WIDTH - 80
|
||||
paddle2.y = HEIGHT / 2
|
||||
|
||||
<<<<<<< HEAD
|
||||
#box生成
|
||||
tbox = Actor("t_box")
|
||||
tbox.x = random_intX
|
||||
tbox.y = HEIGHT / 2
|
||||
|
||||
=======
|
||||
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
|
||||
# 乒乓球
|
||||
ball = Actor("ball")
|
||||
ball.pos = (WIDTH//2, HEIGHT//2)
|
||||
@@ -49,7 +55,10 @@ def draw():
|
||||
paddle1.draw()
|
||||
paddle2.draw()
|
||||
ball.draw()
|
||||
<<<<<<< HEAD
|
||||
tbox.draw()
|
||||
=======
|
||||
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
|
||||
|
||||
# 游戏结束提示
|
||||
if game_state == "gameover":
|
||||
@@ -85,6 +94,7 @@ def update():
|
||||
if ball.colliderect(paddle1) or ball.colliderect(paddle2):
|
||||
ball_speed_x *= -1
|
||||
sounds.bump.play()
|
||||
<<<<<<< HEAD
|
||||
#方块实现
|
||||
if ball.colliderect(tbox):
|
||||
sounds.bump.play()
|
||||
@@ -103,6 +113,8 @@ def update():
|
||||
random_intY = random.randint(235, 845)
|
||||
tbox.x = random_intX
|
||||
tbox.y = random_intY
|
||||
=======
|
||||
>>>>>>> 2d13872febf768c59aec106182ed404dbbf57614
|
||||
|
||||
# 出左右边界直接失败
|
||||
if ball.left <= 0:
|
||||
|
||||
Reference in New Issue
Block a user