Added some Comments.

This commit is contained in:
The Wobbler 2024-09-26 17:19:19 +02:00
parent 230f64f0b9
commit f9c98ae115

View file

@ -4,9 +4,13 @@ import os
from sprite_stacking_engine.settings import * 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): 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.viewing_angle = 360 // NUM_ANGLES
self.outline_thickness = 2 self.outline_thickness = 2
self.get_stacked_sprite_cache() 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 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 - 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": {} "frames": {}
} }