Updated to follow the new new base game
This commit is contained in:
31
__init__.py
31
__init__.py
@ -1,24 +1,24 @@
|
|||||||
import logging
|
import logging
|
||||||
import pygame
|
import pygame
|
||||||
from random import randint
|
from random import randint
|
||||||
#import NoPELib
|
import gameUtils
|
||||||
#import PDOLib
|
|
||||||
|
|
||||||
#Oh god here we go. I'm gonna screw up this entire thing
|
#Oh god here we go. I'm gonna screw up this entire thing
|
||||||
|
|
||||||
class Game:
|
class Game(gameUtils.Game):
|
||||||
def __init__(self, surface, size):
|
def __init__(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Ran when the game starts.
|
Ran when the game starts.
|
||||||
|
|
||||||
Args:
|
You have access to the following variables:
|
||||||
surface (pygame.Surface): The surface you draw to.
|
self.surf (pygame.Surface): This is the surface you draw onto.
|
||||||
size (list[int, int]): The size of the surface.
|
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()
|
self.clock = pygame.time.Clock()
|
||||||
|
|
||||||
# TODO: Add a random delay between the spin and fire
|
# TODO: Add a random delay between the spin and fire
|
||||||
@ -75,7 +75,7 @@ class Game:
|
|||||||
Ran when an event is fired.
|
Ran when an event is fired.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
event (pygame.Event): The event that was fired
|
event (pygame.Event): The event that was fired.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if event.type == pygame.KEYDOWN:
|
if event.type == pygame.KEYDOWN:
|
||||||
@ -88,9 +88,10 @@ class Game:
|
|||||||
elif event.key == pygame.K_SPACE:
|
elif event.key == pygame.K_SPACE:
|
||||||
self.startSpin = True
|
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
|
#gun code WOO
|
||||||
@ -105,8 +106,8 @@ class Game:
|
|||||||
self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds
|
self.shockScale = min(self.shockScale, 1) #keeps shockScale in bounds
|
||||||
|
|
||||||
#screen code
|
#screen code
|
||||||
self.surface.fill("black")
|
self.surf.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.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
|
#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:
|
# TODO:
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
../NoPELib/
|
../NoPELib/
|
||||||
../PDOLib/
|
../PDOLib/
|
||||||
|
../GameUtils/
|
||||||
pygame-ce
|
pygame-ce
|
||||||
Reference in New Issue
Block a user