Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Vytvorte hraci drahu o 3 polich a libovolne delce. Na draze pobezi panacek, ktery bude umet pohyb doleva, doprava, nahoru(skoko), dolu(skrceni). Draha bude mit prekazky, kterym se bude muset panacek vyhybat.
- #Vytvorte tridu pro panacka tak, aby bylo mozne pridat nove typy panacku. Zakladne jsou 2 typy(normalni a nesmrtelny). Pri stredu s prekazkou se vyhodnoti, zda se panacek vyhnul, pokud ne, tak se zjisti, zda je nesmrtelny a pokud neni, tak umre.
- #Vytvorte tridu pro prekazdy tak, aby bylo mozne pridat nove typy prekazek. Zakladne budou 3 typy(lze obejit, lze podlest,lzepreskocit).
- #IMPLEMENTOVAT - napiste overeni, zda jsou panacek a prekazka na stejne souradnici
- #Vytvorte tridu pro nacteni skinnu(treba barvy),panacka,prekazky,...
- #include <iostream>
- #include <string>
- using namespace std;
- class prekazka
- {
- private:
- string typ;
- int x;
- int y;
- public:
- prekazka(int _x, int _y) : x(_x), y(_y) { ; }
- };
- class lze_obejit :public prekazka
- {
- private:
- string typ = "lze obejit";
- int x;
- int y;
- public:
- lze_obejit(int _x, int _y) : prekazka(_x, _y) { ; }
- };
- class lze_podlest : public prekazka
- {
- private:
- string typ = "lze podlest";
- int x;
- int y;
- public:
- lze_podlest(int _x, int _y) : prekazka(_x, _y) { ; }
- };
- class lze_preskocit : public prekazka
- {
- private:
- string typ = "lze preskocit";
- int x;
- int y;
- public:
- lze_preskocit(int _x, int _y) : prekazka(_x, _y) { ; }
- };
- class panacek
- {
- private:
- int nesmrtelnost;
- string pohyb;
- int x;
- int y;
- public:
- panacek(int _x,int _y) : x(_x),y(_y) { ; }
- virtual void posun(int _x, int _y, string _pohyb)
- {
- this->x = _x;
- this->y = _y;
- this->pohyb = _pohyb;
- }
- };
- class normalni : public panacek
- {
- private:
- int nesmrtelnost = 0;
- int x;
- int y;
- string pohyb;
- public:
- normalni(int _x, int _y) : panacek(_x,_y) { ; }
- void posun(int _x, int _y, string _pohyb)
- {
- this->x = _x;
- this->y = _y;
- this->pohyb = _pohyb;
- }
- };
- class nesmrtelny : public panacek
- {
- private:
- int nesmrtelnost = 1;
- int x;
- int y;
- string pohyb;
- public:
- nesmrtelny(int _x, int _y) : panacek(_x, _y) { ; }
- void posun(int _x, int _y, string _pohyb)
- {
- this->x = _x;
- this->y = _y;
- this->pohyb = _pohyb;
- }
- };
- int main(void)
- {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement