Created the constants.py file. Removed NotValidState.

This commit is contained in:
2013-01-10 17:10:35 -04:30
parent b95d1a8bdf
commit 8d92faa278
4 changed files with 4 additions and 40 deletions

2
constants.py Normal file
View File

@@ -0,0 +1,2 @@
# Debug constant. Set to False to turn off debugging messages.
DEBUG = False

View File

@@ -13,9 +13,7 @@ from menu import MenuState
from ingame import InGameState from ingame import InGameState
from score import ScoreState from score import ScoreState
from notvalidstate import NotValidState from notvalidstate import NotValidState
from constants import DEBUG
# Debug constant. Set to False to turn off debugging messages.
DEBUG = False
# The Game class implements the state machine of the game and # The Game class implements the state machine of the game and
# runs the main game loop. # runs the main game loop.

View File

@@ -14,6 +14,7 @@ from state import BaseState, VALID_STATES
import actor import actor
import game import game
import particle import particle
from constants import DEBUG
class IntroState(BaseState): class IntroState(BaseState):
def __init__(self): def __init__(self):

View File

@@ -1,37 +0,0 @@
# Miguel Angel Astor Romero. Created on 7-1-2013. #
###################################################
import pygame
try:
import android
except ImportError:
android = None
from state import BaseState, VALID_STATES
class NotValidState(BaseState):
def __init__(self):
BaseState.__init__(self)
self.count = 0
screen_center = self.get_screen_center()
self.rectangle = pygame.Rect(screen_center[0] - 50, screen_center[1] - 50, 100, 100)
self.next_transition = VALID_STATES['STAY']
def input(self):
for event in pygame.event.get():
if android:
if android.check_pause():
android.wait_for_resume()
if event.type == pygame.KEYDOWN:
self.next_transition = VALID_STATES['QUIT']
if event.type == pygame.QUIT:
self.next_transition = VALID_STATES['QUIT']
def update(self):
return self.next_transition
def render(self, canvas):
canvas.fill(self.background_color)
pygame.draw.rect(canvas, (0, 0, 0), self.rectangle)