Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 13, 2017, 9:21:25 AM (7 years ago)
Author:
vyang
Message:

Kommentare hinzugefuegt und Projektile in die richtige Richtung ausgerichtet.

Location:
code/branches/Asteroid_HS17/src/modules/asteroids2D
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.cc

    r11660 r11668  
    3636        - Implement a counting system for the score
    3737        - HUD can be improved (display health, points, level etc.)
    38         - Projectiles still
     38        - Projectiles still fly in a mysterious direction
     39        - Problem: The asteroids spawn randomly on the playing field.
     40            During spawn or level up, there is the possibility that they pawn at the position of the ship.
     41            ->spawn somewhere with a safty distance/radius
     42
    3943*/
    4044
     
    5458
    5559        bEndGame = false;
    56         lives = 1000;
     60        lives = 3;
    5761        level = 1;
    5862        point = 0;
     
    7579        {
    7680
    77             //kann schoener gemacht werden
     81            //Do something that indicates a level up
    7882            for (int i = 0; i < 7; i++)
    7983            {
     
    9498
    9599
    96         //After level up -> spawn stones
     100        //After level up -> spawn stones. Modify for different difficulty level
    97101        for(int i = 0; i < level*2; i++){
    98102            spawnStone();
     
    111115                spawnStone();
    112116            }
    113 
     117            //after first tick, firstTick_ will remain false
    114118            this->firstTick_ = false;
    115119        }
     
    121125    {
    122126
    123         //stones are created with a size
     127        //stones are created with a size -> second constructor in Asteroids2DStone class
    124128        Asteroids2DStone* newStone = new Asteroids2DStone(this->center_->getContext());
    125129        newStone->setAsteroids2DPlayer(player);
    126130
     131        //look at templates in data/levels/templates/asteroidsAsteroids2D.oxt
    127132        switch(newStone->getSize()){
    128133            case 1:
     
    165170    void Asteroids2D::start()
    166171    {
    167         orxout() << "start" << endl;
     172        //orxout() << "start" << endl;
    168173
    169174        // Set variable to temporarily force the player to spawn.
     
    188193    }
    189194
    190     //wird gerufen, falls man einen Asteroiden trifft->Aufruf durch Schiffklasse
     195    //This function will be called from the ship or the stone class (if the stone was hit)
    191196    void Asteroids2D::addPoints(int numPoints)
    192197    {
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2D.h

    r11660 r11668  
    7777            virtual void end() override;
    7878
     79            //updates the game every few ns
    7980            virtual void tick(float dt) override;
    8081
     
    99100            // checks if multiplier should be reset.
    100101            void costLife();
     102
     103            //Returns player (ship) of the game
    101104            Asteroids2DShip* getPlayer();
    102105
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc

    r11666 r11668  
    2929/*  TODO:
    3030
    31 /**
    3231    @file Asteroids2DShip.cc
    3332    @brief Implementation of the Asteroids2DShip class.
     
    4645        RegisterObject(Asteroids2DShip);
    4746
    48         speed = 830;
    4947        isFireing = false;
    50         damping = 10;
    5148        this->width = 1043;
    5249        this->height = 646;
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.h

    r11660 r11668  
    6363            virtual void rotatePitch(const Vector2& value) override{}; // Rotate in pitch direction.
    6464            virtual void rotateRoll(const Vector2& value) override{}; // Rotate in roll direction.
    65             virtual void boost(bool boost) override;
     65            virtual void boost(bool boost) override; //Override, so that the ship does not shake
    6666            virtual void updateLevel();
    6767
    6868            virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override;
    6969
    70             float speed, damping;
    7170            bool isFireing;
     71           
     72            /*Functions that can be helpful while debugging.
     73                - Set a timer so that the function is called for instance every 3s to display the coordinates
     74                - Open console with "~`"-key in when you start the Asteroids2D - Minigame.
     75            */
    7276            void showposition();
    7377            void showorientation();
     78
     79
    7480            void toggleImmune()
    7581            {
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DStone.cc

    r11666 r11668  
    111111    inline bool Asteroids2DStone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    112112    {
    113         orxout() << "AsteroidStone getroffen" << endl;
    114113        if(orxonox_cast<Asteroids2DShip*>(otherObject))
    115114        {
    116             orxout() << "getroffen von Ship" << endl;
    117115            split();
    118116        }
     
    140138    void Asteroids2DStone::split()
    141139    {
    142         orxout() << "split" << endl;
     140        //orxout() << "split" << endl;
    143141        if(size == 3)
    144142        {
  • code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DWeapon.cc

    r11660 r11668  
    9393        this->computeMuzzleParameters(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getAimPosition());
    9494
    95         //projectile->setOrientation(this->getGame()->getPlayer()->getOrientation());
    96         projectile->setPosition(this->getMuzzlePosition());
    97 
     95        projectile->setOrientation(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation());
     96        projectile->setPosition(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getPosition());
    9897
    9998        //auf 2D Ebene druecken
    100         Vector3 muzzle2D = this->getMuzzleDirection();
     99        Vector3 muzzle2D = this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn()->getOrientation()* WorldEntity::FRONT;
    101100        muzzle2D.y = 0;
    102101
Note: See TracChangeset for help on using the changeset viewer.