Answer the question
In order to leave comments, you need to log in
Self.ship = Ship(screen) doesn't work, gives an error screen name not found. I am writing a game in python with pygame please describe how to solve this problem?
there is a variable screen = display.set_mode((1200,800)) a and the interpreter does not find it
a game with a spaceship educational
Answer the question
In order to leave comments, you need to log in
Because you don't really have a local or global screen variable.
You declare self.screen, and this is a class field.
Unlike many other languages, python requires self to be explicit when accessing class fields from its methods, and does not allow them to be accessed as local variables.
So further in the Ship methods you will have to use self.screen.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question