Home > other >  Pygame small plane game installed image background, blocking the small plane image
Pygame small plane game installed image background, blocking the small plane image

Time:09-24

Code is as follows, after setting the background picture, pictures from the small plane, could you tell me what is write wrong, or there is other way to specify the image position
 import pygame 
The from Settings import Settings
From the ship import ship0
The import game_functions as gf

Def run_game () :
Pygame. The init ()
Ai_settings=Settings ()
Screen=pygame. Display. Set_mode (ai_settings. Screen_width, ai_settings screen_height), 0, 32)
The ship=ship0 (screen)
Background=pygame. Image. The load (' images/background. JPG). The convert ()
Pygame. Display. Set_caption (' Alien night ')

While True:
For the event in pygame. Event. The get () :
If the event. The type==pygame. QUIT:
Pygame. Quit ()
Sys. The exit ()

Gf. Check_events ()
Gf. Update_screen (ai_settings, screen, ships)
Screen. Blit (background, (0, 0))
Pygame. Display. The update ()


Run_game ()

CodePudding user response:

Well know the result, it is to join the background color of the background picture later without removing the original Settings, commented out behind the background color, in the setting and gf
  • Related