Open ventorvar opened 1 year ago
I noticed that the chaser function tended to lock up after a bit.. looking at the code, I think it's due to the time.ticks_ms() function wraps the counter after a period of time. Changing it to the following may be a better way of that part of the code, unsure if that's the actual cause or fix:
if time.ticks_diff(self.next, time.ticks_ms()) <= 0:
colour = self.badge.pallet[int(1024*random())][0]
speed = (0.5-((random()-0.5)**2))*1.2*(1 if (random()>0.5) else 0)
# 0 1 2 3 4 5
# colour speed position life_rate life record
self.traces.append([colour, speed, float(random()*46), (random()*0.07), 1.0, array.array("f", [0]*46)])
self.next = time.ticks_add(time.ticks_ms(), int(random()*3500))
Also noticed one pixel on the badge's right ear also blushes with the boop feature. Changing the range from range(15)
to range(1,15)
fixes that.
Fix with the chaser function ended up being depending on the random number chose in the traces.append
line, you could have traces which had exceptionally long lives. The fix is adding this after the append.
# if traces are not dying off increase life_rate decay
if len(self.traces) > self.max_traces:
for i in range(len(self.traces)):
self.traces[i][3] += 0.01
This is not intended to actually be merged, as it's not a complete build environment
This is showcasing how you can quickly get some boop action by updating a few scripts