That’s because you never set an initial value for x
and y
in either ArcherDown
or Archer
. You can solve this problem by adding a method such as
def __init__(self, x, y):
self.x = x
self.y = y
to each class.
More Related Contents:
- How do I detect if the mouse is hovering over a button? PyGame button class is not displaying the text or changing colour on hover
- What is the difference between super() with arguments and without arguments?
- Python – Class.function().function()
- How to add five rows of invaders in space invader game
- How can I call a function within a class?
- What is a clean “pythonic” way to implement multiple constructors?
- Embedding a Pygame window into a Tkinter or WxPython frame
- python pygame.camera.init() NO vidcapture
- How can I dynamically create derived classes from a base class
- How to get if a key is pressed pygame [duplicate]
- How can I make an Image with a transparent Backround in Pygame?
- How to install PyGame on Python 3.4?
- Pygame: Is there any easy way to find the letter/number of ANY alphanumeric pressed?
- Moving forward after angle change. Pygame
- Python Class Members
- How to refer to the class from within it (like a recursive function)
- How to make image stay on screen in pygame?
- Define a method outside of class definition?
- Using Properties in Python classes cause “maximum recursion depth exceeded” [duplicate]
- Is there a way to circumvent Python list.append() becoming progressively slower in a loop as the list grows?
- Get name of current class?
- Python Tkinter PhotoImage
- PyGame rect.move movement not functioning properly
- TypeError: attack() missing 1 required positional argument: ‘self’
- Using Python class as a data container [closed]
- How to declare a static attribute in Python?
- How to find instance of a bound method in Python?
- Trouble Installing Pygame on Mac OSX
- Pygame: Collision by Sides of Sprite
- How can I drag more than 2 images in PyGame?