Skip to content

Commit

Permalink
added FPS
Browse files Browse the repository at this point in the history
  • Loading branch information
1024Adam committed Oct 3, 2017
1 parent 129d827 commit a59d2ee
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions infinite_maze/infinite_maze.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pygame
from pygame.locals import *
from pygame.time import *
from Player import Player
from Game import Game
from Line import Line
Expand All @@ -19,6 +20,7 @@ def maze():

while (game.isPlaying()):
while (game.isActive()):
mills = game.getClock().getFullTime()
game.updateScreen(player, lines)

prevKeys = keys
Expand Down Expand Up @@ -112,6 +114,11 @@ def maze():
for event in pygame.event.get():
if (event.type == pygame.QUIT):
game.end()

# Process FPS
processTime = game.getClock().getFullTime() - mills
if (processTime < 16):
delay(16 - processTime)


# Game has ended
Expand Down

0 comments on commit a59d2ee

Please sign in to comment.