コード例 #1
0
ファイル: main.py プロジェクト: xianc78/Pong
from score import Score
pygame.init()

screen = pygame.display.set_mode((constants.screen_width, constants.screen_height))
pygame.display.set_caption("Pong")

clock = pygame.time.Clock()

ball = Ball(random.randint(0, 800), random.randint(0, 600))

paddle1 = Paddle(10, constants.screen_height/2)
paddle2 = Paddle(780, constants.screen_height/2)

paddle_list = [paddle1, paddle2]

ball.paddle_list = paddle_list

scoreBoard = Score(constants.screen_width/2, 0)

def terminate():
	pygame.quit()
	sys.exit()

while True:
	# Fill the screen
	screen.fill(constants.BLACK)

	# Display the game objects
	for paddle in paddle_list:
		screen.blit(paddle.image, (paddle.rect.x, paddle.rect.y))
	screen.blit(ball.image, (ball.rect.x, ball.rect.y))