update to Python 3
This commit is contained in:
parent
63cde4321e
commit
617edd50e5
1
config
1
config
|
@ -17,6 +17,7 @@ score-font-path = font/Titan-One.ttf
|
||||||
title-font-path = font/Oxygen.ttf
|
title-font-path = font/Oxygen.ttf
|
||||||
scoreboard-font-path = font/terminus/Terminus.ttf
|
scoreboard-font-path = font/terminus/Terminus.ttf
|
||||||
initials-font = font/terminus/Terminus-Bold.ttf
|
initials-font = font/terminus/Terminus-Bold.ttf
|
||||||
|
show-framerate = yes
|
||||||
|
|
||||||
[mouse]
|
[mouse]
|
||||||
visible = no
|
visible = no
|
||||||
|
|
|
@ -52,8 +52,8 @@ class Title(GameChild):
|
||||||
tile.fill(bg_color)
|
tile.fill(bg_color)
|
||||||
tile.set_at((0, 1), (220, 119, 41))
|
tile.set_at((0, 1), (220, 119, 41))
|
||||||
tile.set_at((1, 0), (220, 119, 41))
|
tile.set_at((1, 0), (220, 119, 41))
|
||||||
for y in xrange(0, surface.get_height(), 2):
|
for y in range(0, surface.get_height(), 2):
|
||||||
for x in xrange(0, surface.get_width(), 2):
|
for x in range(0, surface.get_width(), 2):
|
||||||
surface.blit(tile, (x, y))
|
surface.blit(tile, (x, y))
|
||||||
# font = Font(self.get_resource("display", "title-font-path"), 20)
|
# font = Font(self.get_resource("display", "title-font-path"), 20)
|
||||||
# font.set_italic(True)
|
# font.set_italic(True)
|
||||||
|
@ -69,7 +69,7 @@ class Title(GameChild):
|
||||||
# for ch in text:
|
# for ch in text:
|
||||||
# texts[ii] += ch + " "
|
# texts[ii] += ch + " "
|
||||||
# texts[ii] = texts[ii].strip() + "•" * (5 if ii else 3)
|
# texts[ii] = texts[ii].strip() + "•" * (5 if ii else 3)
|
||||||
# for _ in xrange(25):
|
# for _ in range(25):
|
||||||
# color = choice(colors)
|
# color = choice(colors)
|
||||||
# captions[0].add_frame(font.render(texts[0], True, color, (220, 208, 255)))
|
# captions[0].add_frame(font.render(texts[0], True, color, (220, 208, 255)))
|
||||||
# captions[1].add_frame(font.render(texts[1], True, color, (220, 208, 255)))
|
# captions[1].add_frame(font.render(texts[1], True, color, (220, 208, 255)))
|
||||||
|
@ -230,7 +230,7 @@ class Scoreboard(GameChild):
|
||||||
|
|
||||||
def get_scores(self):
|
def get_scores(self):
|
||||||
scores = []
|
scores = []
|
||||||
for line in file(self.scores_path, "r"):
|
for line in open(self.scores_path, "r"):
|
||||||
fields = line.split()
|
fields = line.split()
|
||||||
scores.append((float(fields[0]), int(fields[1]), fields[2]))
|
scores.append((float(fields[0]), int(fields[1]), fields[2]))
|
||||||
scores = sorted(scores, key=itemgetter(0))
|
scores = sorted(scores, key=itemgetter(0))
|
||||||
|
@ -239,7 +239,7 @@ class Scoreboard(GameChild):
|
||||||
def write(self, initials):
|
def write(self, initials):
|
||||||
score = int(round(self.get_game().triangles.score))
|
score = int(round(self.get_game().triangles.score))
|
||||||
fields = str(time()), str(score), initials
|
fields = str(time()), str(score), initials
|
||||||
file(self.scores_path, "a").write(fields[0] + " " + fields[1] + " " + fields[2] + "\n")
|
open(self.scores_path, "a").write(fields[0] + " " + fields[1] + " " + fields[2] + "\n")
|
||||||
self.most_recent_score = score, initials
|
self.most_recent_score = score, initials
|
||||||
self.load()
|
self.load()
|
||||||
|
|
||||||
|
@ -319,8 +319,8 @@ class Electric(Sprite):
|
||||||
frames = surface, surface.copy()
|
frames = surface, surface.copy()
|
||||||
colors = (255, 255, 0), (100, 89, 213)
|
colors = (255, 255, 0), (100, 89, 213)
|
||||||
pixel_arrays = PixelArray(frames[0]), PixelArray(frames[1])
|
pixel_arrays = PixelArray(frames[0]), PixelArray(frames[1])
|
||||||
for x in xrange(len(pixel_arrays[0])):
|
for x in range(len(pixel_arrays[0])):
|
||||||
for y in xrange( len(pixel_arrays[0][0])):
|
for y in range( len(pixel_arrays[0][0])):
|
||||||
pixel_arrays[0][x][y] = colors[(y + x) % 2]
|
pixel_arrays[0][x][y] = colors[(y + x) % 2]
|
||||||
pixel_arrays[1][x][y] = colors[(y + x + 1) % 2]
|
pixel_arrays[1][x][y] = colors[(y + x + 1) % 2]
|
||||||
for pixels in pixel_arrays:
|
for pixels in pixel_arrays:
|
||||||
|
@ -500,23 +500,23 @@ class Static(Sprite):
|
||||||
surface = Surface(self.get_display_surface().get_size())
|
surface = Surface(self.get_display_surface().get_size())
|
||||||
frames = surface, surface.copy(), surface.copy(), surface.copy()
|
frames = surface, surface.copy(), surface.copy(), surface.copy()
|
||||||
tiles = []
|
tiles = []
|
||||||
for _ in xrange(32):
|
for _ in range(32):
|
||||||
tiles.append(Surface((16, 16)))
|
tiles.append(Surface((16, 16)))
|
||||||
pixel_arrays = []
|
pixel_arrays = []
|
||||||
for tile in tiles:
|
for tile in tiles:
|
||||||
pixel_arrays.append(PixelArray(tile))
|
pixel_arrays.append(PixelArray(tile))
|
||||||
colors = (0, 0, 0), (64, 64, 64), (128, 128, 128), (196, 196, 196), \
|
colors = (0, 0, 0), (64, 64, 64), (128, 128, 128), (196, 196, 196), \
|
||||||
(255, 255, 255)
|
(255, 255, 255)
|
||||||
for x in xrange(len(pixel_arrays[0])):
|
for x in range(len(pixel_arrays[0])):
|
||||||
for y in xrange(len(pixel_arrays[0][0])):
|
for y in range(len(pixel_arrays[0][0])):
|
||||||
for pixels in pixel_arrays:
|
for pixels in pixel_arrays:
|
||||||
pixels[x][y] = choice(colors)
|
pixels[x][y] = choice(colors)
|
||||||
for pixels in pixel_arrays:
|
for pixels in pixel_arrays:
|
||||||
del pixels
|
del pixels
|
||||||
del pixel_arrays
|
del pixel_arrays
|
||||||
for frame in frames:
|
for frame in frames:
|
||||||
for y in xrange(0, frame.get_height(), tiles[0].get_height()):
|
for y in range(0, frame.get_height(), tiles[0].get_height()):
|
||||||
for x in xrange(0, frame.get_width(), tiles[0].get_width()):
|
for x in range(0, frame.get_width(), tiles[0].get_width()):
|
||||||
frame.blit(choice(tiles), (x, y))
|
frame.blit(choice(tiles), (x, y))
|
||||||
self.add_frame(frame)
|
self.add_frame(frame)
|
||||||
|
|
||||||
|
@ -626,7 +626,7 @@ class Initials(GameChild):
|
||||||
if ord(letter) == 91 or ord(letter) == 64:
|
if ord(letter) == 91 or ord(letter) == 64:
|
||||||
letter = '-'
|
letter = '-'
|
||||||
replacement = ""
|
replacement = ""
|
||||||
for ii in xrange(len(self.text)):
|
for ii in range(len(self.text)):
|
||||||
if ii == self.index:
|
if ii == self.index:
|
||||||
replacement += letter
|
replacement += letter
|
||||||
else:
|
else:
|
||||||
|
@ -683,11 +683,11 @@ class Total(Sprite):
|
||||||
tr = template.get_rect()
|
tr = template.get_rect()
|
||||||
template.fill((255, 0, 0), (0, 20, tr.w, 1))
|
template.fill((255, 0, 0), (0, 20, tr.w, 1))
|
||||||
template.fill((255, 128, 128), (0, 21, tr.w, 1))
|
template.fill((255, 128, 128), (0, 21, tr.w, 1))
|
||||||
for y in xrange(22, 78, 2):
|
for y in range(22, 78, 2):
|
||||||
template.fill((255, 255, 255), (0, y, tr.w, 1))
|
template.fill((255, 255, 255), (0, y, tr.w, 1))
|
||||||
template.fill((255, 128, 128), (0, 78, tr.w, 1))
|
template.fill((255, 128, 128), (0, 78, tr.w, 1))
|
||||||
template.fill((255, 0, 0), (0, 79, tr.w, 1))
|
template.fill((255, 0, 0), (0, 79, tr.w, 1))
|
||||||
for _ in xrange(20):
|
for _ in range(20):
|
||||||
# surface = template.copy()
|
# surface = template.copy()
|
||||||
surface = Surface(template.get_size(), SRCALPHA)
|
surface = Surface(template.get_size(), SRCALPHA)
|
||||||
# polygon(surface, choice(colors), ((tr.centerx - 7, 19),
|
# polygon(surface, choice(colors), ((tr.centerx - 7, 19),
|
||||||
|
|
2
lib/pgfw
2
lib/pgfw
|
@ -1 +1 @@
|
||||||
Subproject commit 499d722189559a777efe7761e9bea30e8fb904d6
|
Subproject commit 314b722528a65e6f0053f8be1844c2d8818319f4
|
|
@ -119,3 +119,4 @@
|
||||||
1523576335.0 34 ---
|
1523576335.0 34 ---
|
||||||
1529983381.92 171 BUG
|
1529983381.92 171 BUG
|
||||||
1586137469.11 247 NUT
|
1586137469.11 247 NUT
|
||||||
|
1669926143.6577697 5 ---
|
||||||
|
|
Loading…
Reference in New Issue