Python Forum
Tips on Converting BASIC to Pygame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tips on Converting BASIC to Pygame
#5
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.
Reply


Messages In This Thread
Tips on Converting BASIC to Pygame - by robin73 - Oct-05-2022, 08:03 AM
RE: Tips on Converting BASIC to Pygame - by Larz60+ - Oct-05-2022, 10:13 AM
RE: Tips on Converting BASIC to Pygame - by rob101 - Oct-05-2022, 11:59 AM
RE: Tips on Converting BASIC to Pygame - by Windspar - Oct-06-2022, 08:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Converting PyGame 2 axis joystick float to 360 angle archieab 1 3,315 Sep-26-2018, 05:40 PM
Last Post: archieab

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020