NEED SOME URGENT HELP: How do i fix this attribution error
this is a part of an entry for completion that's deadline is in a fed says. I had run into some errors and got some help from someone on this board. then I went I fixed the rest of it but now I am stuck on this attribution error that I don't know how to fix. This is the first time I am working with pygame, so I am pretty much a total beginner. any help again would be greatly appreciated.
In the Game
class the function _init_ should be __init__.
@JustCoding123 I did that but now it says the Game object has no attribute up key, is it another typo I need to fix?
@ArtemisNightingale Fixed it
def __init__(self): pygame.init() self.running, self.playing = True,False self.UP_KEY, self.DOWN_KEY, self.START_KEY, self.BACK_KEY = False, False, False, False self.DISPLAY_W, self.DISPLAY_H = 480,270 self.display=pygame.Surface((self.DISPLAY_W,self.DISPLAY_H)) self.window = pygame.display.set_mode(((self.DISPLAY_W,self.DISPLAY_H))) self.font_name = "8-BIT WONDER.TTF" self.BLUE,self.WHITE = (52,64,235),(255,255,255) self.main_menu = MainMenu(self) self.options = OptionsMenu(self) self.options = CreditsMenu(self) self.curr_menu = self.main_menu
@JustCoding123 thanks so much for the help! after I put in the changes you said and fixed the indention errors, I am now having a syntax error of line 2. I don't see the problem in it though?
@ArtemisNightingale In the MainMenu
class you again wrote _init_
and not __init__
I honestly don't know how to fix this problem.
hi, you made a typo:
the correct way to initialize a function is to use
__init__
so do that
@Coder100 thanks a lot! but did you spot any other typos by chance because no I have an attribution error of, Game object has no attribute UP_KEY
@ArtemisNightingale don't forget to indent all of this:
so it has all the same indentation as the class.
@Coder100 got it! but do you know how to fix the syntax error that's popping up for line 2? i don't see whats wrong
do you mean
import menu
orfrom menu import *
because when you import usingfrom import
you have to specify what you want to import. @ArtemisNightingale@Coder100 understood. I corrected it to "from menu import*". I think it almost worked but now they're saying there is a type error.