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
#1
I posted on Stack Overflow about wanting some feedback/advice on converting old ZX Basic games to Pygame. I'd like to get some input on it, but so far no one has answered. I'm not sure what the deal is here with cross-posting, so for now I'll just leave a link to the question on SO: https://stackoverflow.com/questions/7395...opout-game

I'm happy to move the question over here and delete it on SO if that is preferred.
Reply
#2
Quote:I'm happy to move the question over here and delete it on SO if that is preferred.
copy post to here, rather than just posting a link, but leave original as is.
Reply
#3
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.
>>> import this

"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse

The UNIX philosophy: "Do one thing, and do it well."
Reply
#4
(Oct-05-2022, 11:59 AM)rob101 Wrote: 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.

lol. My first coding was in Q-Basic on a 386.

As for pygame, they'll need a graphics library of some kind even if they don't use any of it's other features.
Reply
#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


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyGame] Converting PyGame 2 axis joystick float to 360 angle archieab 1 2,587 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