import pygame.locals as pgl
from naja.constants import INFO_SIZE, EIGHT_BIT_SCALE, MOVE, ACT, KEYS
import pygame.locals as pgl
from naja.constants import INFO_SIZE, EIGHT_BIT_SCALE, MOVE, ACT, KEYS
"""
def __init__(self, pos, state):
super(InfoAreaWidget, self).__init__(pos, INFO_SIZE)
"""
def __init__(self, pos, state):
super(InfoAreaWidget, self).__init__(pos, INFO_SIZE)
def prepare(self):
self.surface = pygame.surface.Surface(INFO_SIZE)
self.surface.fill((0, 0, 0))
def prepare(self):
self.surface = pygame.surface.Surface(INFO_SIZE)
self.surface.fill((0, 0, 0))
# Extract actions and such from the card
title = TextWidget((0, 0), TITLES[self.state.gameboard.player_mode],
colour=(255, 255, 255))
# Extract actions and such from the card
title = TextWidget((0, 0), TITLES[self.state.gameboard.player_mode],
colour=(255, 255, 255))
y_offset = INFO_SIZE[1] - hint.surface.get_rect().height
self.surface.blit(hint.surface, (0, y_offset))
y_offset = INFO_SIZE[1] - hint.surface.get_rect().height
self.surface.blit(hint.surface, (0, y_offset))
def draw(self, surface):
surface.blit(self.surface, self.pos)
def handle_event(self, ev):
def draw(self, surface):
surface.blit(self.surface, self.pos)
def handle_event(self, ev):
if self.state.gameboard.player_mode == MOVE:
return super(InfoAreaWidget, self).handle_event(ev)
if ev.type == pgl.KEYDOWN:
if ev.key in KEYS.SELECT:
if self.state.gameboard.player_mode == MOVE:
return super(InfoAreaWidget, self).handle_event(ev)
if ev.type == pgl.KEYDOWN:
if ev.key in KEYS.SELECT:
- return True
- action.perform_action(self.state.gameboard, self.card)
- self.state.gameboard.change_mode()
- InvalidateTheWorld.post()
- return True
+ else:
+ action.perform_action(self.state.gameboard, self.card)
+ self.state.gameboard.replace_card(player.position)
+ self.state.gameboard.change_mode()
+ return finish_event()