Home > other >  "Python programming: from entry to practice" chapter 14, 14.1 add Play button, a successfu
"Python programming: from entry to practice" chapter 14, 14.1 add Play button, a successfu

Time:09-28

Followed the examples of "alien game" in the book, all the way to run all normal, in chapter 14, likewise, strictly according to the example in the book add after the play button, run into the game screen interface, excuse me, are also read this book, and also according to the book example test have encountered this problem? If so, how to solve, thank you!

Environment interface is as follows:

CodePudding user response:

I guess click the PLAY button position ~ ~ the game can normal open, visible, drawing the image PYGAME mode and the system does not support the black screen, but that should be how to solve this problem? Under the above problem under the WINDOWS, UBUNTU is present,

CodePudding user response:

Game started waiting to click on the "PLAY" button, is a black screen,
But, the game to start normal again, the figure below:

CodePudding user response:

In chapter 13 13.7 determine which part of the game to run if will determine if stats. Game_active instead if not stats. Game_active, at the same time method in the class ship_hit () method needs to be stats. Game_active to change the value of True, change me is so good

CodePudding user response:

Should be run in 13.7 to determine which parts of the game
While True:
Gf. Check_events (ai_settings, screen, ship, bullets)
If stats. Game_active:
The ship. The update ()
Gf. Update_bullets (ai_settings, screen, ship, aliens, bullets)
Gf. Update_aliens (ai_settings, stats, screen, ship, aliens, bullets)
Print (len (bullets))
Gf. Update_screen (ai_settings, screen, stats, ship, aliens, bullets, play_button)
The else:



Gf. Update_screen (ai_settings, screen, stats, ship, aliens, bullets, play_button)
  • Related