diff --git a/moss.py b/moss.py index 20ce0af..3a8add8 100644 --- a/moss.py +++ b/moss.py @@ -7,25 +7,27 @@ from sprite_stacking_engine.engine import Engine class Moss: def __init__(self): - self.screen = pygame.display.set_mode((1400, 800)) + self.screen = pygame.display.set_mode((1400, 800)) # screen and clock (pygame) self.clock = pygame.time.Clock() - self.engine = Engine(self) - self.time = 0 - self.delta_time = 0.01 + + self.engine = Engine(self) # initialize the sprite stacking engine + + self.time = 0 # initialize the time (milliseconds since start) + self.delta_time = 0.01 # initialize delta time (time it takes to draw a frame) self.running = True def update(self): - pygame.display.set_caption(f"{self.clock.get_fps(): .1f}") - self.delta_time = self.clock.tick(60) + pygame.display.set_caption(f"{self.clock.get_fps(): .1f}") # set title to fps + self.delta_time = self.clock.tick(60) # get the delta time using pygames's clock module self.engine.update() def draw(self): - self.engine.draw() + self.engine.draw() # draw the stacked sprite objects - self.screen.blit(self.engine.surface, (0, 0)) + self.screen.blit(self.engine.surface, (0, 0)) # draw it onto the real window now - pygame.display.flip() + pygame.display.flip() # update the window def get_time(self): self.time = pygame.time.get_ticks() * 0.001