jakowskidev / uMario_Jakowski

uMario C++/SDL2 Game by Łykasz Jakowski
GNU General Public License v2.0
791 stars 248 forks source link

Flagpole doesn't award points #8

Open James-Burns-Dundee opened 6 years ago

James-Burns-Dundee commented 6 years ago

The flagpole didn't award points when touching it. I added the following code to event.cpp in the eENDPOINTS case:

if (CCore::getMap()->getFlag()->bPointsAwarded == false) { CCore::getMap()->getPlayer()->setScore(CCore::getMap()->getPlayer()->getScore() + CCore::getMap()->getFlag()->iPoints); CCore::getMap()->getFlag()->bPointsAwarded = true; }

As well as creating a boolean public variable in flag.h:

bool bPointsAwarded;

Which I defined in the Flag constructor in flag.cpp:

this->bPointsAwarded = false;