131 days ago · 8 min read1678 words · Tech · hide · Fediverse post

Hello, loves! Resource designation is awkward, and I think we’re loading them multiple times. Let’s see what we can do about this. Arcade helps out! Here’s the sort of thing we have to put up with: class ContentFactory: def lever(self, *, name): def lever(self, interactor): self.state = (self.state+1)%len(self.resources) interactor.publish('control', self.name, state=self.state) interactor.publish('state_number', self.name, content=self, state=self.state) return False resource1 = '/Users/ron/Desktop/DungeonTiles/png/objects/lever/1.png' resource2 = '/Users/ron/Desktop/DungeonTiles/png/objects/lever/2.png' resource3 = '/Users/ron/Desktop/DungeonTiles/png/objects/lever/3.png' resource4 = '/Users/ron/Desktop/DungeonTiles/png/objects/lever/4.png' resources = [resource1, resource2, resource3, resource4] Sometimes I’ve resorted to a temp, only slightly less irritating: main.py ... resources=':resources:images/items/' my_resources = '/Users/ron/Desktop/DungeonTiles/png/objects/' factory =…

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