diff --git a/__init__.py b/__init__.py index e6aed0a..36fcfa7 100644 --- a/__init__.py +++ b/__init__.py @@ -1,24 +1,24 @@ import logging import pygame from random import randint -#import NoPELib -#import PDOLib +import gameUtils #Oh god here we go. I'm gonna screw up this entire thing -class Game: - def __init__(self, surface, size): +class Game(gameUtils.Game): + def __init__(self, *args, **kwargs): """ Ran when the game starts. - Args: - surface (pygame.Surface): The surface you draw to. - size (list[int, int]): The size of the surface. + You have access to the following variables: + self.surf (pygame.Surface): This is the surface you draw onto. + self.pm (NoPELib.PlayerManager): This is where your players are stored. + self.cfg (dict): Everything from the `game.toml` file. You can access it like this: self.details['title'] """ + + # Don't remove this. It does important things. :3 + super().__init__(*args, **kwargs) - pygame.init() - self.surface = surface - self.size = size self.clock = pygame.time.Clock() # TODO: Add a random delay between the spin and fire @@ -75,7 +75,7 @@ class Game: Ran when an event is fired. Args: - event (pygame.Event): The event that was fired + event (pygame.Event): The event that was fired. """ if event.type == pygame.KEYDOWN: @@ -88,9 +88,10 @@ class Game: elif event.key == pygame.K_SPACE: self.startSpin = True - def draw(self): + def update(self): """ - Ran once per frame, put your drawing code in here + Ran once per frame, put your drawing code and any + game logic that should be ran once per frame in here. """ #gun code WOO @@ -105,8 +106,8 @@ class Game: self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds #screen code - self.surface.fill("black") - self.surface.blit(pygame.transform.scale_by(self.gun[self.spinInc][0],self.gunScale),(self.gunMidx,self.gunMidy))#draw the gun + self.surf.fill("black") + self.surf.blit(pygame.transform.scale_by(self.gun[self.spinInc][0],self.gunScale),(self.gunMidx,self.gunMidy))#draw the gun #screen.blit(pygame.transform.scale_by(MainSurface,1),(0,yOffset))#renders the main surface to the screen, while also scaling it for the required display resolution # TODO: diff --git a/requirements.txt b/requirements.txt index 31785e7..a9fafa9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ ../NoPELib/ ../PDOLib/ +../GameUtils/ pygame-ce \ No newline at end of file