Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Czlowiek::akcja() {
- //powieksza wiek!
- Zwierze::akcja();
- int skok = 1;
- if (licznikCzlowiekTurbo > 7) {
- skok = 2;
- }
- else if ((licznikCzlowiekTurbo <= 7) && (licznikCzlowiekTurbo >= 6)) {
- skok = rand()%2+1;
- }
- int nowy_x = this->getX();
- int nowy_y = this->getY();
- for (int i = 0; i < swiat.organizmy.size(); i++) {
- if (((this->getX() == swiat.organizmy[i]->getX()) && ((this->getY() == swiat.organizmy[i]->getY()))) && (this->getIndeks() != swiat.organizmy[i]->getIndeks())) {
- kolizja(*swiat.organizmy[i], swiat);
- }
- }
- int klawisz = swiat.getOstatniWcisnietyKlawisz();
- if ((klawisz == Swiat::GORA) && (nowy_y >= 1)) {
- nowy_y -= skok;
- this->setX(nowy_x);
- this->setY(nowy_y);
- }
- else if ((klawisz == Swiat::DOL) && (nowy_y <= (swiat.getRozmierY() - 2))) {
- nowy_y += skok;
- this->setX(nowy_x);
- this->setY(nowy_y);
- }
- else if ((klawisz == Swiat::LEWO) && (nowy_x >= 1)) {
- nowy_x -= skok;
- this->setX(nowy_x);
- this->setY(nowy_y);
- }
- else if ((klawisz == Swiat::PRAWO) && (nowy_x <= (swiat.getRozmiarX() - 2))) {
- nowy_x += skok;
- this->setX(nowy_x);
- this->setY(nowy_y);
- }
- if (licznikCzlowiekTurbo > 0) {
- licznikCzlowiekTurbo--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement