diff --git a/sprite_stacking_engine/cache.py b/sprite_stacking_engine/cache.py index 8508fad..3f99199 100644 --- a/sprite_stacking_engine/cache.py +++ b/sprite_stacking_engine/cache.py @@ -4,9 +4,13 @@ import os from sprite_stacking_engine.settings import * -class Cache: +class Cache: # the engine uses a cache so it doesnt have to calculate everything from start at every frame - + # (the cache also contains all the code for rendering the objects) def __init__(self): - self.stacked_sprite_cache = {} + self.stacked_sprite_cache = {} # dict to store the sprites in + + # limit angles so it doesnt have to store a sprite for every degree because it doesnt need 360 viewing angles - + # for a smooth looking rotation (180 angles is default, it needs half the RAM and still looks smooth) self.viewing_angle = 360 // NUM_ANGLES self.outline_thickness = 2 self.get_stacked_sprite_cache() @@ -22,7 +26,7 @@ class Cache: self.run_prerender(object_name, layer_array, attrs) # render the sprites into one 3d looking sprite for object_name in ANIMATED_SPRITE_ATTRS: # loop through all animated sprites and do the same as in the first - - self.stacked_sprite_cache[object_name] = { # loop but for every frame + self.stacked_sprite_cache[object_name] = { # loop but for every frame of the animation "frames": {} }