"""
import pygame.locals as pgl
-from naja.constants import BOARD_SIZE, TILE_SIZE, KEYS, ACT
+from naja.constants import BOARD_SIZE, TILE_SIZE, KEYS, ACT, FPS
from naja.events import finish_event
from naja.sound import sound
from naja.widgets.base import Widget
from naja.widgets.tile import TileWidget
+from naja.utils import Flashlight
class BoardWidget(Widget):
self.card_pos = state.player.position
self._tiles = []
self.legal = False
+ self.flash_light = Flashlight(FPS // 2)
for y in range(0, 5):
for x in range(0, 5):
tile_pos = (pos[0] + x * TILE_SIZE[0],
def prepare(self):
for tile in self._tiles:
- tile.set_highlight(self.card_pos)
+ tile.set_highlight(self.card_pos, self.flash_light.on)
tile.prepare()
self.size = BOARD_SIZE
if self.state.gameboard.player_mode == ACT:
self.card_pos = self.state.player.position
def draw(self, surface):
+ if self.flash_light.tick():
+ self.prepare()
for tile in self._tiles:
tile.draw(surface)
self.current_card = None
self.board_pos = board_pos
self.highlighted = False
+ self.bright = False
self.animation = TILE_SIZE[0]
def prepare(self):
overlays.append(resources.get_image(
tile_available_name, transforms=(EIGHT_BIT,)))
if self.highlighted:
+ if self.bright:
+ select_name = 'board/tile_selected_pulse.png'
+ else:
+ select_name = 'board/tile_selected.png'
overlays.append(resources.get_image(
- 'board/tile_selected.png',
- transforms=(EIGHT_BIT,)))
-
+ select_name, transforms=(EIGHT_BIT,)))
self.surface = pygame.surface.Surface(TILE_SIZE)
self.surface.blit(bg, (0, 0))
for overlay in overlays:
x_offset += img.get_width()
return y_offset + LOCK_HEIGHT
- def set_highlight(self, pos):
+ def set_highlight(self, pos, bright=False):
self.highlighted = False
+ self.bright = bright
if (self.state.gameboard.player_mode == EXAMINE and
self.board_pos == pos):
self.highlighted = True