Created the constants.py file. Removed NotValidState.
This commit is contained in:
2
constants.py
Normal file
2
constants.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Debug constant. Set to False to turn off debugging messages.
|
||||||
|
DEBUG = False
|
||||||
4
game.py
4
game.py
@@ -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.
|
||||||
|
|||||||
1
intro.py
1
intro.py
@@ -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):
|
||||||
|
|||||||
@@ -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)
|
|
||||||
Reference in New Issue
Block a user