from pygame import PixelArray, Surface, Color, joystick, version, mixer, draw
from pygame.event import clear, Event
from pygame.image import load, save
-from pygame.transform import flip, scale
-from pygame.mixer import Sound, set_num_channels, get_num_channels
+from pygame.transform import flip, scale, smoothscale
+from pygame.mixer import Sound, set_num_channels, get_num_channels, pause, unpause, stop
+from pygame.key import get_mods
from pygame.locals import *
from lib.pgfw.pgfw.Game import Game
SCALE = 3
CHANNEL_COUNT = 16
- KEYBOARD, GAMEPAD = xrange(2)
+ KEYBOARD, GAMEPAD = range(2)
def __init__(self):
Game.__init__(self)
mixer.init(44100, -16, self.CHANNEL_COUNT, 4096)
self.get_configuration().type_declarations.add("bool", "mouse", "resets")
+ self.get_configuration().type_declarations.add("bool", "display", "slides-enabled")
self.sound_effects = SoundEffects(self)
self.glyphs = Glyphs(self)
self.editor = Editor(self)
self.title = Title(self)
self.introduction = Introduction(self)
self.ending = Ending(self)
+ self.slides = Slides(self)
self.subscribe(self.respond)
self.subscribe(self.respond, MOUSEBUTTONDOWN)
self.reset()
if self.check_command_line("-wallpaper"):
self.write_wallpaper()
+ def are_slides_enabled(self):
+ return self.check_command_line("-slides") or self.get_configuration("display", "slides-enabled")
+
def write_wallpaper(self):
index = argv.index("--wallpaper")
- width, height = map(int, argv[index + 1:index + 3])
+ # width, height = map(int, argv[index + 1:index + 3])
+ width, height = [int(size) for size in argv[index + 1:index + 3]]
wallpaper = ScrollingBackground(self, size=(width, height))
surface = wallpaper.get_current_frame()
if argv[index + 3] == "-":
from os import unlink
path = mkstemp(".png")[1]
save(surface, path)
- print path
+ # print path
else:
save(surface, argv[index + 3])
self.delegate.post("quit")
(self.get_configuration("mouse", "resets") and event.type == MOUSEBUTTONDOWN and
(1 <= event.button <= 3)):
self.reset()
+ elif self.are_slides_enabled() and self.delegate.compare(event, "slides"):
+ self.slides.toggle()
+ if self.slides.active:
+ if get_mods() & KMOD_LSHIFT:
+ self.slides.increment_index(-1)
+ elif get_mods() & KMOD_RSHIFT:
+ self.slides.increment_index(1)
def reset(self):
self.title.reset()
self.introduction.reset()
self.ending.reset()
self.editor.reset()
+ self.slides.reset()
def get_progress(self):
- return map(int, open(self.get_resource("progress")).read().split())
+ return [int(field) for field in open(self.get_resource("progress")).read().split()]
+ # return map(int, open(self.get_resource("progress")).read().split())
def write_progress(self, level_index, swap_count, update=False):
if update:
return not self.check_command_line("-keyboard") and joystick.get_count()
def update(self):
- if self.editor.active:
+ if not self.slides.active:
self.editor.update()
- else:
self.introduction.update()
self.title.update()
self.levels.update()
self.interface.update()
self.ending.update()
+ else:
+ self.slides.update()
+
+
+class Slides(GameChild):
+
+ ROOT = "local/egw-slides"
+ VIDEOBALL_INDEX = 4
+
+ def __init__(self, parent):
+ GameChild.__init__(self, parent)
+ self.loaded = False
+ self.subscribe(self.respond)
+ self.index = 0
+
+ def activate(self):
+ self.active = True
+ if not self.loaded:
+ self.load()
+ pause()
+ if self.index == self.VIDEOBALL_INDEX:
+ self.play_videoball()
+
+ def deactivate(self):
+ self.active = False
+ self.videoball_audio.stop()
+ unpause()
+
+ def toggle(self):
+ if self.active:
+ self.deactivate()
+ else:
+ self.activate()
+
+ def reset(self):
+ self.active = False
+ if self.loaded:
+ self.videoball_audio.stop()
+
+ def load(self):
+ tile = self.get_game().levels.levels[1].tiles[3]
+ self.background = ScrollingBackground(self, [tile], fill=(255, 0, 0))
+ self.slides = []
+ for ii, path in enumerate(sorted(glob(join(self.ROOT, "*")))):
+ dsr = self.get_display_surface().get_rect()
+ if ii == self.VIDEOBALL_INDEX:
+ slide = Sprite(self)
+ for frame_path in sorted(glob("local/videoball-frames/*.png")):
+ slide.add_frame(load(frame_path).convert())
+ slide.location.center = dsr.center
+ self.slides.append(slide)
+ slide = Sprite(self)
+ original_image = load(path).convert()
+ original_width, original_height = original_image.get_size()
+ if original_width > original_height:
+ size = dsr.w, int(original_height * (float(dsr.w) / original_width))
+ else:
+ size = int(original_width * (float(dsr.h) / original_height)), dsr.h
+ scaled_image = smoothscale(original_image, size)
+ slide.add_frame(scaled_image)
+ slide.location.center = dsr.center
+ self.slides.append(slide)
+ self.videoball_audio = Sound("local/videoball-frames/audio.wav")
+ self.loaded = True
+
+ def respond(self, event):
+ if self.active:
+ delegate = self.get_game().delegate
+ if delegate.compare(event, "right"):
+ self.increment_index(1)
+ elif delegate.compare(event, "left"):
+ self.increment_index(-1)
+
+ def increment_index(self, increment):
+ self.index = (self.index + increment) % len(self.slides)
+ if self.index == self.VIDEOBALL_INDEX:
+ self.play_videoball()
+ else:
+ self.videoball_audio.stop()
+
+ def play_videoball(self):
+ self.slides[self.index].get_current_frameset().reset()
+ self.videoball_audio.stop()
+ self.videoball_audio.play()
+
+ def update(self):
+ if self.active:
+ self.background.update()
+ slide = self.slides[self.index]
+ if self.index == self.VIDEOBALL_INDEX:
+ frameset = slide.get_current_frameset()
+ if frameset.current_index == len(frameset.order) - 1:
+ self.play_videoball()
+ slide.update()
class Editor(GameChild):
self.subscribe(self.respond)
self.levels = []
self.painting = []
- for _ in xrange(self.TILE_SIZE):
+ for _ in range(self.TILE_SIZE):
self.painting.append([0] * self.TILE_SIZE)
+ self.loaded = False
+ self.mixer_color = MixableColor()
+ self.added_colors = []
+
+ def reset(self):
self.at_level_select = True
self.at_view = False
self.at_tile_bar = False
self.palette_index = 0
self.tile_load_index = 0
self.mixer_index = 0
- self.loaded = False
+ self.tile_menu_index = 0
self.menu_hidden = False
self.paint_pressed = False
- self.tile_menu_index = 0
- self.mixer_color = MixableColor()
- self.added_colors = []
-
- def reset(self):
+ self.box = FlashingCursor(self, *([self.get_level_tile_size()] * 2))
self.deactivate()
def activate(self):
if not self.loaded:
self.load()
self.paint_pressed = False
+ self.set_level_title()
def load(self):
self.read_levels()
self.palette_cursor = self.get_cursor()
self.mixer_cursor = self.get_cursor(300, 100)
self.mixer_cursor.location.center = dsr.center
- self.box_cursor = self.get_cursor()
self.tile_menu_cursor = self.get_label(self.TILE_MENU_CURSOR)
self.tile_menu_cursor.location.top = self.tile_menu_background.location.top
new_tile = self.new_tile = Surface([self.TILE_SIZE] * 2)
new_tile.fill((255, 255, 255))
- for x in xrange(new_tile.get_width()):
- for y in xrange(new_tile.get_height()):
+ for x in range(new_tile.get_width()):
+ for y in range(new_tile.get_height()):
if 3 <= x <= 4 and y != 0 and y != 7:
new_tile.set_at((x, y), (0, 0, 0))
elif 3 <= y <= 4 and x != 0 and x != 7:
new_tile.set_at((x, y), (0, 0, 0))
self.build_default_palette()
- self.box = FlashingCursor(self, *([self.get_level_tile_size()] * 2))
self.tile_load_background = Sprite(self)
surface = Surface(dsr.inflate(self.TILE_LOAD_MENU_SHRINK).size)
surface.fill((0, 0, 0))
self.loaded = True
self.current_level_is_default = False
self.level_index = len(self.levels) - 1
- self.set_level_title()
- for level in self.levels:
- print "path:", level.path
+ # for level in self.levels:
+ # print "path:", level.path
def draw_tile_database(self):
padding = self.TILE_LOAD_MENU_PADDING
# preview.update()
def get_tile_load_row_count(self):
- return (self.tile_load_background.location.w - self.TILE_LOAD_MENU_PADDING * 2) / \
- (self.get_level_tile_size() + self.TILE_LOAD_MENU_MARGIN)
+ return int((self.tile_load_background.location.w - self.TILE_LOAD_MENU_PADDING * 2) / \
+ (self.get_level_tile_size() + self.TILE_LOAD_MENU_MARGIN))
def get_tile_load_cursor_step(self):
return self.get_level_tile_size() + self.TILE_LOAD_MENU_MARGIN
def build_default_palette(self):
self.default_palette = [Color(255, 255, 255), Color(0, 0, 0)]
- for hue in xrange(0, 360 - 45, 45):
- for lightness in xrange(25, 100, 25):
+ for hue in range(0, 360 - 45, 45):
+ for lightness in range(25, 100, 25):
color = Color(0, 0, 0)
color.hsla = hue, 100, lightness, 100
self.default_palette.append(color)
level = Level(self)
if level.load(Level.LOAD_GRID_FILE, path):
levels.append(level)
- else:
- print "Failed to load level %s" % path
+ # else:
+ # print "Failed to load level %s" % path
self.add_default_level()
def add_default_level(self):
self.get_game().interface.reset()
def respond(self, event):
- if self.active:
+ if self.active and not self.get_game().slides.active:
compare = self.get_delegate().compare
dx, dy = 0, 0
if compare(event, "action"):
self.at_test = False
self.at_view = True
self.get_current_level().set_swap_status()
+ self.get_game().interface.deactivate()
if compare(event, "right"):
if self.at_level_select:
self.level_index += 1
self.tile_index = 0
if self.at_tile_menu:
self.tile_menu_index += 1
- if self.tile_menu_index > 2 or (self.add_tile_selected() and self.tile_menu_index > 1):
+ if self.tile_menu_index > 1:
+ if len(self.get_current_level().tiles) == 1 or self.add_tile_selected():
+ self.tile_menu_index = 0
+ if self.tile_menu_index > 2:
self.tile_menu_index = 0
if self.at_tile_edit or self.at_box:
dx = 1
if self.at_tile_menu:
self.tile_menu_index -= 1
if self.tile_menu_index < 0:
- if self.add_tile_selected():
+ if self.add_tile_selected() or len(self.get_current_level().tiles) == 1:
self.tile_menu_index = 1
else:
self.tile_menu_index = 2
level = self.get_current_level()
level.tiles.pop(index)
level.original_tiles.pop(index)
- for ii in xrange(len(level.grid)):
- for jj in xrange(len(level.grid[ii])):
+ for ii in range(len(level.grid)):
+ for jj in range(len(level.grid[ii])):
if level.grid[ii][jj] == index:
level.grid[ii][jj] = 0
elif level.grid[ii][jj] > index:
def stamp(self):
size = self.get_level_tile_size()
- x = self.box.location.left / size
- y = self.box.location.top / size
- w = self.box.location.w / size
- h = self.box.location.h / size
- for xi in xrange(x, x + w):
- for yi in xrange(y, y + h):
+ x = int(self.box.location.left / size)
+ y = int(self.box.location.top / size)
+ w = int(self.box.location.w / size)
+ h = int(self.box.location.h / size)
+ for xi in range(x, x + w):
+ for yi in range(y, y + h):
self.get_current_level().grid[xi][yi] = self.tile_index
self.box.location.topleft = [size * coordinate for coordinate in self.box_corner]
level = self.get_current_level()
break
index -= 1
level_file = open(join(level.path, self.get_configuration("editor", "level-file-name")), "w")
- for jj in xrange(len(grid[0])):
- for ii in xrange(len(grid)):
+ for jj in range(len(grid[0])):
+ for ii in range(len(grid)):
level_file.write(str(hex(grid[ii][jj]))[-1])
level_file.write("\n")
for ii, tile in enumerate(level.original_tiles):
def wrap_palette_index(self):
count = self.get_palette_cell_count()
- if count % 2 and self.palette_index == count / 2:
+ if count % 2 and self.palette_index == int(count / 2):
self.palette_index = count - 1
else:
self.palette_index += [-1, 1][self.palette_index_is_at_left()] * \
- (count / 2 + count % 2)
+ (int(count / 2) + count % 2)
def get_palette_cell_count(self):
return len(self.get_full_palette()) + 1
def palette_index_is_at_left(self):
length = self.get_palette_cell_count()
- return self.palette_index < length / 2 + length % 2
+ return self.palette_index < int(length / 2) + length % 2
def move_brush_position(self, dx, dy):
self.brush_position.move(dx, dy)
palette_right_rect = Rect(0, 0, self.PALETTE_WIDTH, palette_right_height)
palette_right_rect.midleft = rect.right + 30, rect.centery
y = palette_left_rect.top
- for ii in xrange(length):
+ for ii in range(length):
if ii < length / 2 + length % 2:
palette_rect = palette_left_rect
h = color_left_height
if ii < length - 1:
ds.fill(palette[ii], (palette_rect.left, y, palette_rect.w, h))
else:
- for x in xrange(palette_rect.w):
+ for x in range(palette_rect.w):
hue = int(float(x) / palette_rect.w * 360)
color = Color(0, 0, 0)
color.hsla = hue, 100, 50, 100
self.label_switch_tile.location.top = self.label_back_box.location.bottom + 10
surface = Surface(self.box.location.size)
tile = self.get_current_level().tiles[self.tile_index]
- for x in xrange(0, surface.get_width(), self.get_level_tile_size()):
- for y in xrange(0, surface.get_height(), self.get_level_tile_size()):
+ for x in range(0, surface.get_width(), self.get_level_tile_size()):
+ for y in range(0, surface.get_height(), self.get_level_tile_size()):
surface.blit(tile, (x, y))
surface.set_alpha(self.BOX_PREVIEW_ALPHA)
ds.blit(surface, self.box.location.topleft)
colors = []
if not self.add_tile_selected():
tile = self.get_current_tile()
- for x in xrange(0, tile.get_width()):
- for y in xrange(0, tile.get_height()):
+ for x in range(0, tile.get_width()):
+ for y in range(0, tile.get_height()):
color = tile.get_at((x, y))
if color not in colors and color not in self.default_palette and color not in self.added_colors:
colors.append(color)
channel = Sound.play(self, loops, maxtime, fade_ms)
if x is not None:
position = float(x) / self.display_surface.get_width()
- if position is not None and channel is not None:
+ if position is not None and channel is not None:
channel.set_volume(*self.get_panning(position))
return channel
sheet.set_colorkey(sheet.get_at((0, 0)))
original = self.original_tiles = []
tiles = self.tiles = []
- for y in xrange(0, sheet.get_height(), self.TILE_SIZE):
+ for y in range(0, sheet.get_height(), self.TILE_SIZE):
surface = Surface([self.TILE_SIZE] * 2)
surface.set_colorkey(self.TRANSPARENT_COLOR)
surface.fill(self.TRANSPARENT_COLOR)
surface.fill(key)
else:
surface.fill(background)
- for ii, x in enumerate(xrange(0, surface.get_width(), tw + spacing)):
+ for ii, x in enumerate(range(0, surface.get_width(), tw + spacing)):
surface.blit(tiles[ii], (x, 0))
return surface
self.default_tile_index = int(fields[0])
else:
for field in fields:
- digits = map(int, field.split())
+ digits = [int(member) for member in field.split()]
+ # digits = map(int, field.split())
if len(digits) == 1:
index = digits[0]
elif len(digits) == 3:
else:
if len(digits) == 2:
digits *= 2
- for x in xrange(digits[0], digits[2] + 1):
- for y in xrange(digits[1], digits[3] + 1):
+ for x in range(digits[0], digits[2] + 1):
+ for y in range(digits[1], digits[3] + 1):
self.grid[x][y] = index
for x, row in enumerate(self.grid):
for y, value in enumerate(row):
dsr = ds.get_rect()
scene_plate.location.center = dsr.centerx, dsr.centery - self.TITLE_OFFSET
border_tiles = self.border_tiles = []
- for ii in xrange(self.TITLE_BORDER_SIZE[0] * 2 + self.TITLE_BORDER_SIZE[1] * 2 - 4):
+ for ii in range(self.TITLE_BORDER_SIZE[0] * 2 + self.TITLE_BORDER_SIZE[1] * 2 - 4):
border_tiles.append(self.tiles[ii % len(self.tiles)])
path = glob(join(self.get_resource("aud/level"), basename(directory) + "*"))[0]
self.full_audio = Sound(path)
def set_entire_grid(self, index=None):
self.grid = []
ds = self.get_display_surface()
- for x in xrange(ds.get_width() / self.tiles[0].get_width()):
+ for x in range(int(ds.get_width() / self.tiles[0].get_width())):
self.grid.append([index] *
- (ds.get_height() / self.tiles[0].get_height()))
+ (int(ds.get_height() / self.tiles[0].get_height())))
def load_grid_file(self, directory):
for path in sorted(glob(join(directory, "*.png"))):
else:
default = Surface([Editor.TILE_SIZE] * 2)
default.fill((255, 255, 255))
- for y in xrange(default.get_height()):
- for x in xrange([1, 2, 2, 2, 2, 2, 7, 8][y]):
+ for y in range(default.get_height()):
+ for x in range([1, 2, 2, 2, 2, 2, 7, 8][y]):
default.set_at((x, y), (200, 200, 200))
self.add_tile(default)
self.set_entire_grid(0)
preview = self.preview = Surface(
(tw * len(self.grid) * self.PREVIEW_SCALE,
th * len(self.grid[0]) * self.PREVIEW_SCALE))
- for grid_x, surface_x in enumerate(xrange(0, preview.get_width(),
+ for grid_x, surface_x in enumerate(range(0, preview.get_width(),
tw * self.PREVIEW_SCALE)):
- for grid_y, surface_y in enumerate(xrange(0, preview.get_height(),
+ for grid_y, surface_y in enumerate(range(0, preview.get_height(),
th * self.PREVIEW_SCALE)):
scaled = scale(self.original_tiles[self.grid[grid_x][grid_y]],
[tw * self.PREVIEW_SCALE] * 2)
def respond(self, event):
if self.parent.active and self.parent.current_level == self and self.at_title and \
- self.get_game().delegate.compare(event, "advance") and not self.get_game().editor.active:
+ self.get_game().delegate.compare(event, "advance") and not self.get_game().slides.active:
self.close_title()
def close_title(self):
self.full_audio.stop()
def is_solved(self):
- return all(index == position for index, position in self.swap_status.iteritems())
+ return all(index == position for index, position in self.swap_status.items())
def get_remaining_swap_count(self):
off = 0
- for index, position in self.swap_status.iteritems():
+ for index, position in self.swap_status.items():
off += index != position
return off / 2 + (off % 2)
br.center = ds.get_rect().center
index = self.title_border_offset % len(self.border_tiles)
y = br.top
- for x in xrange(br.left, br.right, tr.w):
+ for x in range(br.left, br.right, tr.w):
ds.blit(self.border_tiles[index % len(self.border_tiles)], (x, y))
index += 1
- for y in xrange(br.top + tr.h, br.bottom, tr.h):
+ for y in range(br.top + tr.h, br.bottom, tr.h):
ds.blit(self.border_tiles[index % len(self.border_tiles)], (x, y))
index += 1
- for x in xrange(br.right - tr.w * 2, br.left - tr.w, -tr.w):
+ for x in range(br.right - tr.w * 2, br.left - tr.w, -tr.w):
ds.blit(self.border_tiles[index % len(self.border_tiles)], (x, y))
index += 1
- for y in xrange(br.bottom - tr.h * 2, br.top, -tr.h):
+ for y in range(br.bottom - tr.h * 2, br.top, -tr.h):
ds.blit(self.border_tiles[index % len(self.border_tiles)], (x, y))
index += 1
self.scene_plate.update()
if self.title_elapsed >= self.TITLE_LENGTH:
self.close_title()
else:
- for grid_x, screen_x in enumerate(xrange(0, ds.get_width(),
+ for grid_x, screen_x in enumerate(range(0, ds.get_width(),
self.tiles[0].get_width())):
- for grid_y, screen_y in enumerate(xrange(0, ds.get_height(),
+ for grid_y, screen_y in enumerate(range(0, ds.get_height(),
self.tiles[0].get_height())):
tile_index = self.grid[grid_x][grid_y]
swap_index = self.swap_status[tile_index]
self.OPEN_TEXT_OFFSET
self.cell_frames = cell_frames = []
tile_size = glyphs.get_tile(0).get_width()
- for ii in xrange(self.MAX_TILE_COUNT):
+ for ii in range(self.MAX_TILE_COUNT):
title = ("%02x%s" % (ii, self.NAME_CHARACTER)).upper()
title_surface = glyphs.get_surface_from_text(title, self.TEXT_COLOR)
frame = Surface((self.CELL_INDENT * 2 + title_surface.get_width() + \
return 0 < self.get_level().get_remaining_swap_count() <= self.COUNTDOWN_THRESHOLD
def respond(self, event, suppress_sound=False):
- if self.active and not self.suppressing_commands and \
- (not self.get_game().editor.active or self.get_game().editor.at_test):
+ if self.active and not self.suppressing_commands and not self.get_game().slides.active:
delegate = self.get_game().delegate
effects = self.get_game().sound_effects
is_pad_mode = self.get_game().is_gamepad_mode()
if not suppress_sound:
effects.play("menu-move")
cell_count = self.get_cell_count()
- bp = (cell_count - 1) / 2
+ bp = int((cell_count - 1) / 2)
if delegate.compare(event, "up"):
self.cell_index -= 1
if self.cell_index == -1:
self.activate()
self.close()
cell_count = self.get_cell_count()
- left_count = cell_count / 2 + cell_count % 2
- right_count = cell_count / 2
+ left_count = int(cell_count / 2 + cell_count % 2)
+ right_count = int(cell_count / 2)
sw, sh = self.display_surface.get_size()
- step = sh / (left_count + 1)
+ step = int(sh / (left_count + 1))
frames = self.cell_frames
index = 0
- for y in xrange(step, step * (left_count + 1), step):
+ for y in range(step, step * (left_count + 1), step):
frames[index].location.midleft = 0, y
index += 1
- step = sh / (right_count + 1)
- for y in xrange(step, step * (right_count + 1), step):
+ step = int(sh / (right_count + 1))
+ for y in range(step, step * (right_count + 1), step):
frames[index].location.midright = sw, y
index += 1
self.cell_index = 0
self.option_texts = option_texts
def respond(self, event):
- if self.active and not self.get_game().editor.active:
+ if self.active and not self.get_game().slides.active:
delegate = self.get_game().delegate
if not self.advance_pressed:
if delegate.compare(event, "advance") or not self.get_game().is_gamepad_mode() and \
self.indicator.update()
if random() < self.CHUNK_PROBABILITY and \
get_busy_channel_count() < get_num_channels() - 5:
- for _ in xrange(randint(1, 4)):
+ for _ in range(randint(1, 4)):
chunk = choice(self.audio_chunks)
channel = chunk.play()
if channel is not None and not isinstance(channel, tuple):
count=1, framerate=None):
Sprite.__init__(self, parent, framerate)
frames = []
- for _ in xrange(count):
+ for _ in range(count):
frames.append(Surface((size[0], size[1])))
frames[-1].fill(fill)
if tiles is None:
fw, fh = frames[0].get_size()
ox = -(tw - (fw % tw)) / 2 if fw % tw else 0
oy = -(tw - (fh % tw)) / 2 if fh % tw else 0
- for x in xrange(ox, fw - ox, tw):
- for y in xrange(oy, fh - oy, tw):
+ for x in range(ox, fw - ox, tw):
+ for y in range(oy, fh - oy, tw):
for frame in frames:
tile = choice(tiles)
if random() >= .5:
self.play(self.blink)
def respond(self, event):
- if self.active and not self.get_game().editor.active:
+ if self.active and not self.get_game().slides.active:
if self.get_game().delegate.compare(event, "action"):
self.block_index += 1
self.current_panel_index += 1
self.register(self.unsuppress_advance)
def respond(self, event):
- if self.active and not self.suppress_commands and not self.get_game().editor.active and \
+ if self.active and not self.suppress_commands and not self.get_game().slides.active and \
((self.get_game().is_gamepad_mode() and self.get_game().delegate.compare(event, "advance")) or \
(not self.get_game().is_gamepad_mode() and self.get_game().delegate.compare(event, "action"))):
self.deactivate()
tw = glyphs.get_tile(0).get_width()
ds = self.get_display_surface()
frame = Surface(ds.get_size())
- for xi, x in enumerate(xrange(0, ds.get_width(), tw)):
- for yi, y in enumerate(xrange(0, ds.get_height(), tw)):
+ for xi, x in enumerate(range(0, ds.get_width(), tw)):
+ for yi, y in enumerate(range(0, ds.get_height(), tw)):
background_color = Color(0, 0, 0)
background_color.hsla = randrange(0, 360), 100, 50, 100
foreground_color = Color(0, 0, 0)