def work(): self.num_head_kill_in_section = 0 num_head = 7 #random.randint(1, 5) positions = range(8) random.shuffle(positions) self.interval_section = random.random() * 2 + 0.5 for i in range(num_head): self.interval_head = random.random() * 0.1 + 0.2 self.stick_time = random.random() * 0.05 + 0.05 self.appear_delay = random.random() * 1.5 if self.appear_delay < 6 * self.stick_time + 0.01: self.appear_delay = 6 * self.stick_time + 0.01 # Position of top left corner of bitmap original_head_pos = HolePosition.POS[positions[i]] head = Head(str(self.id), self, self.stick_time) # Actually position pos = (original_head_pos[0] - 30, original_head_pos[1] - 40) head.show(pos, self.appear_delay) self.heads.append(head) self.id += 1 time.sleep(self.interval_head)
def work(): if self.pos_index > 7: self.pos_index = 0 i = 0 self.id += 1 self.pos_index += 1 self.original_head_pos = HolePosition.POS[self.pos_index] head = Head(str(self.id), self) head.show(self.original_head_pos,3)