124 days ago · 9 min read1890 words · Tech · hide · Fediverse post

Hello, loves! We’ll remain on the quest to simplify DungeonView a bit longer. I did some things last night, and we’ll do more this morning. As things stood when last we met, the DungeonView maintained more than one SpriteList, one for floor tiles and — I’ve already forgotten — one or more for content items. With a simple change, now all the sprites are in one list. class DungeonView(arcade.View): def __init__(self, dungeon): if arcade.window_commands._window: super().__init__() self.dungeon = dungeon self.pub_sub = dungeon.pub_sub self.subscribe(dungeon, self.pub_sub) self.setup_assets() self.sprite_list = arcade.SpriteList() self.keyed_floor_sprites = KeyedSpriteList(self.sprite_list) self.content_views: dict[Content, ContentView] = dict() self.content_views_by_cell: dict[Cell, list[ContentView]] = defaultdict(list) self.cameras = None self.keys = KeyPress(self, self.dungeon, self.pub_sub) We create just that one SpriteList, and then use it everywhere, in the floor sprites…

Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town