Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 11613 for code


Ignore:
Timestamp:
Nov 30, 2017, 6:34:56 PM (7 years ago)
Author:
vyang
Message:

Geschwindigkeit im Level angepasst, Raumschiff kann das Spielfeld nicht mehr verlassen. TO DO: Rausfinden wie Rotation funktioniert → in Asteroid2DShip Funktionen Yaw, Pitch, Roll ueberladen oder im Levelfile anpassen.

Location:
code/branches/Asteroid_HS17
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/data/levels/templates/spaceshipAsteroids2D.oxt

    r11608 r11613  
    2020   primaryThrust     = 150
    2121   auxilaryThrust    = 30
    22    rotationThrust    = 50
     22   rotationThrust    = 500
    2323
    2424   lift = 1;
     
    3535   collisionType     = "dynamic"
    3636   mass              = 4200000
    37    linearDamping     = 0.9999999
     37   linearDamping     = 0.9
    3838   angularDamping    = 0.9999999
    3939
     
    9898
    9999   speedfront     = 200
    100    speedback      =  70
    101    speedleftright =  70
    102    speedupdown    =  70
     100   speedback      = 200
     101   speedleftright =  100
     102   speedupdown    =  100
    103103
    104104   defEngineSndNormal = "sounds/Engine_low.ogg"
     
    107107   accelerationfront     = 700
    108108   accelerationbrake     = 700
    109    accelerationback      =  125
    110    accelerationleftright =  125
    111    accelerationupdown    =  125
     109   accelerationback      = 700
     110   accelerationleftright =  500
     111   accelerationupdown    =  500
    112112  >
    113113    <EffectContainer condition="idle">
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc

    r11608 r11613  
    5555        pattern = 1;
    5656        lastPosition = 0;
    57         // spawn enemy every 3.5 seconds
    58         //enemySpawnTimer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2D::spawnEnemy, this)));
    5957        this->numberOfBots_ = 0; //sets number of default bots temporarly to 0
    6058        this->center_ = nullptr;
    6159        this->setHUDTemplate("Asteroids2DHUD");
    6260    }
     61
     62
    6363
    6464    void Asteroids2D::levelUp()
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h

    r11608 r11613  
    8989            void costLife();
    9090
     91
    9192            bool bEndGame;
    9293            bool bShowLevel;
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DCenterPoint.cc

    r11608 r11613  
    4848
    4949        this->checkGametype();
    50         this->width_ = 200;
    51         this->height_ = 120;
     50        this->width_ = 1043;
     51        this->height_ = 646;
    5252    }
    5353    /**
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc

    r11608 r11613  
    4646        isFireing = false;
    4747        damping = 10;
     48        this->width = 1043;
     49        this->height = 646;
    4850
    4951        // not sure if has to be zero?
     
    5153        lastTimeLeft = 0;
    5254        lastTime = 0;
     55        timer.setTimer(3.5f, true, createExecutor(createFunctor(&Asteroids2DShip::showposition, this)));
     56    }
     57
     58    //Use this function to display your position on the field -> to determine field width and height
     59    void Asteroids2DShip::showposition()
     60    {
     61        Vector3 pos = this->getPosition();
     62        orxout() << "x = "<< pos.x << " y = " << pos.y << " z = "<< pos.z << endl;
    5363    }
    5464
     
    5666    {
    5767        SUPER(Asteroids2DShip, tick, dt);
     68        Vector3 pos = this->getPosition();
     69
     70        //haelt ship innerhalb des Kamerafensters, kommt oben bzw seitlich wieder raus. Man spawnt in (0,0)
     71        if(pos.x > width/2)   pos.x = -width/2;
     72        if(pos.x < -width/2)  pos.x = width/2;
     73        if(pos.z > height/2)  pos.z = -height/2;
     74        if(pos.z < -height/2) pos.z = height/2;
     75
     76        //2D movement, position should always = 0 on y-axis
     77        if(pos.y!=0) pos.y = 0;
     78        this->setPosition(pos);
     79
     80        //update level
     81
     82        //shoot?
    5883    }
    5984
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h

    r11608 r11613  
    4545//#include "Asteroids2DCenterPoint.h"
    4646
     47#include "tools/Timer.h"
     48
     49
    4750namespace orxonox
    4851{
     
    6164            virtual void boost(bool bBoost) override;
    6265
    63             //no rotation!
    64             virtual void rotateYaw(const Vector2& value) override{};
    65             virtual void rotatePitch(const Vector2& value) override{};
     66            //no rotation in x and z direction!
     67            virtual void rotateYaw(const Vector2& value) override{}; // Rotate in yaw direction.
     68            virtual void rotatePitch(const Vector2& value) override{}; // Rotate in pitch direction.
     69            virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction.
    6670
    67             //return to main menu if game has ended.
    68             virtual void rotateRoll(const Vector2& value) override{if (getGame()) if (getGame()->bEndGame) getGame()->end();};
     71
    6972
    7073            virtual void updateLevel();
     
    7477            float speed, damping, posforeward;
    7578            bool isFireing;
     79            void showposition();
    7680
    7781        protected:
     
    8084        private:
    8185            Asteroids2D* getGame();
     86            float width, height;
    8287            WeakPtr<Asteroids2D> game;
    8388            WeakPtr<WorldEntity> lastEntity;
     
    8994            } velocity, desiredVelocity;
    9095
     96            Timer timer;
    9197    };
    9298}
Note: See TracChangeset for help on using the changeset viewer.