Posts: 453
Threads: 16
Joined: Jun 2022
ZX Basic: Wow! That takes me back. I cut my coding teeth with a ZX81
Do you really need Pygame for this? Not that I know the first thing about Pygame, but I suppose it'll be down to the type of game that you're trying to convert.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
Posts: 544
Threads: 15
Joined: Oct 2016
First. You only want one main loop. Have it waiting as loop is not good. Look at fourth tip.
Second. Pygame has many predefine colors. Just use strings. "white", "black"
import pygame
for color in list(pygame.color.THECOLORS):
print(color)
Third. Update the code. No need keeping the old ways. Computer don't work like that any more. Use some classes and sprites.
Fourth. Pygame.clock should not be use to limit your update. They will vary. It best to match monitor refresh rate. Use pygame.time.get_ticks() or a pygame.time.set_timer to control update speed.
Fifth. You do not want to keep render text in main loop. Render it and save the surface that returns. You just using more cpu then what you need. Render text uses a lot of cpu.
99 percent of computer problems exists between chair and keyboard.