Jump to content
Unity Insider Forum

oskar

Newbie
  • Posts

    1
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

oskar's Achievements

Newbie

Newbie (1/3)

0

Reputation

  1. oskar

    Flugzeug spiel

    import pygame import sys # Initialisierung von Pygame pygame.init() # Bildschirmgröße screen_width = 800 screen_height = 600 # Farben black = (0, 0, 0) white = (255, 255, 255) # Erstellen des Bildschirms screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption("Flugzeugspiel") # Spieler Flugzeug player_img = pygame.image.load('player.png') player_x = 370 player_y = 480 def player(x, y): screen.blit(player_img, (x, y)) # Spiel Schleife running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False # Bewegung des Spielers keys = pygame.key.get_pressed() if keys[pygame.K_LEFT]: player_x -= 5 if keys[pygame.K_RIGHT]: player_x += 5 # Hintergrundfarbe setzen screen.fill(black) # Spieler zeichnen player(player_x, player_y) # Bildschirm aktualisieren pygame.display.update() # Pygame beenden und das Programm schließen pygame.quit() sys.exit()
×
×
  • Create New...