Pac-Man.pos, target_pos, clyde_target = random_tiles
while game == in_play:
case player of:
Pac-Man: if ghost.distance <= 5:
move 1 tile away from ghost
else:
move 1 tile toward target_pos
Blinky: move 1 tile toward Pac-Man.pos
Inky: move 1 tile toward (Pac-Man.pos + 4) // 4 tiles in front of Pac-Man
Clyde: if Clyde.pos == clyde_target:
clyde_target = (clyde_target + 1) % 10
else:
move 1 tile toward clyde_target
if Pac-Man.pos == ghost.pos:
game = over // Pac-Man loses
else if Pac-Man.pos == target_pos:
game = over // Pac-Man wins
Click to Expand
Content Rating
Is this a good/useful/informative piece of content to include in the project? Have your say!
You must login before you can post a comment. .