Exemple #1
0
 def __init__(self, enemy):
     animations = {
         'left': Animation(assets.images.enemies.krush, ('walk_left_1', 'walk_left_2', 'walk_left_3'), 100),
         'right': Animation(assets.images.enemies.krush, ('walk_right_1', 'walk_right_2', 'walk_right_3'), 100)
     }
     
     MovingState.__init__(self, enemy, animations, .4, 0)
Exemple #2
0
    def __init__(self, enemy):
        animations = {
            'moving':
            Animation(assets.images.enemies.turtle,
                      ('shell_move_1', 'shell_move_2', 'shell_move_3'), 100)
        }

        MovingState.__init__(self, enemy, animations, .5)
Exemple #3
0
    def process(self, tick_data):
        MovingState.process(self, tick_data)

        if self.entity.collides_with_player():
            if self.entity.is_hit_by_player():
                self.entity.bounce_player(tick_data)
                self.entity.play_sound_relative(assets.sounds.turtle.hit)
                return 'shell'

            self.entity.hit_player(tick_data)

        return 'walk'
Exemple #4
0
    def __init__(self, enemy):
        animations = {
            'left':
            Animation(assets.images.enemies.krush,
                      ('flat_left_1', 'flat_left_2', 'flat_left_3'), 100),
            'right':
            Animation(assets.images.enemies.krush,
                      ('flat_right_1', 'flat_right_2', 'flat_right_3'), 100)
        }

        self.counter = 0
        self.max_flat_time = 5000

        MovingState.__init__(self, enemy, animations, .1, 0)
Exemple #5
0
    def process(self, tick_data):
        MovingState.process(self, tick_data)

        self.counter += tick_data['time_passed']

        if self.counter > self.max_flat_time:
            return 'walk'

        if self.entity.collides_with_player():
            if self.entity.is_hit_by_player():
                self.entity.bounce_player(tick_data)
                self.entity.play_sound_relative(assets.sounds.krush.hit)
                self.counter = 0

        return 'flat'
Exemple #6
0
    def process(self, tick_data):
        flipped = MovingState.process(self, tick_data)
        if flipped:
            self.entity.play_sound_relative(assets.sounds.turtle.hit_shell)

        if self.entity.collides_with_player():
            self.entity.hit_player(tick_data)

        return 'shell_moving'
Exemple #7
0
    def exit(self):
        MovingState.exit(self)

        self.entity.rect.size = self.entity.default_size
        self.entity.rect.move_ip(0, -8)
Exemple #8
0
    def enter(self):
        MovingState.enter(self)

        self.counter = 0
        self.entity.rect.size = (60, 44)
        self.entity.rect.move_ip(0, 8)
Exemple #9
0
    def enter(self):
        MovingState.enter(self)

        self.entity.rect.size = (42, 36)
        self.entity.rect.move_ip(0, 28)