Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void this_player::checkPortal(bool up, int dir) {
- for(auto i = portals.begin();i!=portals.end();i++) {
- auto other = *i;
- switch(other->pt) {
- case 1:
- if (pdelay > 500 && up && x<other->x+20 && x > other->x-20 && y<other->y+20 && y > other->y-20) {
- pdelay = 0;
- if (Map::currentmap == tostring(other->tm)) {
- for(auto j = portals.begin();j!=portals.end();j++) {
- auto link = *j;
- if (other->tn == link->pn) {
- pdelay = 0;
- x = link->x;
- y = link->y-8;
- ground = 0;
- break;
- }
- }
- } else {
- Map::Load(tostring(other->tm), other->tn);
- }
- }
- break;
- case 2:
- if (pdelay > 500 && up && x<other->x+20 && x > other->x-20 && y<other->y+20 && y > other->y-20) {
- pdelay = 0;
- Map::Load(tostring(other->tm), other->tn);
- }
- break;
- case 3:
- if (x<other->x+50 && x > other->x-50 && y<other->y+50 && y > other->y-50) {
- if (Map::currentmap == tostring(other->tm)) {
- for(auto j = portals.begin();j!=portals.end();j++) {
- auto link = *j;
- if (other->tn == link->pn) {
- pdelay = 0;
- x = link->x;
- y = link->y-8;
- ground = 0;
- break;
- }
- }
- } else {
- Map::Load(tostring(other->tm), other->tn);
- }
- }
- break;
- case 10:
- other->close = false;
- if (x<other->x+100 && x > other->x-100 && y<other->y+100 && y > other->y-100) {
- other->close = true;
- if (pdelay > 500 && up && x<other->x+20 && x > other->x-20 && y<other->y+20 && y > other->y-20) {
- for(auto j = portals.begin();j!=portals.end();j++) {
- auto link = *j;
- if (other->tn == link->pn) {
- pdelay = 0;
- x = link->x;
- y = link->y-8;
- ground = 0;
- break;
- }
- }
- }
- }
- break;
- case 12:
- if (vel.ycomp() > 0 && x<other->x+40 && x > other->x-40 && y<other->y+10 && y > other->y-10) {
- vel.xcomp(300*dir);
- vel.ycomp(-2200);
- }
- break;
- case 13:
- if (x<other->x+40 && x > other->x-40 && y<other->y+10 && y > other->y-10) {
- vel.xcomp(other->hi*dir);
- vel.ycomp(-other->vi);
- }
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment