From f9c98ae115e955b61f62753d79b9cd987673e1aa Mon Sep 17 00:00:00 2001 From: EKNr1 Date: Thu, 26 Sep 2024 17:19:19 +0200 Subject: [PATCH] Added some Comments. --- sprite_stacking_engine/cache.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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": {} }