This question already has answers here:
pygame - How to display text with font & color?
(7 answers)
How to display some text in pygame?
(1 answer)
Closed 2 years ago.
I am creating a simulation using pygame and have noticed that pygame makes it a little complicated to have text on the window while the application is running. Right now, my program shows a ball moving around the screen and creates a trail of colors identifying how many times it has passed over that area. What I need to happen, and what the text will be used for, is to display the day and temperature above the grid the ball moves around. Every 20 directiontional changes equals a day and each day has a temperature associated with it, so as the program runs, the text has to change respective to the current day and temperature.
My question is:
Are there any good modules that I could import which could do this efficiently, as I only want to use pygame for rendering my simulation in a not so computationally expensive way?
Related
This question already has answers here:
How to scroll the background surface in PyGame?
(1 answer)
How can I make a scrolling background in python with pygame? [duplicate]
(1 answer)
Making the background move sideways in pygame
(2 answers)
How to move the background image with keys in pygame?
(1 answer)
Closed 1 year ago.
I'm currently using Python 3, is there a way to do background graphics in python to make a user feel like they're floating in constantly gray shifting air? Background that I want: watson-scott test.
An idea I've had so far: create a multitude of individual small gray clouds that come together to shift and form the gray "air mass". But it's going to take a lot of work, is there an easier way or a package I can use?
This question already has answers here:
how to make image/images disappear in pygame?
(1 answer)
How do I delete rect object from screen once player collides with it?
(1 answer)
Closed 1 year ago.
I am making a game in python using pygame for the visual interface and pymunk to simulate the physical collisions between the ennemies and everything works just fine but now i want to remove the enemy bodies when they die (get to 0 health), so i used pymunk.Space.remove(space, enemy.shape) and pymunk.Space.remove(space, enemy.body) and so far everything works , when the enemy dies he disappears but the problem is once the image disapeared the pymunk "bodies" that process collision still persist which then blocks the other enemies. Also i dont wan't to just once they die move their bodies out of the map as i'm worried about it causing lags > see the photos
This question already has an answer here:
Displaying Label on Tkinter for a fixed amount of time
(1 answer)
Closed 3 years ago.
I am really new to Python. I have a memory game assignment. I've started doing it but I am kind of stuck right now because I have to generate numbers that are gonna appear on the screen and disappear after 2 seconds. I managed to generate the numbers and I put the numbers as text on a label but can't make them disappear. Is there a function to do it?
For Tkinter there are some options for "forgetting" (making the label disappear).
label.pack_forget()
label.place_forget()
If you used pack then use pack_forget() and if your using place use place_forget(). To make them reappear, use the pack or place function again. To wait a certain amount of time you can use time.sleep but the better option is to use .after()
tk.after(10, function)
This question already has answers here:
Pygame lags after drawing full window grid
(1 answer)
How Can I Improve My Terrain Generator Performance I Get 40 FPS
(1 answer)
Closed 1 year ago.
I'm creating a game with my team in Python and Pygame.
It is a 2d battle royale game based in zombsroyale.io.
As the map is really big, the game starts to lag because it is loading the entire map, even the parts that aren't being shown on screen.
We would like pygame to only load the graphics that are currently being shown on screen, and when you move, stop loading the graphics that now aren't being shown and load the new graphics.
How could we achieve this in Python 3?
Thanks for reading.
EDIT: we've also checked that the game is less laggy when we set the screen window size to a smaller one (e.g. 680x680). How can we make the game's performance be good with a big window size (e.g. 1280x720)?
This question already has answers here:
Why does my game made with Pygame suddenly lag for a few seconds? [duplicate]
(1 answer)
Pygame is running slow
(1 answer)
Closed 2 years ago.
I'm designing a game in pygame that you can download here: https://github.com/hailfire006/games unfortunately, when you fly the ship near the space station, the framerate drops from a nice 30-40 to 16-20. I believe this is due to my blitting sprites onto the screen every frame, and I have been told that there is a way to only redraw parts of the screen that need redrawing, but no one ever explains how to do this.
Someone please help, I'm beginning to worry that I should abandon hope of ever making a good game in python, and that I'll have to learn an entirely new language just to deal with framerate...
p.s. any other way you know how to raise the fps would be welcome also