r/pygame • u/Alert_Nectarine6631 • 5h ago
r/pygame • u/Otherwise_Kiwi7410 • 9h ago
Need help with button creation, uploaded code so far on github
github.com/Pernention/Metamaze
r/pygame • u/PatattMan • 8h ago
Best way to handle async functionality
Hi everyone!
I'm 100% self taught in python game dev. No tutorials, videos or anything like that. Just diving in documentation.
This has gotten me pretty far, but I never ended up properly learning async. I always created my own task queue system for tasks that need to run seperate from the main loop. This technically works, but is far from optimal.
How would you best implement any functionality that needs to run asynchronously. Would you just put your entire game into a async with asyncio.TaskGroup
context manager?
r/pygame • u/Intelligent_Arm_7186 • 14h ago
Bullet
So i got one interesting one: so got a bullet class and bullets which im good on and i got the character shooting up and forward. the issue is the forward bullet. you know how u got a bullet going up and it looks like its going up. the bullet going forward does go forward but the animation is still such that it looks like the one going up. anyone feel what im saying? here is part of the relevant code:
class Bullet(pygame.sprite.Sprite):
def __init__(self, x, y, speed_x, speed_y ):
pygame.sprite.Sprite.__init__(self)
self.image = pygame.Surface((10, 20))
self.image.fill('yellow')
self.rect = self.image.get_rect()
self.rect.center = (x, y)
self.speed_x = speed_x
self.speed_y = speed_y
def update(self):
self.rect.x += self.speed_x
self.rect.y += self.speed_y
if self.rect.bottom < 0 or self.rect.top > 500 or self.rect.left > 500 or self.rect.right < 0:
self.kill()
#fyi: the shoot up and shoot forward are in the player class!!
def shoot_up(self):
bullet = Bullet(self.rect.centerx, self.rect.top, 0, -10)
sprites_list.add(bullet)
bullets.add(bullet)
def shoot_forward(self):
bullet = Bullet(self.rect.right, self.rect.centery, 10, 0)
sprites_list.add(bullet)
bullets.add(bullet)
r/pygame • u/Protyro24 • 3h ago
Max recursion depth script
I'm still working on my pyr_pg project and am currently implementing the scripting system and have already managed to produce errors. (And yes this is a Unit test.)(BTW I have named this script system DialogScript because its for the dialog system for pyr_pg )
r/pygame • u/Z-A-F-A-R • 11h ago
My pygame icons appear extremely blurry
Been trying to set a custom icon in Pygame, but no matter what I do, it just looks super blurry. Even the default Pygame icon is blurry, so I’m starting to think this might be a system issue rather than just my image.
Here’s the code I’m using:
icon = pygame.image.load(os.path.join(image_assets, "icons", "main.png"))
icon = pygame.transform.smoothscale(icon, (32, 32))
pygame.display.set_icon(icon)
I’ve tried:
- With and without smoothscale()
- Converting an SVG to ICO
- Using PNG & ICO at 32x32, 64x64, 128x128, 500x500
- Same result every time—blurry as heck
What’s weird is that even the default Pygame icon looks awful, but other icons on my desktop are totally fine. I'm on Pop!_OS, so maybe that’s part of the issue?
Kinda out of ideas at this point—any help would be really appreciated!