Pygame (Python Game Development) Tutorial - 34 - Start Screen Logic

preview_player
Показать описание
Рекомендации по теме
Комментарии
Автор

I don't use game intro and game engine as functions, I left them as while loops, True/False keys in gk (game keys dictionary):

gk = {"gameExit": True, "gameOver": False, "intro": True}
while gk['intro']:
gameDisplay.fill(white)
screen_message(...)
pygame.display.update()
clock.tick(15)
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_c:
gk['gameExit'] = False
gk['intro'] = False
if event.key == pygame.K_q:
pygame.quit()
quit()
while not gk['gameExit']:
while gk['gameOver']:
gameDisplay.fill(white)
screen_message("Game over", red, -50, size="large")
screen_message("Press C to play again or O to quit", black, 50, size="small")
pygame.display.update()

blandon
Автор

Holy shit, I couldn't stop laughing at the viral game thing. You sir, are the best.

hvrc
Автор

i have all these errors anyone help? ;


Traceback (most recent call last):
File "C:\Users\User\Desktop\Mixed Crap\Projects-School\#1\yete.py", line 216, in <module>
game_intro()
File "C:\Users\User\Desktop\Mixed Crap\Projects-School\#1\yete.py", line 91, in game_intro
if event.key==pygame.KEYDOWN:
AttributeError: 'Event' object has no attribute 'key'

mhempire
Автор

I can spot reduction in views and comments from video 1 and this video of this series.
Lazy people

aadityarajbhattarai
Автор

Why did adding the if statements get rid of the lagging issue?

PreludeADream
Автор

There is stiil a problem in the code. While we are at GameOver condtion, we only have to use Q or C options but we can't use pygame.QUIT to close the game by the close button. We must modify a bit of code after the GameOver is True by adding Pyagme.QUIT event and exiting the program by close button . Btw The best Videos of Pygame

rohitkumar-ljru
Автор

Just a question; since there's nothing going on in your start screen, why update the image at all? Why not fill the background and put the messages to screen outside the loop and be done with it?

BearShaver
Автор

ENSLAVE THE PLAYERS TO MY INFINITE SNAKE!!!

EvanSamano