Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 16, 2015, 4:43:55 PM (9 years ago)
Author:
meggiman
Message:

Alle Klassen implementiert um die Waffe abzufeuern. Noch sehr fehlerhaft.

Location:
code/branches/weaponFS15
Files:
3 added
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/weaponFS15/data/levels/emptyLevel.oxw

    r9415 r10369  
    1313
    1414<?lua
    15   include("templates/spaceshipAssff2.oxt")
     15  include("templates/spaceshipAssff.oxt")
    1616  include("templates/spaceshipPirate.oxt")
    1717  include("templates/spaceshipEscort.oxt")
     
    3030
    3131    <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/>
    32     <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipescort />
     32    <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
    3333   
    3434  </Scene>
  • code/branches/weaponFS15/data/levels/includes/weaponSettingsAssff.oxi

    r10326 r10369  
    4040        </Weapon>
    4141        <Weapon>
    42           <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
     42          <GravityBombFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
    4343          <RocketFire mode=3 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
    4444        </Weapon>
  • code/branches/weaponFS15/src/modules/weapons/WeaponsPrereqs.h

    r10336 r10369  
    7575    class ReplenishingMunition;
    7676    class RocketMunition;
     77    class GravityBombMuntion;
    7778
    7879    // projectiles
     
    9394    class RocketFire;
    9495    class SimpleRocketFire;
     96    class GravityBombFire;
    9597}
    9698
  • code/branches/weaponFS15/src/modules/weapons/munitions/CMakeLists.txt

    r7846 r10369  
    44  FusionMunition.cc
    55  RocketMunition.cc
     6  GravityBombMunition.cc
    67)
  • code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.cc

    r10341 r10369  
    66 */
    77#include "GravityBomb.h"
     8#include "graphics/Model.h"
    89
    910
    1011namespace orxonox{
    1112        RegisterClass(GravityBomb);
    12 
    13         const float GravityBomb::INITIAL_VELOCITY = 20;
    14         const float GravityBomb::SLOW_DOWN_RATIO = 2;
    1513
    1614        GravityBomb::GravityBomb(Context* context):
     
    2422                        if (GameMode::isMaster())
    2523                        {
    26                                 //Define movement of the bomb
    27                                 this->setVelocity(this->getOrientation()*WorldEntity::FRONT*INITIAL_VELOCITY);
    28                                 this->velocityAtLastTick_=INITIAL_VELOCITY;
    29                                 this->setAcceleration(this->getOrientation()*WorldEntity::BACK*SLOW_DOWN_RATIO);
    30                                 this->setCollisionType(WorldEntity::Dynamic);
     24                                //Define CollisionType of the bomb
     25                                this->velocityAtLastTick_= 1000;
     26                                this->setCollisionResponse(false);
     27                                this->setCollisionType(WorldEntity::Kinematic);
    3128                                this->enableCollisionCallback();
    3229
    3330                                //Add Collision Shape
    3431                                SphereCollisionShape* collisionShape = new SphereCollisionShape(context);
    35                                 collisionShape->setRadius(5.0);
     32                                collisionShape->setRadius(1.0);
    3633                                this->attachCollisionShape(collisionShape);
    3734
    3835                                //Create Bomb Model
    39 
     36                    Model* model = new Model(this->getContext());
     37                    model->setMeshSource("rocket.mesh"); //Demo Model from SimpleRocket
     38                    model->scale(0.7f);
     39                    this->attach(model);
    4040
    4141                        }
     
    4646        void GravityBomb::tick(float dt)
    4747        {
     48                        velocityAtLastTick_=getVelocity().length();
     49                        SUPER(GravityBomb,tick,dt);
    4850                        if(velocityAtLastTick_ < this->getVelocity().length())
    4951                        {
     52                                orxout(debug_output) << "bomb has stoped moving" <<endl;
    5053                                setVelocity(Vector3::ZERO);
    5154                                setAcceleration(Vector3::ZERO);
    5255                                velocityAtLastTick_=0;
    5356                                detonate();
     57                                orxout(debug_output) << "denoting" <<endl;
    5458                        }
    55                         velocityAtLastTick_=getVelocity().length();
     59                        else
     60                        {
     61                                velocityAtLastTick_=getVelocity().length();
     62                                orxout(debug_output)<< velocityAtLastTick_ <<endl;
     63                                orxout(debug_output) << "acceleration" << getAcceleration().length() <<endl;
     64                                destroyCheck();
     65                        }
    5666        }
    5767
    5868        bool GravityBomb::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint)
    5969        {
    60                 detonate();
     70                orxout(debug_output) << "collides" << endl;
    6171                processCollision(otherObject, contactPoint,cs);
     72                //detonate();
    6273                return true;
    6374        }
     
    6677        {
    6778                GravityBombField* field = new GravityBombField(this->getContext());
     79                orxout(debug_output) << "denoting" <<endl;
     80                this->destroy();
    6881        }
    6982}
  • code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBomb.h

    r10341 r10369  
    6666
    6767                private:
    68                 static const float INITIAL_VELOCITY;
    69                 static const float SLOW_DOWN_RATIO;
    7068
    7169                float velocityAtLastTick_; //Used to check wether the Object is already accelarating in the oposite direction to detect the time to detonate it.
  • code/branches/weaponFS15/src/modules/weapons/projectiles/GravityBombField.cc

    r10341 r10369  
    1111        RegisterClass(GravityBombField);
    1212
    13         const float GravityBombField::FORCE_FIELD_LIFETIME = 10;
    14         const float GravityBombField::FORCE_SPHERE_START_RADIUS = 50;
    15         const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -300;
     13        const float GravityBombField::FORCE_FIELD_LIFETIME = 5;
     14        const float GravityBombField::FORCE_SPHERE_START_RADIUS = 100;
     15        const float GravityBombField::FORCE_SPHERE_START_STRENGTH = -1000;
    1616
    1717        GravityBombField::GravityBombField(Context* context) : ForceField(context)
    1818        {
     19                RegisterObject(GravityBombField);
    1920                lifetime_=FORCE_FIELD_LIFETIME;
    2021                setVelocity(FORCE_SPHERE_START_STRENGTH);
     
    2728        void GravityBombField::tick(float dt)
    2829        {
     30                SUPER(GravityBombField,tick,dt);
    2931                lifetime_-=dt;
    3032                if(lifetime_ < 0)
     
    3739        {
    3840                //Animation
    39                 //SUPER(GravityBombField,destroy);
     41                ForceField::destroy();
    4042        }
    4143
  • code/branches/weaponFS15/src/modules/weapons/weaponmodes/CMakeLists.txt

    r7163 r10369  
    77  RocketFire.cc
    88  SimpleRocketFire.cc
     9  GravityBombFire.cc
    910)
  • code/branches/weaponFS15/src/modules/weapons/weaponmodes/GravityBombFire.h

    r10326 r10369  
    5858        private:
    5959            float speed_; //!< The initial speed of the bomb when it is launched.
     60            float slowDownRate_;
    6061    };
    6162}
Note: See TracChangeset for help on using the changeset viewer.