#ifndef KRAKEN_H
#define KRAKEN_H

#include "Case.h"
#include "Level.h"
#include "Kraken.h"

#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>

#include <string>
#include <vector>
#include <iostream>

#define TILE_WIDTH 30
#define TILE_HEIGHT 30

class Kraken
{
    public:
        Kraken(Level* level, int width=50, int height=50, int numberTenta=0);
        virtual ~Kraken();

        Level* Getlevel() { return m_level; }

        void Settexture(std::string name);

        sf::Sprite Gethead() { return m_head; }

        int getcounter(){return m_counter;}
        sf::Vector2f getposition(){return sf::Vector2f(pozX,pozY);}

        void placeTheHeadAnywhere();

        void setNumberTenta(int a){m_numberTenta=a;}


        /// /// /// /// /// // /// /// /// ///
        void setCoord(float x, float y){m_heroCoordX=x; m_heroCoordY=y;}
        void drawTheHead(int a=0);
        void drawATentacle();
        void update();
        bool isThereCollision(int x, int y);
        void setVector(std::vector<int> tab){m_coords=tab;}
        const bool isDamaged(){return m_damaged;}
        void Damaged(){ m_temp.restart(); m_damaged=true;}

        const bool isDead(){if(m_life==0){return true;} else {return false;}}

        int pickX(){return rand()%10+int(m_heroCoordX/TILE_WIDTH)-5;}
        int pickY(){return rand()%10+int(m_heroCoordY/TILE_HEIGHT)-5;}
     //   void restart() {m_clock.restart();}





    protected:
        float m_heroCoordX;
        float m_heroCoordY;
        int pozY;
        int pozX;
        Level* m_level;
        sf::Clock m_clock;
        sf::Clock m_tentacleClock;
        sf::Clock m_temp;
        sf::Time m_tentacleTime;
        sf::Texture m_texture;
        sf::Sprite m_head;
        sf::Sprite m_tentacle;
        sf::Time m_time;
        std::vector<std::string> m_tab;
        int m_maxX;
        int m_maxY;
        int m_counter;
        int m_life;
        int m_numberTenta;
        bool m_damaged;
        bool m_dead;
        float rapidity;
        std::vector<int> m_coords;
};

#endif // KRAKEN_H
