Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11979


Ignore:
Timestamp:
May 22, 2018, 1:04:40 PM (6 years ago)
Author:
dreherm
Message:

Debugged levelup

Location:
code/branches/3DPacman_FS18
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS18/data/overlays/PacmanHUD.oxo

    r11978 r11979  
    5858    />
    5959
     60    <PacmanHUDinfo
     61     position  = "0.5, 0.5"
     62     pickpoint = "0.0, 0.0"
     63     font      = "ShareTechMono"
     64     textsize  = 0.04
     65     colour    = "1.0, 1.0, 1.0, 1.0"
     66     align     = "left"
     67
     68     showlevel   = true
     69    />
     70
    6071 </OverlayGroup>
    6172</Template>
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc

    r11978 r11979  
    6464        }
    6565        this->posreset();
     66
     67        totallevelpoint = ObjectList<PacmanPointSphere>().size() + totallevelpoint;
     68        level++;
    6669    }
    6770
     
    124127        }
    125128
    126         }
    127 
    128 
    129        
     129        }
    130130
    131131    }
     
    193193    }
    194194
     195    int Pacman::getLevel(){
     196        return level;
     197    }
     198
    195199    void Pacman::posreset(){
    196200        for(int i = 0; i<4; ++i){
     
    202206    void Pacman::takePoint(PacmanPointSphere* taken){
    203207        ++point;
    204         if(point == totallevelpoint) this->levelUp();
     208        if(point == totallevelpoint){
     209            this->levelUp();
     210            return;
     211        }
    205212        Vector3 postaken = taken->getPosition();
    206213        postaken.y = -50;
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.h

    r11978 r11979  
    8787            int getTimer();
    8888            int getLives();
     89            int getLevel();
    8990
    9091
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGelb.h

    r11978 r11979  
    5959
    6060                // This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
    61                 if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
    62                 this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y)));
     61                //if (this->getLocalVelocity().z < 0 && std::abs(this->getLocalVelocity().z) < stallSpeed_)
     62                //this->moveRightLeft(-lift_ / 5.0f * value * sqrt(std::abs(this->getLocalVelocity().y)));
    6363            };
    6464            virtual void rotatePitch(const Vector2& value) override{};
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.cc

    r11978 r11979  
    117117        if(this->ismoving){
    118118            if(!(abs(this->actuelposition.z-target_z)<0.5)) {
    119                 velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z)*2);
     119                velocity = Vector3(0,0,-sgn(this->actuelposition.z-this->target_z));
    120120                move(dt, actuelposition, velocity);
    121121            }   
    122122            if(!(abs(this->actuelposition.x-target_x)<0.5)){
    123                 velocity = Vector3(-sgn(this->actuelposition.x-this->target_x)*2,0,0);
     123                velocity = Vector3(-sgn(this->actuelposition.x-this->target_x),0,0);
    124124                move(dt, actuelposition, velocity);
    125125            }
     
    440440    void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity){
    441441        if(!dontmove){
    442             this->setPosition(Vector3(actuelposition.x+20*velocity.x*dt,10,actuelposition.z+20*velocity.z*dt));
    443         if((abs(abs(velocity.x)-2)<0.1) && (abs(velocity.z-0)<0.1))
     442            this->setPosition(Vector3(actuelposition.x+speed*velocity.x*dt,10,actuelposition.z+speed*velocity.z*dt));
     443        if((abs(abs(velocity.x)-1)<0.1) && (abs(velocity.z-0)<0.1))
    444444            if(velocity.x<0){
    445445                 this->setOrientation(Quaternion(Radian(-1.57), Vector3(0, 1, 0))); 
     
    448448                 this->setOrientation(Quaternion(Radian(1.57), Vector3(0, 1, 0))); 
    449449            }
    450         if((abs(abs(velocity.z)-2)<0.1) && (abs(velocity.x-0)<0.1))
     450        if((abs(abs(velocity.z)-1)<0.1) && (abs(velocity.x-0)<0.1))
    451451            if(velocity.z<0){
    452452                 this->setOrientation(Quaternion(Radian(3.14), Vector3(0, 1, 0))); 
     
    485485
    486486    void PacmanGhost::levelupvelo(){
    487         velocity.x = velocity.x + 2;
    488         velocity.y = velocity.y + 2;
    489         velocity.z = velocity.z + 2;
     487        speed ++;
    490488    }
    491489}
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanGhost.h

    r11978 r11979  
    6969            Vector3 velocity;
    7070            Vector3 oldvelocity = Vector3(2,0,0);
     71            int speed = 20;
    7172
    7273        private:
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.cc

    r11978 r11979  
    6060        XMLPortParam(PacmanHUDinfo, "showgameover",   setGameover,   getGameover,   xmlelement, mode).defaultValues(false);
    6161        XMLPortParam(PacmanHUDinfo, "showlive",   setlive,   getlive,   xmlelement, mode).defaultValues(false);
     62        XMLPortParam(PacmanHUDinfo, "showlevel",   setlevel,   getlevel,   xmlelement, mode).defaultValues(false);
    6263       
    6364   
     
    102103            }
    103104
     105            if(this->showlevel){
     106                const std::string& live = "Level: "+multi_cast<std::string>(this->PacmanGame->getLevel());
     107                setTextSize(0.03);
     108                this->setCaption(live);
     109            }
     110
     111
    104112            if(death && !(this->showgameover)){
    105113                setTextSize(0.0);
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanHUDinfo.h

    r11978 r11979  
    8181                { return this->showlive; }
    8282
     83            inline void setlevel(bool value){
     84                this->showlevel = value;
     85            }
     86            inline int getlevel() const
     87                { return this->showlevel; }
     88
    8389
    8490        private:
     
    8995            bool showgameover;
    9096            bool showlive;
     97            bool showlevel;
    9198            int messageID;
    9299    };
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc

    r11978 r11979  
    8585
    8686    void PacmanPointAfraid::resetPacmanPointAfraid(){
     87        resetposition = this->getPosition();
     88        resetposition.y = 10;
    8789        this->setPosition(resetposition);
    8890    }
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointSphere.cc

    r11956 r11979  
    8585
    8686    void PacmanPointSphere::resetPacmanPointSphere(){
     87        resetposition = this->getPosition();
     88        resetposition.y = 10;
    8789        this->setPosition(resetposition);
    8890    }
Note: See TracChangeset for help on using the changeset viewer.