I have a question regarding FPS and memory, do any of you know if I use list and append pygame.squares/circles/other shapes, if radius or size minimized and became 0 and remove from the current list, stopped pygame.draw function after, but it will still stay in the game right??
So if I'm creating something like fire smoke effect (let's say create radius 12 pygame.draw.circles, append in a list, minimize, remove from list if radius <= 0 and stopped showing on screen), will the removed ones stored alot and slow down the whole speed and takes memory?? Do any of you know if theres any solution to this problem or minimize it?? Thank you, this will help me alot
def createparticle(self):
# make particle settings - original and fade size and add inside a list
self.mouseposition = pygame.mouse.get_pos()
self.x = pygame.mouse.get_pos[0]
self.y = pygame.mouse.get_pos[1]
self.fade_x = 1
self.fade_y = 1
self.radius = 12
self.ball = [[self.x, self.y], self.radius, [self.fade_x, self.fade_y]]
self.particles.append(self.ball)
def emit(self):
# run loop, blit and move particle
for p in self.particles:
p[0][1] += p[2][1]
p[0][0] += p[2][0]
p[1] -= 0.2
pygame.draw.circle(self.screen, pygame.Color('orange'), p[0], int(p[1]))
def deleteparticle(self):
# remove particle if size is smaller than 0
self.particles_copy = [p for p in self.particles if p[1] > 0]
self.particles = self.particles_copy