Create a new class that inherits from Actor like we already did for Projectile and Cannon. In addition to the attributes and methods created by Actor.__init__() this class should also have the following:
self.cannonLocation (default to (5,5))
self.hitpoints (default to 50)
self.speed (default to 0)
self.cannon (create a cannon, passing (self.x + self.cannonLocation[0], self.y + self.cannonLocation[1]) as the pos argument)
A move(dir) method that adds or subtracts self.speed to/from self.x and to/from
Create a new class that inherits from
Actor
like we already did forProjectile
andCannon
. In addition to the attributes and methods created byActor.__init__()
this class should also have the following:self.cannonLocation
(default to(5,5)
)self.hitpoints
(default to50
)self.speed
(default to0
)self.cannon
(create a cannon,passing (self.x + self.cannonLocation[0], self.y + self.cannonLocation[1])
as thepos
argument)move(dir)
method that adds or subtracts self.speed to/from self.x and to/from