79533278

Date: 2025-03-25 09:58:40
Score: 0.5
Natty:
Report link

The problem seems to be with how you're storing and updating the super_projectiles.
In your code, you are appending tuples to super_projectiles:super_projectiles.append((temp_projectile_rect, direction))And then you're modifying rect inside your loop:rect, direction = projectilerect.x += 10 # or other directionHowever, pygame.Rect is a mutable object, so the position does update, but you're not updating the tuple itself. Even though it seems to work because collisions are using the rect, your rendering logic is likely failing to update because you're storing and updating rects in-place without re-wrapping or tracking the changes properly.But the most likely actual cause is this:You’re reusing the same image (pie_projectile_image) for both normal and super projectiles — which is totally fine — but you're not scaling it before blitting, or the surface might be corrupted in memory if transformations were chained improperly.Here's a clean and safer version of how you could handle this:
Fix
Make sure pie_projectile_image is only loaded and transformed once, and stored properly.Ensure screen.blit() is called after filling or updating the screen
(e.g., after screen.fill()).Use a small class or dictionary to store projectile data for clarity.Example fix using a dict:# Initializationpie_projectile_image = pygame.transform.scale(pygame.image.load('Pie_projectile.png'), (100, 100))# In SuperAttack()super_projectiles.append({'rect': temp_projectile_rect, 'direction': direction})# In main loopfor projectile in super_projectiles[:]:rect = projectile['rect']direction = projectile['direction']# Moveif direction == 'left': rect.x -= 10elif direction == 'right': rect.x += 10elif direction == 'up': rect.y -= 10elif direction == 'down': rect.y += 10# Renderscreen.blit(pie_projectile_image, rect)
Also, double-check that your screen.fill() or background rendering isn't drawing after the blit call, which would overwrite the projectile visuals.
Debug Tips:
Make sure nothing is blitting over your projectiles after rendering.Try temporarily changing the image color or drawing a red rectangle as a placeholder:pygame.draw.rect(screen, (255, 0, 0), rect)If that shows up, the issue is with the image rendering

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: aditya rathore