1

Hi I am very new to programming. I am taking a lesson in coding and my current task is to create a small game using pygame. The problem is that whenever I run my program, the background of my game has these horizontal artifacts running across the background (image link below). The actual game works, but the background looks broken.

I asked this question to the person teaching the course and they mentioned that I should try different versions of pygame on my computer to see if that would help. However that is also a problem, as the python terminal says that pygame 1.9.6 is installed, but WingPersonal in the debugging menu says that it is using pygame 2.0.0dev10. How do I fix this issue? Any help would be welcome.

I should add that I am using python 3.8.3 and my OS is macOS Catalina v10.15.5

Graphical Artifacts

The code itself:

from uagame import Window 
from time import sleep

# create window 
window = Window('Hacking', 600, 500)
window.set_font_name('couriernew')
window.set_font_size(18)
window.set_font_color('green')
window.set_bg_color('black')
    
# display header
line_y = 0
string_height = window.get_font_height()

window.draw_string('DEBUG MODE', 0, line_y)
window.update()
sleep(0.3)
line_y = line_y + string_height

window.draw_string('1 ATTEMPT(S) LEFT', 0, line_y)
window.update()
sleep(0.3)
line_y = line_y + string_height

#   display blank line
window.draw_string('', 0, line_y)
window.update()
sleep(0.3)
line_y = line_y + string_height


# prompt for guess
guess = window.input_string('ENTER PASSWORD >', 0, line_y)

#   clear window   
window.clear()

#   display failure outcome

x_space = window.get_width() - window.get_string_width(guess)
line_x = x_space // 2

outcome_height = 7 * string_height
y_space = window.get_height() - outcome_height
line_y = y_space // 2

window.draw_string(guess, line_x, line_y)
window.update()
sleep(0.3)
line_y = line_y + string_height

#   close window
window.close()
tnc1998
  • 11
  • 2
  • Can you post your pygame code? Not all of it if it's too long, but enough for us to work with. You might be blitting something without realizing it. – user3576467 Jun 20 '20 at 20:16
  • 1
    Assuming you are using uagame similar to [this](https://github.com/Aarowaim/snek/blob/master/uagame.py), make sure you have a call to `clear()`. – MegaIng Jun 20 '20 at 21:36
  • I edited my post and added a shortened version of the code I used. It still has the same problem. – tnc1998 Jun 21 '20 at 16:43

0 Answers0