165 days ago · 5 min read1045 words · Tech · hide · Fediverse post

SLet’s give the spikes the ability to respond differently to control state, rather than the current fixed arrangement. Artisanal hand-crafted code, of course. Hello, loves. I think we can rig up a small table to give some flexibility in how the spikes respond to the control messages. For now, we’ll just allow for a different mapping between the lever’s states and the spikes cycling and state. Here’s the relevant code now: class Animated(Content): ... def control_changed(control, state_number): match state_number: case 0 | 3: self.cycling = True case 1: self.cycling = False self.set_state(1, dungeon) case 2: self.cycling = False self.set_state(0, dungeon) def set_state(self, state, dungeon): self.state = state dungeon.publish('state_number', 'view', self, self.state) Let’s begin by adding a parameter to set_state, cycling. This will break our test: def set_state(self, cycling, state, dungeon): self.cycling = cycling self.state = state dungeon.publish('state_number', 'view', self,…

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