Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 13, 2017, 3:30:24 PM (7 years ago)
Author:
jkindle
Message:

Added jetpack, rotation of player, Questionmark-blocks and Hitlistener for the QBlocks. Made description for David in XML file for usage of hittable blocks

Location:
code/branches/SuperOrxoBros_FS17/src/modules/superorxobros
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/CMakeLists.txt

    r11392 r11400  
    55  SOBFigure.cc
    66  SOBItem.cc
    7  
     7  SOBQBlock.cc
    88
    99)
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.cc

    r11392 r11400  
    3838#include "graphics/Model.h"
    3939#include "graphics/Camera.h"
     40#include "graphics/ParticleSpawner.h"
     41
    4042
    4143namespace orxonox
     
    5658        timeSinceLastFire_ = 0.0;
    5759        lastSpeed_z = 0.0;
    58 
    59         gravityAcceleration_ = 250.0;
     60        isColliding_ = true;
     61        particlespawner_ = NULL;
     62
     63        gravityAcceleration_ = 350.0;
    6064        pitch_ = 0.0;
    6165
    6266        dead_ = false;
    6367        setAngularFactor(0.0);
    64     }
     68         this->enableCollisionCallback();
     69    }
     70
     71
     72
     73    bool SOBFigure::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
     74
     75        isColliding_ = true;
     76
     77
     78return true;
     79    }
     80
     81
    6582
    6683    void SOBFigure::XMLPort(Element& xmlelement, XMLPort::Mode mode)
     
    7087    }
    7188
     89
     90
    7291    void SOBFigure::tick(float dt)
    7392    {
    7493        SUPER(SOBFigure, tick, dt);
     94
     95        if (particlespawner_ == NULL) {
     96            for (WorldEntity* object : this->getAttachedObjects())
     97            {
     98                 if (object->isA(Class(ParticleSpawner)))
     99                    particlespawner_ = object;
     100                   
     101            }
     102 
     103        }
     104       
     105
     106
     107
     108
     109        if (firePressed_ == false) {
     110             gravityAcceleration_ = 350.0;
     111
     112        }
    75113
    76114        if (hasLocalController())
     
    96134
    97135
     136        //Handle the rocket fire from the jetpack
     137        if (velocity.z > 40)
     138            particlespawner_->setVisible(true);
     139        else
     140            particlespawner_->setVisible(false);
     141
    98142        //If player hits space and does not move in z-dir
    99         if (firePressed_ && std::abs(velocity.z) < 0.07 && std::abs(lastSpeed_z) < 0.07) {
    100             velocity.z = 150;
     143        if (firePressed_ && isColliding_ && std::abs(velocity.z) < 0.1 && std::abs(lastSpeed_z) < 0.1) {
     144            gravityAcceleration_ = 100.0;
     145            velocity.z = 110; //150
    101146        }
    102147
    103148      // rotate(1,getOrientation()* WorldEntity::FRONT)
    104149
     150
    105151        //Left-right movement with acceleration
     152        float rot = getOrientation().getRoll().valueDegrees();
    106153        if (moveRightPressed_) {
     154            if (rot < 0.0)
     155                    setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
     156
    107157            if (std::abs(velocity.x) < maxvelocity_x) {
    108158                velocity.x += speedAddedPerTick;
     159
     160               
     161
     162               
     163
    109164                // if (pitch_ > 0.0) {
    110165                //     pitch -= turn_fac*dt);
     
    112167            }
    113168        } else if (moveLeftPressed_) {
     169            if (rot >= 0.0)
     170                    setOrientation(Vector3::UNIT_Z, getOrientation().getRoll() + dt*Radian(6));
     171
    114172            if (std::abs(velocity.x) < maxvelocity_x) {
    115173                velocity.x -= speedAddedPerTick;
     
    152210    moveRightPressed_ = false;
    153211    moveDownPressed_ = false;
    154     firePressed_ = false;
     212    isColliding_ = false;
    155213
    156214}
     
    195253void SOBFigure::boost(bool boost)
    196254{
    197     firePressed_ = true;
    198 }
    199 }
     255    firePressed_ = boost;
     256}
     257}
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBFigure.h

    r11392 r11400  
    3333#include "worldentities/ControllableEntity.h"
    3434
     35
    3536namespace orxonox
    3637{
     
    4748         
    4849            virtual void boost(bool boost) override;
    49            
     50            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
     51
    5052       
    5153            //virtual void CollisionWithEnemy(SOBEnemy* enemy);
     
    6971            SOBCenterpoint* sobcenterpoint;
    7072            float pitch_;
     73            bool isColliding_;
     74            WorldEntity* particlespawner_;
    7175
    7276           
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.cc

    r11392 r11400  
    6767    bool SOBItem::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) {
    6868
    69 orxout() << "Watshc bum baem" << endl;
     69//orxout() << "Watshc bum baem" << endl;
    7070return true;
    7171    }
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBItem.h

    r11392 r11400  
    5050            virtual void touchFigure();
    5151            virtual  bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    52            
     52
    5353         
    5454            bool attachedToFigure_;
  • code/branches/SuperOrxoBros_FS17/src/modules/superorxobros/SOBPrereqs.h

    r11392 r11400  
    7878    class SOBFigure;
    7979    class SOBItem;
     80    class SOBQBlock;
    8081    /*
    8182    class PongScore;*/
Note: See TracChangeset for help on using the changeset viewer.