diff --git a/CMakeLists.txt b/CMakeLists.txt index 31be9ee..c0178d5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,8 @@ file(GLOB sources src/*.cpp) +add_definitions("-Wall") + add_executable(kraken.elf ${sources}) diff --git a/src/Case.cpp b/src/Case.cpp index 84d3a13..830d597 100755 --- a/src/Case.cpp +++ b/src/Case.cpp @@ -44,15 +44,6 @@ void Case::draw(int whichOneX,int whichOneY,int x, int y) } -void Case::drawFree(int whichOneX,int whichOneY,float x, float y) -{ - {m_sprite.setTextureRect(IntRect(whichOneX*(TILE_WIDTH+1),whichOneY*(TILE_HEIGHT+1),TILE_WIDTH, TILE_HEIGHT));} - - m_sprite.setPosition(x,y); - m_window->draw(m_sprite); - -} - Case::~Case() { //dtor diff --git a/src/Case.h b/src/Case.h index 067fec1..10c0faa 100755 --- a/src/Case.h +++ b/src/Case.h @@ -14,26 +14,13 @@ class Case Case(sf::RenderWindow* window, float x=0, float y=0); virtual ~Case(); - float GetpositionX() { return m_positionX; } - void SetpositionX(float val) { m_positionX = val; } - - float GetpositionY() { return m_positionY; } - void SetpositionY(float val) { m_positionY = val; } - void Setposition(float x, float y){m_positionX=x;m_positionY=y;} - - int Getvalue(){return m_value;} - sf::RenderWindow* Getwindow() { return m_window; } - void Setwindow(sf::RenderWindow* val) { m_window = val; } - sf::Texture Gettexture() { return m_texture; } void Settexture(std::string name) ; - sf::Sprite Getsprite() { return m_sprite; } - void Setsprite(sf::Sprite val) { m_sprite = val; } /// /// /// /// /// void draw(int whichOneX,int whichOneY,int x, int y); - void drawFree(int whichOneX,int whichOneY,float x, float y); + bool ifClicked(); protected: diff --git a/src/Hero.h b/src/Hero.h index 294acd1..a3b4609 100755 --- a/src/Hero.h +++ b/src/Hero.h @@ -22,10 +22,8 @@ class Hero Hero(Kraken* kraken, float pozX, float pozY); virtual ~Hero(); - float GetspeedX() { return m_speedX; } void SetspeedX(float val) { m_speedX = val; } - float GetspeedY() { return m_speedY; } void SetspeedY(float val) { m_speedY = val; } float GetpozX() { return m_pozX; } @@ -34,20 +32,10 @@ class Hero float GetpozY() { return m_pozY; } void SetpozY(float val) { m_pozY = val; } - bool Getattacking() { return m_attacking; } void Setattacking(bool val) { m_attacking = val; } - sf::Vector2f Getstart() { return m_start; } - void Setstart(sf::Vector2f val) { m_start = val; } - - sf::Texture Gettexture() { return m_texture; } void Settexture(std::string name); - - sf::Sprite Getsprite() { return m_sprite; } - void Setsprite(sf::Sprite val) { m_sprite = val; } - - int Getstatut() { return m_statut; } - void Setstatut(int val) { m_statut = val; } + /// // /// /// // /// // /// // /// void draw(); void update(); @@ -58,7 +46,6 @@ class Hero int convertCoordY(float a) {return int(a/TILE_HEIGHT);} int next(float a, float b){return m_kraken->Getlevel()->getCoord(convertCoordX(a),convertCoordY(b))-'0';} void restartClock() {m_clock.restart();} - void setAttacking(bool val){m_attacking=val;} bool isDead() {return m_dead;} diff --git a/src/Kraken.h b/src/Kraken.h index f5c0490..421be67 100755 --- a/src/Kraken.h +++ b/src/Kraken.h @@ -23,23 +23,14 @@ class Kraken virtual ~Kraken(); Level* Getlevel() { return m_level; } - void Setlevel(Level* val) { m_level = val; } - sf::Texture Gettexture() { return m_texture; } void Settexture(std::string name); sf::Sprite Gethead() { return m_head; } - void Sethead(sf::Sprite val) { m_head = val; } - - sf::Sprite Gettentacle() { return m_tentacle; } - void Settentacle(sf::Sprite val) { m_tentacle = val; } int getcounter(){return m_counter;} sf::Vector2f getposition(){return sf::Vector2f(pozX,pozY);} - std::vector Gettab() { return m_tab; } - void Settab(std::vector val) { m_tab = val; } - void placeTheHeadAnywhere(); void setNumberTenta(int a){m_numberTenta=a;} @@ -54,10 +45,9 @@ class Kraken void setVector(std::vector tab){m_coords=tab;} const bool isDamaged(){return m_damaged;} void Damaged(){ m_temp.restart(); m_damaged=true;} - bool isAttacking() {if (m_counter==2) return true; return false;} const bool isDead(){if(m_life==0){return true;} else {return false;}} - void setDead(bool val){m_dead=val;} + 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();} diff --git a/src/Level.cpp b/src/Level.cpp index ede4fc0..c01cd2b 100755 --- a/src/Level.cpp +++ b/src/Level.cpp @@ -20,18 +20,6 @@ Level::Level(Case* aCase, int width, int height) } -char Level::findAnother(char val) -{ - - int x(0),y(0); - while (m_tab[y][x]!=val) - { - x=rand()%(m_width+1), y=rand()%(m_height+1); - } - return m_tab[y][x]; - - -} std::pair Level::findAnother2(char val) { @@ -88,19 +76,6 @@ const void Level::draw() } } -const void Level::show() -{ - for(int i(0);i findAnother2(char val); void create(); - const void show(); const void draw(); protected: