Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 11, 2017, 4:06:44 PM (6 years ago)
Author:
vyang
Message:

Projektile fliegen in 2D Ebene, jedoch in eine falsche Richtung. Kommentare hinzugefuegt

File:
1 edited

Legend:

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

    r11637 r11660  
    2020 *
    2121 *   Author:
    22  *      Samuel Riedel
     22 *      Viviane Yang
    2323 *   Co-authors:
    2424 *      ...
     
    2626 */
    2727
     28
     29
    2830/**
    2931    @file Asteroids2DStone.cc
     32
    3033    @brief Implementation of the Asteroids2DStone class.
    31 */
     34
     35    TO DO: 
     36    - instead of moving over the boarders of the playing field, modify the tick function so that the stones bounce back
     37    - when to split? It does not work if you override kill() function...->damage() function?
     38*/
    3239
    3340#include "Asteroids2DStone.h"
     
    8794        Vector3 pos = this->getPosition();
    8895
     96
    8997        if(pos.x >= width/2){
    9098            pos.x = -width/2;
     
    103111    inline bool Asteroids2DStone::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
    104112    {
     113        orxout() << "AsteroidStone getroffen" << endl;
    105114        if(orxonox_cast<Asteroids2DShip*>(otherObject))
    106115        {
    107             this->split();
     116            orxout() << "getroffen von Ship" << endl;
     117            split();
    108118        }
    109119        return false;
     
    112122    void Asteroids2DStone::split()
    113123    {
     124        orxout() << "split" << endl;
    114125        if(size == 1)
    115126        {
     
    117128
    118129        }else if(size == 2){
     130
     131
     132            //Templates can be found in data/levels/templates/asteroidsAsteroids2D.oxt
    119133            Asteroids2DStone* newStone1 = new Asteroids2DStone(this->getContext(), 1, this->getPosition());
    120134            newStone1->addTemplate("stone1");
    121135            Asteroids2DStone* newStone2 = new Asteroids2DStone(this->getContext(), 1, this->getPosition());
    122136            newStone2->addTemplate("stone1");
     137           
    123138        }else{
    124139            Asteroids2DStone* newStone1 = new Asteroids2DStone(this->getContext(), 2, this->getPosition());
     
    129144    }
    130145
    131 
    132 
    133 
    134     //Overload kill function to generate 2 asteriods
    135     /*void Asteroids2DStone::kill()
    136     {
    137         this->damage(this->health)
    138         if(this->size < 1)
    139         {
    140             this->death();
    141         }else{
    142             size -= 1;
    143 
    144         }
    145 
    146 
    147     }*/
    148 
    149 
    150146}
Note: See TracChangeset for help on using the changeset viewer.