I'm pretty new to python and I am currently taking a computer programming course in high school and I'm having trouble with my Galaga/Space Invaders knockoff. I'm trying to make so if the laser beam is in the same x range as an "alive" alien that it will change the alien to a "dead" one.(changing which pixels are visible). I can't seem to get the alive/visible parameter from my variable to the onm ouseClick function and just get an error of if alien1.visible==True: AttributeError: 'NoneType' object has no attribute 'visible whenever I click. We are using a version of python called CMU CS Academy which seems to function almost identically to python. I attached the full code below with the condensed parts just being the drawing of aliens or movement of the spaceship.
https://docs.google.com/document/d/1pmaTq8uvrGfDLkxPdxa1gc9dOr4Qd6f9TLrwtJ6mGmo/edit?usp=sharing
Image: https://i.stack.imgur.com/DXdX7.png
CodePudding user response:
You should claim aliens before you call it. Just put the part of #Aliens before #Spaceship Movement Left. It should be fine then.
