Updated to follow the new new base game

This commit is contained in:
2025-06-20 17:34:35 +01:00
parent e78b07dcb9
commit 108f99af5b
2 changed files with 17 additions and 15 deletions

View File

@ -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: