- Remember that
object methods
are always passedself
as the first parameter. - Remember the double underscores on both sides of
__init__()
. - Instance variables are unique to the
class
instance (object) that possesses them. - Class variables are the same across all instances of a
class
.
- Remember that
object methods
are always passedself
as the first parameter. - You can choose to allow the Alien's health to fall below zero, or require that it does not.
- Remember that
object methods
are always passedself
as the first parameter. - 0 may not be the only 'dead' condition, depending on how
hit()
is implemented.
- Remember that
object methods
are always passedself
as the first parameter. - Instance attributes can be updated from a method by using
self.<attribute>
=<new attribute value>
.
- Remember that
object methods
are always passedself
as the first parameter. - This method seems like an excellent place to use some kind of placeholder…
- Class attributes are the same across all instances of a
class
. - Ideally, this counter would increment whenever someone made an new Alien.
- Class attributes can be changed from an instance method by using the class name:
Alien.<class attribute name>
. __init__()
is considered an instance method since it initializes a new object.
- A
tuple
would be a single parameter. - The Alien constructor takes 2 parameters.
- Unpacking what is inside the tuple would yield two parameters.
- The standalone function is outside of the
class