Fixed FPS ( at 60 )
This commit is contained in:
parent
f14339a6e7
commit
732e5488b9
@ -15,6 +15,8 @@ class Game():
|
||||
pygame.init()
|
||||
pygame.mixer.init()
|
||||
|
||||
self.fps = 60
|
||||
|
||||
font = "gamedata/font.ttf"
|
||||
self.fontfile = pygame.font.Font(font,25)
|
||||
self.fontfilesmall = pygame.font.Font(font,18)
|
||||
@ -125,7 +127,7 @@ class Game():
|
||||
|
||||
def game_loop(self):
|
||||
|
||||
self.dt = time.time()-self.pasttime
|
||||
self.dt = 1/self.fps
|
||||
self.elapsedtime += self.dt
|
||||
self.pasttime = time.time()
|
||||
|
||||
@ -134,7 +136,7 @@ class Game():
|
||||
if self.gameloop: # Si j'ai une boucle de jeu, la lancer
|
||||
self.gameloop.step(self) # La logique de la boucle
|
||||
self.gameloop.draw(self) # L'affichage de la boucle
|
||||
self.clock.tick(120)
|
||||
self.clock.tick(self.fps)
|
||||
if self.scene :
|
||||
self.scene(self)
|
||||
self.scene = False
|
||||
|
Loading…
Reference in New Issue
Block a user