Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11939


Ignore:
Timestamp:
May 4, 2018, 11:22:50 PM (7 years ago)
Author:
dreherm
Message:

Afraid Test 1

Location:
code/branches/3DPacman_FS18/src/modules/pacman
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/3DPacman_FS18/src/modules/pacman/CMakeLists.txt

    r11915 r11939  
    44  PacmanGelb.cc
    55  PacmanPointSphere.cc
     6  PacmanPointAfraid.cc
    67)
    78
  • code/branches/3DPacman_FS18/src/modules/pacman/Pacman.cc

    r11933 r11939  
    6565    {
    6666        SUPER(Pacman, tick, dt);
     67
     68        if(!timer){
     69            timer = timer - dt;
     70            if(timer<=0){
     71                afraid = false;
     72                timer = 0;
     73            }
     74        }
    6775
    6876        int i = 0;
     
    119127        }
    120128    else{
    121 
    122129        for(int nrghost = 0; nrghost<3; ++nrghost){
    123130        bcolli = collis(ghosts[nrghost]->getPosition(), currentPosition);
     
    130137    void setAfraid(){
    131138        afraid = true;
     139        timer = 10; //Set timer to 10 seconds
    132140    }
    133141
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.cc

    r11933 r11939  
    2727 */
    2828
    29 #include "PacmanPointSphere.h"
     29#include "PacmanPointAfraid.h"
    3030
    3131#include "core/CoreIncludes.h"
     
    3434namespace orxonox
    3535{
    36     RegisterClass(PacmanPointSphere);
     36    RegisterClass(PacmanPointAfraid);
    3737
    3838    /**
     
    4242        The creator of this object.
    4343    */
    44     PacmanPointSphere::PacmanPointSphere(Context* context) : ControllableEntity(context)
     44    PacmanPointAfraid::PacmanPointAfraid(Context* context) : ControllableEntity(context)
    4545    {
    46         RegisterObject(PacmanPointSphere);
     46        RegisterObject(PacmanPointAfraid);
    4747        this->setCollisionType(CollisionType::None);
    4848    }
     
    5252        Destructor. Destroys controller, if present.
    5353    */
    54     PacmanPointSphere::~PacmanPointSphere()
     54    PacmanPointAfraid::~PacmanPointAfraid()
    5555    {
    5656        // Deletes the controller if the object was initialized and the pointer to the controller is not NULL.
     
    6161        Method for creating a AutonomousDrone through XML.
    6262    */
    63     void PacmanPointSphere::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     63    void PacmanPointAfraid::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    6464    {
    65         SUPER(PacmanPointSphere, XMLPort, xmlelement, mode);
     65        SUPER(PacmanPointAfraid, XMLPort, xmlelement, mode);
    6666    }
    6767
    6868
    69     void PacmanPointSphere::tick(float dt)
     69    void PacmanPointAfraid::tick(float dt)
    7070    {
    71         SUPER(PacmanPointSphere, tick, dt);
     71        SUPER(PacmanPointAfraid, tick, dt);
    7272    }
    7373
    74     bool PacmanPointSphere::taken(Vector3 playerpos)
     74    bool PacmanPointAfraid::taken(Vector3 playerpos)
    7575    {
    7676      if((abs(this->resetposition.x - playerpos.x)<0.1) && (abs(this->resetposition.z - playerpos.z)<0.1)){
     
    8383
    8484
    85     void PacmanPointSphere::resetPacmanPointSphere(){
     85    void PacmanPointAfraid::resetPacmanPointAfraid(){
    8686        this->setPosition(resetposition);
    8787    }
  • code/branches/3DPacman_FS18/src/modules/pacman/PacmanPointAfraid.h

    r11933 r11939  
    2727 */
    2828
    29 #ifndef _PacmanPointSphere_H__
    30 #define _PacmanPointSphere_H__
     29#ifndef _PacmanPointAfraid_H__
     30#define _PacmanPointAfraid_H__
    3131
    3232#include "OrxonoxPrereqs.h"
     
    3838namespace orxonox {
    3939
    40     class _OrxonoxExport PacmanPointSphere : public ControllableEntity
     40    class _OrxonoxExport PacmanPointAfraid : public ControllableEntity
    4141    {
    4242        public:
    43             PacmanPointSphere(Context* context);
    44             virtual ~PacmanPointSphere();
     43            PacmanPointAfraid(Context* context);
     44            virtual ~PacmanPointAfraid();
    4545
    4646            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
     
    4848
    4949            bool taken(Vector3 playerpos);
    50             void resetPacmanPointSphere();
     50            void resetPacmanPointAfraid();
    5151        private:
    5252           
Note: See TracChangeset for help on using the changeset viewer.