Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Asteroid_HS17/src/modules/asteroids2D/Asteroids2DShip.cc @ 11608

Last change on this file since 11608 was 11608, checked in by vyang, 6 years ago

Asteroids2D erfolgreich als Minigame eingebunden, Dimensionen des Spielfeldes werden im CenterPoint gesetzt.

File size: 2.8 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Florian Zinggeler
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file Asteroids2DShip.cc
31    @brief Implementation of the Asteroids2DShip class.
32*/
33
34#include "Asteroids2DShip.h"
35#include "core/CoreIncludes.h"
36
37namespace orxonox
38{
39    RegisterClass(Asteroids2DShip);
40
41    Asteroids2DShip::Asteroids2DShip(Context* context) : SpaceShip(context)
42    {
43        RegisterObject(Asteroids2DShip);
44
45        speed = 830;
46        isFireing = false;
47        damping = 10;
48
49        // not sure if has to be zero?
50        lastTimeFront = 0;
51        lastTimeLeft = 0;
52        lastTime = 0;
53    }
54
55    void Asteroids2DShip::tick(float dt)
56    {
57        SUPER(Asteroids2DShip, tick, dt);
58    }
59
60    void Asteroids2DShip::updateLevel()
61    {
62        lastTime = 0;
63        if (getGame())
64            getGame()->levelUp();
65    }
66
67/*    void Asteroids2DShip::moveFrontBack(const Vector2& value)
68    {
69        //lastTimeFront = 0;
70        //desiredVelocity.y = value.y * speed * 42;
71        orxout() << "FrontBack" << endl;
72        SUPER(Asteroids2DShip, moveFrontBack, value);
73    }
74
75    void Asteroids2DShip::moveRightLeft(const Vector2& value)
76    {
77        //lastTimeLeft = 0;
78        //desiredVelocity.x = value.x * speed;
79        orxout() << "RightLeft" << endl;
80        SUPER(Asteroids2DShip, moveFrontBack, value);       
81    }
82 */
83    void Asteroids2DShip::boost(bool bBoost)
84    {
85        //getGame()->bEndGame = bBoost;
86    }
87
88    inline bool Asteroids2DShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
89    {
90
91        removeHealth(100);
92        this->death();
93        return false;
94    }
95
96    Asteroids2D* Asteroids2DShip::getGame()
97    {
98        if (game == nullptr)
99        {
100            for (Asteroids2D* race : ObjectList<Asteroids2D>())
101            {
102                game = race;
103            }
104        }
105        return game;
106    }
107
108    void Asteroids2DShip::death()
109    {
110        getGame()->costLife();
111        SpaceShip::death();
112    }
113}
Note: See TracBrowser for help on using the repository browser.