New answers tagged

0

The answer lies in this line here stuff = input_box1.handle_event(events) The screen that was initially passed to handle_events, but once pygame.quit() is called the screen variable in input_box1 was not updated. Changing the function to pass in the new screen surface fixed the issue.


1

This is expected as time is passed "by value" (you copy the content of the variable "into the function"). Perhaps you need to change your approach to "timer" as there appears to be no equivalent to "get_timer" to get the time left before the event is fired. I'm not exactly sure how your whole game is developed, but you ...


1

So, i realized that i was missusing the pygame.time.set_timer() function. In fact, this resulted in making me able to shoot the bullet only when the timer resets itself, but i wasn't able to shoot when the countdown timer starts again. Then i added the condition that the bullet should be in ready state before starting/restarting the timer (now, the timer won'...


1

If you're using the Unity engine and add AI scripting support with Python, that doesn't inherently give players "access to the underlying engine". The only way you'd be giving "access to the underlying engine" is if you made a Python wrapper that could access substantial portions of the Unity API, which would be a nightmare to implement. ...


1

For anybody else that runs into an issue like this, here is what worked for me. Add SRCALPHA to the Surface you are blitting to, and use convert_alpha() on the surface when there is transparency. image = pygame.Surface(rect.size,pygame.SRCALPHA).convert_alpha() It's important to use convert_alpha() on the loaded image as well or it won't treat the ...


Top 50 recent answers are included