Changed background color.

This commit is contained in:
2013-01-09 21:22:33 -04:30
parent 1e635f3d10
commit 453584c7f6

View File

@@ -11,33 +11,35 @@ except ImportError:
from state import BaseState, VALID_STATES from state import BaseState, VALID_STATES
class IntroState(BaseState): class IntroState(BaseState):
def __init__(self): def __init__(self):
self.count = 0 self.count = 0
screen_center = self.get_screen_center() screen_center = self.get_screen_center()
self.rectangle = pygame.Rect(screen_center[0] - 50, screen_center[1] - 50, 100, 100) self.rectangle = pygame.Rect(screen_center[0] - 50, screen_center[1] - 50, 100, 100)
self.next_transition = VALID_STATES['STAY'] self.next_transition = VALID_STATES['STAY']
self.background_color = (139, 210, 228)
def input(self): def input(self):
for event in pygame.event.get(): for event in pygame.event.get():
if android: if android:
if android.check_pause(): if android.check_pause():
android.wait_for_resume() android.wait_for_resume()
if event.type == pygame.KEYDOWN: if event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE: if event.key == pygame.K_ESCAPE:
self.next_transition = VALID_STATES['QUIT'] self.next_transition = VALID_STATES['QUIT']
if event.type == pygame.QUIT: if event.type == pygame.QUIT:
self.next_transition = VALID_STATES['QUIT'] self.next_transition = VALID_STATES['QUIT']
def update(self): def update(self):
if self.next_transition != VALID_STATES['QUIT']: if self.next_transition != VALID_STATES['QUIT']:
if self.count < 120: if self.count < 120:
self.count += 1 self.count += 1
self.next_transition = VALID_STATES['STAY'] self.next_transition = VALID_STATES['STAY']
else: else:
self.count = 0 self.count = 0
self.next_transition = VALID_STATES['MENU'] self.next_transition = VALID_STATES['MENU']
return self.next_transition return self.next_transition
def render(self, canvas): def render(self, canvas):
pygame.draw.rect(canvas, (255, 255, 255), self.rectangle) canvas.fill(self.background_color)
pygame.draw.rect(canvas, (255, 255, 255), self.rectangle)