commit fcc26c91d8eb70727ba785d8473497633cdaef76
parent ef6b7541c0b544dc2335e17a6bfa9475a8689b29
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Wed, 26 Aug 2020 18:53:29 -0500
slightly improved placement of image conversion
Diffstat:
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/game.py b/src/game.py
@@ -1,6 +1,5 @@
import pygame
-from . import interface, vgo
-from .images import SHEETS
+from . import interface, vgo, images
from .constants import SCREEN_WIDTH, SCREEN_HEIGHT, FRAMERATE, COLORKEY
class Game(object):
@@ -15,15 +14,11 @@ class Game(object):
# Subsystems
self.interface = interface.Interface(self)
+ # External calls as needed
+ images.convert_sheets(images.SHEETS)
+
#TESTING
- self.testvgo = vgo.Entity(SHEETS["jisella_1"].sprites[(0, 0)], (100, 100))
- # This should go somewhere in the images.py file, or somewhere that
- # sheets will live permanently, but the display has to be initialized
- # before we can convert.
- for s in SHEETS:
- for p in SHEETS[s].sprites:
- SHEETS[s].sprites[p].convert()
- SHEETS[s].sprites[p].set_colorkey(COLORKEY)
+ self.testvgo = vgo.Entity(images.SHEETS["jisella_1"].sprites[(0, 0)], (100, 100))
# Utility methods
def toggle_on(self):
diff --git a/src/images.py b/src/images.py
@@ -81,3 +81,8 @@ class Sheet(object):
SHEETS = {
"jisella_1" : Sheet("jisella_1.png", (TILE_WIDTH, TILE_HEIGHT), 72)
}
+
+def convert_sheets(sheets):
+ for s in sheets:
+ for p in sheets[s].sprites:
+ sheets[s].sprites[p].convert()