20 hours ago · Tech · 0 comments

Right, gonna reset that and do again, in a different order. Should go better: usually does. Didn’t even do a diff or look to see what I was trashing, just let it slide into oblivion. Now let’s look to see what we have. class DungeonView: def create_content_lists(self): self.content_views = [] self.content_sprite_list = arcade.SpriteList() for cell, content in self.dungeon.contents.items(): for item in content: sprite = item.get_sprite() sprite.position = cell.center_position(cell_size) self.content_views.append(ContentView(item, sprite)) self.content_sprite_list.append(sprite) class ContentView: def __init__(self, content_item, sprite): self.item = content_item self.sprite = sprite I think our first change, and I grant this is speculative, will be to make a dictionary instead of a list. We’ll need to be able to find a View given the item. So: def create_content_lists(self): self.content_views = dict() self.content_sprite_list = arcade.SpriteList() for cell, content in…

No comments yet. Log in to reply on the Fediverse. Comments will appear here.