def draw(self, screen): if self.size == 1: function.line( screen, self.pos[0], self.pos[1], self.pos[0], self.pos[1], self.color ) # draws only one pixel else: function.circle(screen, self.pos[0], self.pos[1], self.size, self.color)
for j in plist: #checking for collision if dist(p.pos[0],p.pos[1],j.pos[0],j.pos[1]) <= (p.size + j.size)and p.id != j.id: if j.type=="s": plist.remove(p) elif j.type=="p": if p.size >2 and j.size >2: p.gen(plist, idt) idt+=round(pow(p.size, 0.8))-1 j.gen(plist, idt) idt+=round(pow(j.size, 0.8))-1 p.setpos(random.randint(1000,4000),random.randint(1000,4000)) j.setpos(random.randint(1000,4000),random.randint(1000,4000)) #teleports the planets really far away, and they're then removed due to being out of bounds if p.pos[0] > 800+p.size or p.pos[0] < 0-p.size or p.pos[1] > 600+p.size or p.pos[1] < 0-p.size: plist.remove(p) for p in tplist: function.line(screen, p.pos[0],p.pos[1], mpos[0],mpos[1], RED) function.circle(screen, p.pos[0], p.pos[1], p.size, p.color) function.rect(screen, 0,600, 800,160, (55,55,55)) for selector in selectorList: selector.draw(screen) function.flip() tloop+=1 #Every frame, the counter for the frames elapsed goes up by 1 clock.tick(120) #120 fps finally: pygame.quit() # Keep this IDLE friendly