#!/usr/bin/python3

import pygame
from pygame.sprite import Sprite

class Ahegao(Sprite):
    def __init__(self, game):
        """initializes the ahegao face"""
        super().__init__()
        
        self.screen = game.screen
        self.screen_rect = game.screen_rect

        #loads the ahegao images and makes rect
        self.image = pygame.image.load('sailor_moon/ahegao1-1.png')
        self.ahegao_1 = pygame.image.load('sailor_moon/ahegao1-1.png')
        self.ahegao_2 = pygame.image.load('sailor_moon/ahegao1-2.png')
        self.ahegao_3 = pygame.image.load('sailor_moon/ahegao1-3.png')
        self.ahegao_4 = pygame.image.load('sailor_moon/ahegao1-4.png')
        self.ahegao_5 = pygame.image.load('sailor_moon/ahegao1-5.png')
        self.rect = self.ahegao_1.get_rect()

        #position rect
        self.rect.midbottom = game.sailor_moon.rect.midtop
        self.rect.y = self.screen_rect.y

    def update(self, game):
        if game.processor_freq > 2300:
            self.image = self.ahegao_5
        elif game.processor_freq > 2000:
            self.image = self.ahegao_4
        elif game.processor_freq > 1500:
            self.image = self.ahegao_3
        elif game.processor_freq > 1000:
            self.image = self.ahegao_2
        else:
            self.image = self.ahegao_1
            
