Example #1
0
    def __init__(self, start_point, angle, inherited_velocity):
        # adds Bullet_speed to this velocity
        super().__init__()
        self._damage = 1
        self.angle = angle
        self.life = Bullet.BULLET_LIFE
        # this velocity assignment is taken from the instructions in the
        # assignment:
        #   "Bullets are should [sic] start with the same velocity of the ship
        #    (speed and direction) plus 10 pixels per frame in the direction
        #    the ship is pointed."
        # Let me know if this is not what you want. It makes sense logically,
        # but in cases where the ship is going faster than bulllet speed, the
        # bullet appears to have a negative direction.#
        self.velocity = inherited_velocity + Velocity.velocity_from_speed_angle(
            Bullet.BULLET_SPEED, self.angle)
        # old calculation below.
        #self.velocity = Velocity.velocity_from_speed_angle(inherited_velocity.speed + Bullet.BULLET_SPEED, (self.angle))

        # bullet center should be the ship's center plus the length of the ship's radius in the
        # proper direction. Taken care of in ship. Bullet is ignorant of ship.
        self.center = start_point
        # originally this was not a texture asset. it was just a small dot bullet.
        # having implemented this after implementing the other texture assets (rocks & ship)
        # I realize that texture should have been made a part of flyer. For this milestone
        # anyhow, it will remain individual extended class attributes rather than inherited.
        # self.texture = arcade.load_texture(constants.PATH_IMAGES + 'laserBlue01.png')
        self.texture = arcade.load_texture(constants.PATH_IMAGES +
                                           'laserBlue01.png')
        self.radius = Bullet.BULLET_RADIUS
Example #2
0
    def __init__(self, startPoint=Point()):
        super().__init__(startPoint)
        self.texture = arcade.load_texture(constants.PATH_IMAGES +
                                           'meteorGrey_big1.png')
        self.radius = self.texture.width / 2
        #TODO FIX! self.radius = BigRock.BIG_ROCK_RADIUS
        self.spin = BigRock.BIG_ROCK_SPIN

        #only bigrocks get an initial velocity
        self.velocity = Velocity.velocity_from_speed_angle(
            BigRock.BIG_ROCK_SPEED, self.angle)
        self.points = BigRock.BIG_ROCK_POINTS
        self._damage = 5