Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11400 for code/branches


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
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SuperOrxoBros_FS17/data/levels/SOB.oxw

    r11398 r11400  
    2929                        <attached>
    3030                                <Model  mesh="Orxo.mesh" scale=2.5 pitch=0 roll=90 yaw=90/>
     31                                <ParticleSpawner source="Orxonox/fire4" startdelay=0  position="-4,0,0" visible="false"/>
    3132                        </attached>
    3233
     
    110111
    111112                                        //Luft1
    112                                         <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/><!-- ? Block -->               <!-- 1 -->
     113
     114
     115
     116<!--                                    BLOCK 1 in der LUFT - alle analog wie diesen :) -->
     117<!-- Sobald ein QBlock von unten gehittet wird, wechselt die Visibility von allen attached Models. Hier wuerde also Cube1.1 invisible und Cube2.12 visible. Die Collisionshape wird ja sowieso beibehalten. -->
     118                                        <SOBQBlock collisionType="static">
     119                                                <attached>
     120                                                        <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/>
     121                                                        <Model mesh="Cube2.12.mesh" position="120,0,20" scale=10 visible="false"/>
     122                                                </attached>
     123                                                <collisionShapes>
     124                                                        <BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
     125                                                </collisionShapes>
     126                                        </SOBQBlock>
     127
     128
     129
     130
     131
     132
     133
     134
     135<!--                                    <Model mesh="Cube1.1.mesh" position="120,0,20" scale=10/><!-- ? Block -->               <!-- 1 -->
    113136                                        <Model mesh="Cube1.1.mesh" position="160,0,20" scale=10 />                                              <!-- 2 -->
    114137                                        <Model mesh="Cube1.1.mesh" position="170,0,20" scale=10 /><!-- Item Block -->   <!-- 3 -->
     
    118141                                        <Model mesh="Cube1.1.mesh" position="200,0,20" scale=10/>                                               <!-- 7 -->
    119142
    120                                                 <StaticEntity collisionType="static">
    121                                                         <collisionShapes>
    122                                                                 <BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
    123                                                                 <BoxCollisionShape position="160,0,20" halfExtents="5,5,5" /><!-- 2 -->
    124                                                                 <BoxCollisionShape position="170,0,20" halfExtents="5,5,5" /><!-- 3 -->
    125                                                                 <BoxCollisionShape position="180,0,20" halfExtents="5,5,5" /><!-- 4 -->
    126                                                                 <BoxCollisionShape position="180,0,60" halfExtents="5,5,5" /><!-- 5 -->
    127                                                                 <BoxCollisionShape position="190,0,20" halfExtents="5,5,5" /><!-- 6 -->
    128                                                                 <BoxCollisionShape position="200,0,20" halfExtents="5,5,5" /><!-- 7 -->
    129 
    130 
    131                                                         </collisionShapes>
    132                                                 </StaticEntity>
     143                                        <StaticEntity collisionType="static">
     144                                                <collisionShapes>
     145                                                        <!--<BoxCollisionShape position="120,0,20" halfExtents="5,5,5" /><!-- 1 -->
     146                                                        <BoxCollisionShape position="160,0,20" halfExtents="5,5,5" /><!-- 2 -->
     147                                                        <BoxCollisionShape position="170,0,20" halfExtents="5,5,5" /><!-- 3 -->
     148                                                        <BoxCollisionShape position="180,0,20" halfExtents="5,5,5" /><!-- 4 -->
     149                                                        <BoxCollisionShape position="180,0,60" halfExtents="5,5,5" /><!-- 5 -->
     150                                                        <BoxCollisionShape position="190,0,20" halfExtents="5,5,5" /><!-- 6 -->
     151                                                        <BoxCollisionShape position="200,0,20" halfExtents="5,5,5" /><!-- 7 -->
     152
     153
     154                                                </collisionShapes>
     155                                        </StaticEntity>
    133156
    134157
     
    157180                                        <Model mesh="Cube1.1.mesh" position="600,0,60" scale=10/>
    158181
    159                                                 <StaticEntity collisionType="static">
    160                                                         <collisionShapes>
    161                                                                 <BoxCollisionShape position="500,0,20" halfExtents="5,5,5" />
    162                                                                 <BoxCollisionShape position="510,0,20" halfExtents="5,5,5" />
    163                                                                 <BoxCollisionShape position="520,0,20" halfExtents="5,5,5" />
    164                                                                 <BoxCollisionShape position="570,0,60" halfExtents="40,5,5" />
    165 
    166 
    167 
    168 
    169                                                         </collisionShapes>
    170                                                 </StaticEntity>
     182                                        <StaticEntity collisionType="static">
     183                                                <collisionShapes>
     184                                                        <BoxCollisionShape position="500,0,20" halfExtents="5,5,5" />
     185                                                        <BoxCollisionShape position="510,0,20" halfExtents="5,5,5" />
     186                                                        <BoxCollisionShape position="520,0,20" halfExtents="5,5,5" />
     187                                                        <BoxCollisionShape position="570,0,60" halfExtents="40,5,5" />
     188
     189
     190
     191
     192                                                </collisionShapes>
     193                                        </StaticEntity>
    171194                                       
    172195
     
    200223
    201224
    202                                                 <StaticEntity collisionType="static">
    203                                                         <collisionShapes>
    204                                                                 <BoxCollisionShape position="645,0,60" halfExtents="15,5,5" />                                                  <!-- 1 -->
    205                                                                 <BoxCollisionShape position="670,0,20" halfExtents="5,5,5" />                                                   <!-- 2 -->
    206                                                                 <BoxCollisionShape position="670,0,60" halfExtents="5,5,5" />                                                   <!-- 3 -->
    207 
    208                                                                 <BoxCollisionShape position="720,0,20" halfExtents="5,5,5" />                                                   <!-- 4 -->
    209                                                                 <BoxCollisionShape position="730,0,20" halfExtents="5,5,5" />                                                   <!-- 5 -->
    210                                                                 <BoxCollisionShape position="780,0,20" halfExtents="5,5,5" />                                                   <!-- 6 -->
    211                                                                 <BoxCollisionShape position="800,0,20" halfExtents="5,5,5" />                                                   <!-- 7 -->
    212                                                                 <BoxCollisionShape position="800,0,60" halfExtents="5,5,5" />                                                   <!-- 8 -->
    213                                                                 <BoxCollisionShape position="820,0,20" halfExtents="5,5,5" />                                                   <!-- 9 -->
    214 
    215                                                                 <BoxCollisionShape position="890,0,20" halfExtents="5,5,5" />                                                   <!-- 10 -->
    216                                                                 <BoxCollisionShape position="930,0,60" halfExtents="15,5,5" />                                                  <!-- 11 -->
    217                                                                 <BoxCollisionShape position="990,0,60" halfExtents="5,5,5" />                                                   <!-- 12 -->
    218                                                                 <BoxCollisionShape position="1020,0,60" halfExtents="5,5,5" />                                                  <!-- 13 -->
    219                                                                 <BoxCollisionShape position="1005,0,20" halfExtents="10,5,5" />                                                 <!-- 14 -->
    220                                                                 <BoxCollisionShape position="1000,0,60" halfExtents="5,5,5" />                                                  <!-- 15 -->
    221                                                                 <BoxCollisionShape position="1010,0,60" halfExtents="5,5,5" />                                                  <!-- 16 -->
    222 
    223 
    224 
    225 
    226                                                         </collisionShapes>
    227                                                 </StaticEntity>
     225                                        <StaticEntity collisionType="static">
     226                                                <collisionShapes>
     227                                                        <BoxCollisionShape position="645,0,60" halfExtents="15,5,5" />                                                  <!-- 1 -->
     228                                                        <BoxCollisionShape position="670,0,20" halfExtents="5,5,5" />                                                   <!-- 2 -->
     229                                                        <BoxCollisionShape position="670,0,60" halfExtents="5,5,5" />                                                   <!-- 3 -->
     230
     231                                                        <BoxCollisionShape position="720,0,20" halfExtents="5,5,5" />                                                   <!-- 4 -->
     232                                                        <BoxCollisionShape position="730,0,20" halfExtents="5,5,5" />                                                   <!-- 5 -->
     233                                                        <BoxCollisionShape position="780,0,20" halfExtents="5,5,5" />                                                   <!-- 6 -->
     234                                                        <BoxCollisionShape position="800,0,20" halfExtents="5,5,5" />                                                   <!-- 7 -->
     235                                                        <BoxCollisionShape position="800,0,60" halfExtents="5,5,5" />                                                   <!-- 8 -->
     236                                                        <BoxCollisionShape position="820,0,20" halfExtents="5,5,5" />                                                   <!-- 9 -->
     237
     238                                                        <BoxCollisionShape position="890,0,20" halfExtents="5,5,5" />                                                   <!-- 10 -->
     239                                                        <BoxCollisionShape position="930,0,60" halfExtents="15,5,5" />                                                  <!-- 11 -->
     240                                                        <BoxCollisionShape position="990,0,60" halfExtents="5,5,5" />                                                   <!-- 12 -->
     241                                                        <BoxCollisionShape position="1020,0,60" halfExtents="5,5,5" />                                                  <!-- 13 -->
     242                                                        <BoxCollisionShape position="1005,0,20" halfExtents="10,5,5" />                                                 <!-- 14 -->
     243                                                        <BoxCollisionShape position="1000,0,60" halfExtents="5,5,5" />                                                  <!-- 15 -->
     244                                                        <BoxCollisionShape position="1010,0,60" halfExtents="5,5,5" />                                                  <!-- 16 -->
     245
     246
     247
     248
     249                                                </collisionShapes>
     250                                        </StaticEntity>
    228251
    229252
     
    254277
    255278
    256                                                 <StaticEntity collisionType="static">
    257                                                         <collisionShapes>
    258                                                                 <BoxCollisionShape position="1400,0,20" halfExtents="5,5,5" />
    259                                                                 <BoxCollisionShape position="1410,0,20" halfExtents="5,5,5" />
    260                                                                 <BoxCollisionShape position="1420,0,20" halfExtents="5,5,5" />
    261                                                                 <BoxCollisionShape position="1430,0,20" halfExtents="5,5,5" />
    262 
    263 
    264 
    265 
    266                                                         </collisionShapes>
    267                                                 </StaticEntity>
     279                                        <StaticEntity collisionType="static">
     280                                                <collisionShapes>
     281                                                        <BoxCollisionShape position="1400,0,20" halfExtents="5,5,5" />
     282                                                        <BoxCollisionShape position="1410,0,20" halfExtents="5,5,5" />
     283                                                        <BoxCollisionShape position="1420,0,20" halfExtents="5,5,5" />
     284                                                        <BoxCollisionShape position="1430,0,20" halfExtents="5,5,5" />
     285
     286
     287
     288
     289                                                </collisionShapes>
     290                                        </StaticEntity>
    268291
    269292
  • 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.