Hardware Reference
In-Depth Information
Listing 6-9 continued
rightLimit = playWidth+screenOffset-pieMan
position = [screenOffset +pieIncrement*2,pieIncrement+2] ;
# position of the pieman
ghostInitalPos = [ [526,298], [422,298] ]
ghostPos = copy.deepcopy(ghostInitalPos)
ghostRelease = time.time()
gNumber = 0
ghostDirection = [0, 2]
moved = True # see if something is blocked
start = False
powerPlay = False
ppCount = 90
def main():
global position, step, gStep, gIncrement, ghostPos, ;
moved, ghostRelease, pieDirection
global score, ghostDirection, cBackground, hiScore, ;
lives, eaten, gNumber, start, ppCount, powerPlay
while True:
score = 0
eaten = 0
lives = maxLives
pieDirection = 2
setupBackground()
updateLives()
ghostPos = copy.deepcopy(ghostInitalPos) ;
# return ghosts to base
position = [screenOffset +pieIncrement*2, ;
pieIncrement+2] # position of the pieman
drawScreen(position,ghostPos[0],ghostPos[1])
gNumber = 0
ppCount = 90
start = False
pieStartSound.play()
while not start: # wait for a key
checkForEvent()
ghostRelease = time.time()+ 4.0 # time for first ghost
while lives > 0:
checkForEvent()
if ppCount < 80: # sets length of ;
time for power play
if ppCount >70 and ppCount < 75: ;
# flash just before end
Search WWH ::




Custom Search