|
|
@@ -1,6 +1,8 @@ |
|
|
|
import pygame |
|
|
|
# init Spieldaten |
|
|
|
|
|
|
|
pygame.init() |
|
|
|
myfont = pygame.font.SysFont('Comic Sans MS', 40) |
|
|
|
global running |
|
|
|
speed = 0 |
|
|
|
|
|
|
|
|
|
|
@@ -61,23 +63,29 @@ def reflect_y(): |
|
|
|
speed_y *= -1 |
|
|
|
|
|
|
|
def show_game_over(): |
|
|
|
global image_g_o |
|
|
|
screen.blit(image_g_o, (0, 0)) |
|
|
|
global image_g_o, screen, running |
|
|
|
screen.blit(image_g_o, (300, 100)) |
|
|
|
textsurface = myfont.render('PONG', True, (0, 50, 200)) |
|
|
|
screen.blit(textsurface, (500,80)) |
|
|
|
textsurface = myfont.render('Press Space to restart - Escape to exit', True, (0, 50, 200)) |
|
|
|
screen.blit(textsurface, (200, 500)) |
|
|
|
pygame.display.flip() |
|
|
|
waiting = True |
|
|
|
while waiting: |
|
|
|
for event in pygame.event.get(): |
|
|
|
if (event.type == pygame.QUIT or event.key == pygame.K_ESCAPE): |
|
|
|
if (event.type == pygame.QUIT): |
|
|
|
print('quit') |
|
|
|
waiting = False |
|
|
|
pygame.quit() |
|
|
|
#self.running = False |
|
|
|
running = False |
|
|
|
if event.type == pygame.KEYDOWN: |
|
|
|
if event.key == pygame.K_SPACE: |
|
|
|
print('space') |
|
|
|
waiting = False |
|
|
|
init_game() |
|
|
|
|
|
|
|
if event.key == pygame.K_ESCAPE: |
|
|
|
running = False |
|
|
|
pygame.quit() |
|
|
|
|
|
|
|
def update(): |
|
|
|
global x, y, width_player, height_player, speed, width, zaehler, height |
|
|
@@ -112,7 +120,6 @@ def draw(): |
|
|
|
|
|
|
|
def init_game(): |
|
|
|
global screen |
|
|
|
pygame.init() |
|
|
|
init() |
|
|
|
initRectangle() |
|
|
|
screen = pygame.display.set_mode(size) |