Hardware Reference
In-Depth Information
elif state == 1:
print 'Start Game!'
state = 0
elif state == 2:
print 'Load Game!'
state = 0
elif state == 3:
print 'Options!'
state = 0
else:
print 'Exit!'
pygame.quit()
sys.exit()
# Quit if the user presses the exit button
if e.type == pygame.QUIT:
pygame.quit()
sys.exit()
# Update the screen
pygame.display.update()
Objective complete - mini debriefing
We have inished tesing the
pygame
module and reviewed a simple menu design example
along with tesing the playing of sounds using the
pygame
module.
Getting started with the Connect
Four game (UI and sound effects)
In this task, we will work on some preliminary tweaks for the Connect Four game. We will take
the example from
New Game Source Code: Four
in a Row
,
http://inventwithpython.
com/blog/2011/06/10/new-game-source-code-four
-in-a-row/
, and make use of
the examples discussed in the previous task, namely, playing sounds and menu design and
add them to the Connect Four Game Python script.
Prepare for lift off
We need the Connect Four game example (four in a row example—
fourinarow.py
) from the