Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Asteroid_HS17/src/modules/minigametest/MiniGameTestShip.cc @ 11616

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

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

File size: 2.9 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 MiniGameTestShip.cc
31    @brief Implementation of the MiniGameTestShip class.
32*/
33
34#include "MiniGameTestShip.h"
35#include "core/CoreIncludes.h"
36
37namespace orxonox
38{
39    RegisterClass(MiniGameTestShip);
40
41    MiniGameTestShip::MiniGameTestShip(Context* context) : SpaceShip(context)
42    {
43        RegisterObject(MiniGameTestShip);
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 MiniGameTestShip::tick(float dt)
56    {
57        SUPER(MiniGameTestShip, tick, dt);
58    }
59
60    void MiniGameTestShip::updateLevel()
61    {
62        lastTime = 0;
63        if (getGame())
64            getGame()->levelUp();
65    }
66
67/*    void MiniGameTestShip::moveFrontBack(const Vector2& value)
68    {
69        //lastTimeFront = 0;
70        //desiredVelocity.y = value.y * speed * 42;
71        orxout() << "FrontBack" << endl;
72        SUPER(MiniGameTestShip, moveFrontBack, value);
73    }
74
75    void MiniGameTestShip::moveRightLeft(const Vector2& value)
76    {
77        //lastTimeLeft = 0;
78        //desiredVelocity.x = value.x * speed;
79        orxout() << "RightLeft" << endl;
80        SUPER(MiniGameTestShip, moveFrontBack, value);       
81    }
82 */
83    void MiniGameTestShip::boost(bool bBoost)
84    {
85        //getGame()->bEndGame = bBoost;
86    }
87
88    inline bool MiniGameTestShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
89    {
90
91        removeHealth(100);
92        this->death();
93        return false;
94    }
95
96    MiniGameTest* MiniGameTestShip::getGame()
97    {
98        if (game == nullptr)
99        {
100            for (MiniGameTest* race : ObjectList<MiniGameTest>())
101            {
102                game = race;
103            }
104        }
105        return game;
106    }
107
108    void MiniGameTestShip::death()
109    {
110        getGame()->costLife();
111        SpaceShip::death();
112    }
113}
Note: See TracBrowser for help on using the repository browser.